• 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.

How to add a sound to be heard by others

Status
Not open for further replies.
Here is one way. Create a force (or "player group") variable named "SoundForce". Then make a sound variable called "TempSound".

This is how the trigger would look:
  • Set SoundForce = <Some Force>
  • Set TempSound = <Some Sound>
  • Custom script: if IsPlayerInForce(GetLocalPlayer(), udg_SoundForce) then
  • Custom script: call StartSound(udg_TempSound)
  • Custom script: endif
Just adjust "SoundForce" to the "Player Group" that should hear the sound (e.g. Allies of Player 1, and add Player 1 to it as well). Then set "TempSound" to the sound that should be heard.

The custom script will work if you copy it as it is. You should also be able to use "Sound - Play Sound" instead of the line "call StartSound()" if you'd like.

Note: For 3D sounds the process might be slightly different. You would instead use the function "Sound - Play Sound on Unit".
 
Level 4
Joined
Jan 21, 2013
Messages
42
It give me 2 errors , on costum script.

if IsPlayerInForce(GetLocalPlayer(), udg_SoundForce) then
(expected a name )

and then here
Custom script: endif
(expected code statement .... )

Here is one way. Create a force (or "player group") variable named "SoundForce". Then make a sound variable called "TempSound".

This is how the trigger would look:
  • Set SoundForce = <Some Force>
  • Set TempSound = <Some Sound>
  • Custom script: if IsPlayerInForce(GetLocalPlayer(), udg_SoundForce) then
  • Custom script: call StartSound(udg_TempSound)
  • Custom script: endif
Just adjust "SoundForce" to the "Player Group" that should hear the sound (e.g. Allies of Player 1, and add Player 1 to it as well). Then set "TempSound" to the sound that should be heard.

The custom script will work if you copy it as it is. You should also be able to use "Sound - Play Sound" instead of the line "call StartSound()" if you'd like.

Note: For 3D sounds the process might be slightly different. You would instead use the function "Sound - Play Sound on Unit".
 
Level 4
Joined
Jan 21, 2013
Messages
42
Untitled.png
 
Level 4
Joined
Jan 21, 2013
Messages
42
Variables were done first like u said, I'm pretty sure I'm doing someting else wrong or the script is wrong

You have to make a player group variable named "SoundForce". If you choose a different name for it, then you have to change "udg_SoundForce" to the name you have: "udg_<Insert Name Here>". For example, if you name it "SoundLala", it would be "udg_SoundLala" in the custom script.
 
Status
Not open for further replies.
Top