// Play sSoundName
// - sSoundName: TBD - SS
// - sSoundName: String matching the filename from the various sounds contained in 
//    the Program Files Data folder zips, minus the .WAV extension.
// This will play a mono sound from the location of the object running the command.
// Note: Frequently must be used as an action (AssignCommand, DelayCommand) 
//  or nothing happens (depending on what event or object type you are calling from).
void PlaySound(string sSoundName);

PlaySound does not play while you have an action enqueued. Any action at all. For example, if you have three actions enqueued it will wait for all three to end before it executes. If you're trying to play a battlecry or one of the "I am attacking you" grunts, I suggest you use PlayVoiceChat. Unlike PlaySound, PlayVoiceChat will execute its sound for a PC no matter what they're doing.

However, if PlayVoiceChat doesn't have what you're looking for and you absolutely must play your sound simultaneously with enqueued actions there is a workaround. In the toolset create a creature. We'll call it sound_ninja. For good form set sound_ninja's appearance to something like an Air Elemental or Will-o-the-Wisp (InvisibleMan ironically, seems to be laden with bugs so don't use it). Then go down to the behavior tab. Set 'Disable AI While Hidden' to False and 'Script Hidden' to True. Next, remove all of sound_ninja's default scripts and create your own script in the 'On Spawn In Script' slot. In that script run PlaySound for your sound and DestroyObject shortly after on sound_ninja. It is in this script that you want to think about DelayCommand if you need to use it.

Instead of running PlaySound, run CreateObject in a wrapper and create sound_ninja at the part in your script where you want the sound run. Like a good little ninja, sound_ninja will be completely invisible, untargetable, execute his duty, and then kill himself out of sight without anyone ever being the wiser. Always destroy the creature that runs the sound as creatures tend to be more memory intensive than most other things. It will look exactly like your sound had played and you don't have to fret about the action queue.

P.S.: Best to create sound_ninja at the location of your target for those of us with 3d sound.

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.