Global sound cmd id?

This forum is for discussions on how to edit what can not be edited through the txt files, needless to say this isn't about battle net hacking.

Moderators: Nefarius, Havvoric

Post Reply
User avatar
karlock
Posts: 42
Joined: Mon Mar 16, 2015 1:16 pm

Global sound cmd id?

Post by karlock » Tue Apr 27, 2021 6:18 am

In 1.10f 6FCBC480.
D2UpdateUnit(D2UnitStrc* pUnit, int nParamId, D2UnitStrc* pTarget)

nParamId=18 unit say "I can't do that"
nParamId=85 merc say "I can't use that"
nParamId=87 merc say "I'll put that to good use"

Is there other soundId can be used with this function, that can be used to make unit say something?

And is there a way to play a sound to a Player?

User avatar
Necrolis
Senior Admin
Throne
Posts: 9125
Joined: Sat Mar 25, 2006 1:22 pm
Location: The Land of the Dead
Contact:
South Africa

Hand-picked

Re: Global sound cmd id?

Post by Necrolis » Wed Apr 28, 2021 9:30 pm

karlock wrote:
Tue Apr 27, 2021 6:18 am
Is there other soundId can be used with this function, that can be used to make unit say something?
You'd have to document the switch case on the client, but almost every sound triggered as part of a server validated action has one.
karlock wrote:
Tue Apr 27, 2021 6:18 am
And is there a way to play a sound to a Player?
From the client there is a D2 client function for this, which should be in the function list sticky. If you want it from the server I'd suggest hooking the existing message and adding a flag to signify thats its a direct sounds.txt index.
Image
Netiquette, Do you USE it?!?! | Nefarius' Fixed TXT Files | Terms Of Service
Blackened | Day of Death | D2GFEx
"What was yours is mine. Your land, your people, and now your life." - Lim-Dul, the Necromancer
Judgement is Final, Death is Eternal

User avatar
karlock
Posts: 42
Joined: Mon Mar 16, 2015 1:16 pm

Re: Global sound cmd id?

Post by karlock » Thu Apr 29, 2021 6:02 am

Necrolis wrote:
Wed Apr 28, 2021 9:30 pm
karlock wrote:
Tue Apr 27, 2021 6:18 am
Is there other soundId can be used with this function, that can be used to make unit say something?
You'd have to document the switch case on the client, but almost every sound triggered as part of a server validated action has one.
karlock wrote:
Tue Apr 27, 2021 6:18 am
And is there a way to play a sound to a Player?
From the client there is a D2 client function for this, which should be in the function list sticky. If you want it from the server I'd suggest hooking the existing message and adding a flag to signify thats its a direct sounds.txt index.
Great! Thanks for giving tips. I will try it from the clientside. :D

User avatar
karlock
Posts: 42
Joined: Mon Mar 16, 2015 1:16 pm

Re: Global sound cmd id?

Post by karlock » Thu Apr 29, 2021 8:56 am

Sir, I am getting more confuse with this function. This function does not send a packet to client directly.
This function will set the UnitStrc 0x6E which means "nUpdateType". I can't find more information about the "nUpdateType".

With a breakpoint on this function. The more info about this.
2 = levelup
19 = impossible
23 = over burdened
34 = enter wild but not complete A1Q1
35 = clear cave of A1Q1
...

nUpdateType(0x6e) and pUpdateUnit(0x70) are used by this function.

User avatar
Necrolis
Senior Admin
Throne
Posts: 9125
Joined: Sat Mar 25, 2006 1:22 pm
Location: The Land of the Dead
Contact:
South Africa

Hand-picked

Re: Global sound cmd id?

Post by Necrolis » Thu Apr 29, 2021 1:52 pm

karlock wrote:
Thu Apr 29, 2021 8:56 am
Sir, I am getting more confuse with this function. This function does not send a packet to client directly.
This function will set the UnitStrc 0x6E which means "nUpdateType". I can't find more information about the "nUpdateType".

With a breakpoint on this function. The more info about this.
2 = levelup
19 = impossible
23 = over burdened
34 = enter wild but not complete A1Q1
35 = clear cave of A1Q1
...

nUpdateType(0x6e) and pUpdateUnit(0x70) are used by this function.
Its queuing polymorphic messages on the units message chain (this are then dispatched to the players at the end of the frame). These are used to queue information specific to each unit (such as life updates). When it comes to sounds most of the time its queued directly to the players message queue. Except in the case of the mercs sounds, this is so it can apply a few volume modulations to it base on the mercs distance etc.

