Home   Help Search Login Register  

Author Topic: Global sound  (Read 1473 times)

0 Members and 1 Guest are viewing this topic.

Offline SniperUK

  • Members
  • *
  • I'm a llama!
Global sound
« 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.

Offline LeeHunt

  • Former Staff
  • ****
  • John 21:25
Re: Global sound
« Reply #1 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?

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Global sound
« Reply #2 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

Offline SniperUK

  • Members
  • *
  • I'm a llama!
Re: Global sound
« Reply #3 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.

Offline BuhBye

  • Members
  • *
  • I'm a llama!
Re: Global sound
« Reply #4 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.