Jump to content
Sign in to follow this  
M1ke_SK

stop playSound3D sound

Recommended Posts

I have object, that is playing sound with 60 seconds repeat. Object is used in multiplayer mission (dedicated server) so I would like to use playSound3D because have global effectEffects of this scripting command are broadcasted over the network and happen on every computer in the network . I am open to solutions with say3D, say, ... if it is applicable in multiplayer (e.g. everybody can hear sound in multiplayer).

 

Problem: When object is destroyed, sound is still playing. This is kind of non-realistic. I want to stop sound immediately after object is destroyed.

 

Here is what I got so far:

 

sound.sqf

params ["_object"];

_root = str missionConfigFile select [0, count str missionConfigFile - 15];
_object setVariable ["on", true, true];
_object addEventHandler [
    "HandleDamage", 
    { 
        (_this select 0) setDammage 1;
        (_this select 0) setVariable ["on", false, true];
	//disable playSound3D here, when object is damaged
    }
];    
while { _object getVariable ["on", false] } do 
{
    playSound3D [_root + "sound.ogg", _object, false, getPos _object, 100, 1, 30];
    sleep 60;
};

Share this post


Link to post
Share on other sites

I don't think that's possible. For that reason I used say3d with remoteExec in the past and either destroyed the object or moved it to 0,0,0.

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  

×