This is why you need to inspect the client side processor for the packet; unfortunately Blizzard sought fit to make a huge amount of switch cases for the sound messages, a lot are used for quest based sounds:

Code: Select all

enum eD2ClientSoundComands
{
	SOUNDCMD_INVALID		= -1,
	SOUNDCMD_TRAP			= 0x0,
	SOUNDCMD_ITEM_PICKUP	= 0x1,
	SOUNDCMD_LEVELUP		= 0x2,
	SOUNDCMD_QUEST_CUBE		= 0x3,
	SOUNDCMD_TRANSMUTE		= 0x4,
	SOUNDCMD_SHATTER		= 0x5,
	SOUNDCMD_IDENTIFY		= 0x6,	//REFRESHINV
	SOUNDCMD_CREATE_PORTAL	= 0x7,
	SOUNDCMD_EXIT_PORTAL	= 0x8,
	SOUNDCMD_ITEM_BREAK		= 0x9,
	SOUNDCMD_HEAL			= 0xA,
	SOUNDCMD_UNLOCK_CHEST	= 0xB,
	SOUNDCMD_EVADE			= 0xC,
	SOUNDCMD_NULL_3			= 0xD,
	SOUNDCMD_NULL_4			= 0xE,
	SOUNDCMD_NULL_5			= 0xF,
	SOUNDCMD_MON_TAUNT		= 0x10,
	SOUNDCMD_NULL_7			= 0x11,
	SOUNDCMD_NULL_8			= 0x12,
	SOUNDCMD_IMPOSSIBLE		= 0x13,
	SOUNDCMD_NO_USE			= 0x14,
	SOUNDCMD_NEED_MANA		= 0x15,
	SOUNDCMD_NEED_KEY		= 0x16,
	SOUNDCMD_OVERBURDENED	= 0x17,
	SOUNDCMD_NOT_IN_TOWN	= 0x18,
	SOUNDCMD_HELP			= 0x19,
	SOUNDCMD_FOLLOW			= 0x1A,
	SOUNDCMD_FOR_YOU		= 0x1B,
	SOUNDCMD_THANKS			= 0x1C, 
	SOUNDCMD_FORGIVE_ME		= 0x1D, //the necro's versions are funny :P
	SOUNDCMD_BYE			= 0x1E,
	SOUNDCMD_DIE			= 0x1F,
	SOUNDCMD_NULL_9			= 0x20,
	//QUEST
	SOUNDCMD_QUEST_COMPLETE_A1_Q6	= 0x21,
	SOUNDCMD_NULL_10				= 0x22,
	SOUNDCMD_QUEST_COMPLETE_A1_Q1	= 0x23,
	SOUNDCMD_QUEST_COMPLETE_A1_Q5	= 0x24,
	SOUNDCMD_NULL_11				= 0x25,
	SOUNDCMD_QUEST_ENTER_AREA_A1_Q2	= 0x26,
	SOUNDCMD_QUEST_ENTER_AREA_A1_Q3	= 0x27,
	SOUNDCMD_QUEST_ENTER_AREA_A1_Q4	= 0x28,
	SOUNDCMD_QUEST_ENTER_AREA_A1_Q6	= 0x29,
	//the rest are more quest sounds
	SOUNDCMD_MERCCANNOTEQUIP		= 0x55,
	SOUNDCMD_MERCTHANKS				= 0x56,
	SOUNDCMD_MERCCANNOTUSETHAT		= 0x57,
	SOUNDCMD_MERCLEVELUP			= 0x5B
};
Image
Netiquette, Do you USE it?!?! | Nefarius' Fixed TXT Files | Terms Of Service
Blackened | Day of Death | D2GFEx
"What was yours is mine. Your land, your people, and now your life." - Lim-Dul, the Necromancer
Judgement is Final, Death is Eternal

User avatar
karlock
Posts: 42
Joined: Mon Mar 16, 2015 1:16 pm

Re: Global sound cmd id?

Post by karlock » Thu Apr 29, 2021 2:21 pm

That is beyond my knowledge. It is tough to get the packet mechanic of d2 fully understood. I need do more research about this part if I have time.
Thanks for enlightment.

Post Reply

Return to “Code Editing”