• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Play birth sound

Status
Not open for further replies.
Level 15
Joined
Aug 7, 2013
Messages
1,338
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")
 
Level 11
Joined
Dec 19, 2012
Messages
411
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.
Top