OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: Jh62 on 18 Aug 2012, 06:50:27

Title: Sound in MP
Post by: Jh62 on 18 Aug 2012, 06:50:27
Hi.

I have a script where I control a unit.

I only let the server execute the file, because i don't want the client and the server fighting each other wheter the unit should go one way or another (altough the server is always right), so for this reason I execute it locally.

the problem is that when this unit play's a sound, it can only be heard on the local machine.

I've tried creating an invisible unit or gamelogic and make it play the sound (command "say"), but since the unit it's creating locally, the results are the same.

It's basically a zombie script that when you are close, it hits you, so every time this happens a sound is played.

I need that sound to be heard on all computers at the same time (with command "say"), but I can't figure out how.

Title: Re: Sound in MP
Post by: Gruntage on 18 Aug 2012, 09:08:49
I'm no expert when it comes to multiplayer editing, but perhaps the 'playsound' command will work?  :scratch:

Code: [Select]
playsound "sound"
Title: Re: Sound in MP
Post by: faguss on 23 Aug 2012, 13:13:48
Commands say and playSound are local. You have to execute them on all machines if you want to achieve a global effect.

Detect action locally (in this example run a script checking if player is hit by a zombie) and then play the sound. In other instances use publicVariable to transmit information