Play birth sound

Status
Not open for further replies.
Level 15
Joined
Aug 7, 2013
Messages
1,342
Hi,

What is the native to do this:

JASS:
native function playUnitSound takes unit whichUnit, string orderString returns nothing
endfunction
...
unit u = CreateUnit(Player(0), 'hfoo', 0, 0, 0)
call playUnitSound(u, "birth")
 
There is no such native.
If you want to play a sound, you need create sound first.
native CreateSound takes string fileName, boolean looping, boolean is3D, boolean stopwhenoutofrange, integer fadeInRate, integer fadeOutRate, string eaxSetting returns sound
Blizzard usually set the create sound as this data :
CreateSound(soundName, false, false, true, 12700, 12700, "")

Next is play sound:
native StartSound takes sound soundHandle returns nothing

And finally destroy sound when done playing:
native KillSoundWhenDone takes sound soundHandle returns nothing
 
There is no way to play a unit's birth sound without first adding it to the sound editor?

You can use CreateSound(). Whenever you add a sound via the sound editor, it just writes into your war3map.j with the proper functions (according to your settings). If you view the map script, you'll see it there.

But I'm not sure if that'll help with your problem. You would have to build the associations yourself with a hashtable.
 
Status
Not open for further replies.
Back
Top