Jump to content
Sign in to follow this  
Naiss

play sound for not only player

Recommended Posts

okey so i got an action on a object and when you click it it will start a sound but only the person who click it can hear it is there anyway i can make it so everyone thats close to the object can hear it

Share this post


Link to post
Share on other sites

you can make a trigger and put this in it's ON ACT:

nameOfObject playSound3D"nameofsong";

And this in it's condition:

!(!isNil "thisPlaySound");

Then put this in the script that executes when a player clicks the action:

if(isNil "thisPlaySound") then { thisPlaySound=true; publicVariable"thisPlaySound";  } else { hint"sound is already playin"; };

that should work :)

Share this post


Link to post
Share on other sites

okey thanks but what if i dont want to use a trigger?

Share this post


Link to post
Share on other sites

You can use a addaction command, someone else can help elaborate on this one, but more or less that should be the case.

Share this post


Link to post
Share on other sites

In that case, here is what you can try:

In your mission's init.sqf, put this in it somewhere at the top: (free from other if checks of course)

call compile preprocessfilelinenumbers "compile\missionInit.sqf";

Then create a file called missionInit.sqf and put it inside a folder called "compile" (without the quotes). Place that folder inside the root of your mission.

Put this code inside missionInit.sqf:

fnc_PlayDatSound = { nameOfObject playSound3D"nameofsong"; };

And then put this inside the script that activates when you press the action on the object that should play the music/sound/song/whatever:

["","fnc_PlayDatSound"] spawn BIS_fnc_MP;

Share this post


Link to post
Share on other sites

okey thanks i will try this later

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×