OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting Multiplayer => Topic started by: SniperUK on 22 Jun 2007, 01:09:11

Title: Global sound
Post by: SniperUK on 22 Jun 2007, 01:09:11
Hey guys, i know this one has been touched on a few times in other posts but i can not seem to find an answer to any of it.
What i have at the moment is a player who is executing a script for example shout = [player1] exec "shout.sqs";
The script itself has a playsound command in like:

playsound "shout".

Which obviously executes locally and only the player who carried out the add action can here.
What i am after is when a player executes this script everyone can hear the shout.
I have tried a number of different ways, even trying to create a game logic at the location and getting the game logic to 'say' the sound. But this too seemed to only execute locally as the game logic was created using a script.
Any ideas how i can get all players to hear the same sound?
Any help would be appreciated, thanks in advance.
Title: Re: Global sound
Post by: LeeHunt on 22 Jun 2007, 01:14:20
you could have each member of the squad themselves playsound "shout"

{_x playsound "shout")} foreach units _group

something like that?
Title: Re: Global sound
Post by: Mandoble on 22 Jun 2007, 01:22:01
Just a basic example

in your init.sqs file:
Code: [Select]
;for everyone, not only the server
doshout = false
[]exec"waitforshout.sqs"

Code: [Select]
;waitforshout.sqs
#waitforshout
@!doshout
playSound "shout"
doshout = false
goto "waitforshout"

Code: [Select]
;Your script attached to the shout menu action
doshout = true
publicVariable "doshout"
exit
Title: Re: Global sound
Post by: SniperUK on 22 Jun 2007, 03:16:18
this worked perfectly apart from the line @!doshout should have been @doshout, but i have it working, thanks alot.
Title: Re: Global sound
Post by: BuhBye on 22 Jun 2007, 17:30:20
Just for future referance a easy way to do this is to drop a trigger and put the playsound command in the OnAct field and set the condition to a publicvariale. Then in the script that the unit runs, chance the variable to 1.