Jump to content
Sign in to follow this  
forzajuve

Custom sound volume script

Recommended Posts

I am making an in car radio for a vehicle, where the player can switch the radio on and off with the action menu. The idea I am using is to have to the sound playing from the start of the mission (radio track I made is 15 mins long and car is available at start of mission), except with the volume at 0. Then when the player uses the action menu to turn on the radio it will turn the volume of the sound up. Vice versa for radio off. However I'm not sure how to adjust the volume of the custom sound. Not sure what command or I've missed something... I have the scripts working fine to loop and turn the radio off and on, it's just the volume I don't know what to do. 

 

car init

this say "music";
thing1 = car addAction ["Altis Rock Radio","radio1.sqf",[1],0,false,true,""," driver  _target == _this"];

radio1.sqf

car removeAction thing1;
thing2 = car addAction ["Radio Off","radio2.sqf",[1],0,false,true,""," driver  _target == _this"];

radio2.sqf

car removeAction thing2;
thing1 = car addAction ["Altis Rock Radio","radio1.sqf",[1],0,false,true,""," driver  _target == _this"];

Unless someone has a better way to do it, without restarting the radio each time if the player turns it off/on or pauses it instead with off/on. 

Share this post


Link to post
Share on other sites

As far as I know there's no way currently to stop a sound and resume play sometime else.

Also no way to change the volume while a sound is being played.

 

Cheers

Share this post


Link to post
Share on other sites

Any other work arounds maybe? 

 

edit: come to think of it maybe setting it as music and using fademusic....

 

edit2: did the best work around I could think of for now. I used playmusic instead, and with fademusic it's working. playmusic seems to be  the only one that works with fademusic even if you put sound under cfgmusic in description. It's not as good as a 3d sound but it will do. I also added a trigger so if player leaves the vehicle it will fade the music to 0 in case they left it on. 

cond: ({_x in car} count [a1]) == 0

act: 0.5 fadeMusic 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  

×