[Question] Accessing Client Side Files

04/24/2010 20:35 -Spirits-#1
My objective by asking this question is to be able to access a sound from the client folder so that when a firework goes off (for example) it makes the sound. Ultimately, I want to be able to play sounds for NPCs such as the starter quest's slashing sounds and such. How do I access sound files from the client folder?
04/24/2010 21:36 s.bat#2
[Only registered and activated users can see links. Click Here To Register...]
A quick search would have found your answer.
04/24/2010 21:51 Paralyzer[GM]#3
Yeah,

Code:
GuildName = 0x3,
Spouse = 0x6,
Effect = 0xA,
GuildList = 0xB,
ViewEquipSpouse = 0x10,
[COLOR=Red][B]Sound = 0x14,[/B][/COLOR]
GuildEnemies = 0x15,
GuildAllies = 0x16,
04/25/2010 00:34 -Spirits-#4
So wait, what am I supposed to do with that because I think I'm doing it wrong...

CC.MyClient.AddSend(Packets.String(CC.EntityID, 14, "music.mp3"));

I've tried it a lot of different ways too. rofl

CC.MyClient.AddSend(Packets.String(CC.EntityID, 14, "music"));
CC.MyClient.AddSend(Packets.String(CC.EntityID, 0x14, "music.mp3"));
CC.MyClient.AddSend(Packets.String(CC.EntityID, 0x14, "music"));

Help =s
04/25/2010 04:00 s.bat#5
Quote:
Originally Posted by -Spirits- View Post
So wait, what am I supposed to do with that because I think I'm doing it wrong...

CC.MyClient.AddSend(Packets.String(CC.EntityID, 14, "music.mp3"));

I've tried it a lot of different ways too. rofl

CC.MyClient.AddSend(Packets.String(CC.EntityID, 14, "music"));
CC.MyClient.AddSend(Packets.String(CC.EntityID, 0x14, "music.mp3"));
CC.MyClient.AddSend(Packets.String(CC.EntityID, 0x14, "music"));

Help =s
Dec 14 is not the same as Hex 14. Use either 20 or 0x14. Make sure the name of the sound you are sending is located in the client's sound folder.
04/25/2010 06:20 -Spirits-#6
Quote:
Originally Posted by s.bat View Post
Dec 14 is not the same as Hex 14. Use either 20 or 0x14. Make sure the name of the sound you are sending is located in the client's sound folder.
I tried this code using 20 and 0x14...
Code:
if (Cmd[0] == "/sound")
                    {
                        Game.Character C = GC.MyChar;
                        foreach (Game.Character CC in Game.World.H_Chars.Values)
                        {
                            if (CC.Loc.Map == C.Loc.Map && MyMath.InBox(C.Loc.X, C.Loc.Y, CC.Loc.X, CC.Loc.Y, 20))
                                CC.MyClient.AddSend(Packets.String(CC.EntityID, 0x14, Cmd[1]));
                        }
                    }
and it's still not working. I'm not sure what I'm doing wrong.
04/25/2010 11:54 Korvacs#7
The string packet needs to send 2 strings for music:

Code:
Strings[0] = "sound/" + Client.Char.Map + ".mp3";
Strings[1] = "1";
Ive forgotten what the 1 does, but it wont work without it. To stop playing an existing track send something like this:

Code:
Strings[0] = "sound/" + " " + ".mp3";
Strings[1] = "1";
04/25/2010 13:50 _Emme_#8
I think the 1 is for if it's on or off. Try sending Strings[1] = "0" when you want to stop a sound, although I'm not really sure.
04/25/2010 17:42 -Spirits-#9
What about for the 5165 source though?
Now I'm coming up with something like this:
Code:
public static COPacket Sound(uint UID, byte Type, string str) // Note1
        {
            byte[] Packet = new byte[8 + 11 + str.Length];
            COPacket P = new COPacket(Packet);

            P.WriteInt16((ushort)(Packet.Length - 8));
            P.WriteInt16((ushort)0x3f7);
            P.WriteInt32(UID); // Target
            P.WriteByte(Type); // Type 20 = sound
            P.WriteByte(1);
            P.WriteByte((byte)str.Length);
            P.WriteString("sound/" + str + ".mp3");
            P.WriteByte(1);

            return P;
        }
Code:
if (Cmd[0] == "/sound")
                    {
                        Game.Character C = GC.MyChar;
                        foreach (Game.Character CC in Game.World.H_Chars.Values)
                        {
                            if (CC.Loc.Map == C.Loc.Map && MyMath.InBox(C.Loc.X, C.Loc.Y, CC.Loc.X, CC.Loc.Y, 20))
                                CC.MyClient.AddSend(Packets.Sound(CC.EntityID, 20, Cmd[1]));
                        }
                    }