stopping all sounds

hi every one
I want to make an emp bomb in my game,witch its effect is to turn off any sound in the game for 6 seconds

can some one tell me how to turn volume off or turn all volume down to zero for 6 secound while the game is running?

thank you all for your help.
 
Volume settings are available as system variables. Values range from 0-255, but for backward compatability the engine caps all playback at 64 no matter what you set with menus or script.

Getting volumes. You'll want to save those values somewhere so you can restore the volume later:

C:
int sound_volume = openborvariant("effectvol");
int music_volume = openborvariant("musicvol");

Setting volumes:

C:
changeopenborvariant("effectvol", <new value>);
changeopenborvariant("musicvol", <new value>);
 
i used these command i game crashed with this error
if (frame == 14 )
{
changeopenborvariant("effectvol", 0);
changeopenborvariant("musicvol", 0);
}
There's an exception while executing script 'empshutdown' data/chars/misc/empbomb/empshutdown.txt
 

Sorry, when I looked into the source code I noticed that those properties are read only after all. Mea culpa.

You can still do this, but you'll need to stop all channels and also use the pause music command. It's still not all that hard, but I don't have time to write the code for you right now. If you want to try it yourself, look up sound channels and pause music.

DC
 
ty for you answer
can you please tell me the codes that i need for stopping all channels (not pause them) and empty them and stop them to getting used for other future sounds in 6 sec gap that i want to silence the game
 
Last edited:
Back
Top Bottom