- Joined
- Jan 21, 2013
- Messages
- 42
How to add a sound to be heard by others, exept enemies.. I want to create a sound communication sistem for my map, any suggestion?
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:
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.
- 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
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".
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.