This looks so awful, when people ask something simple as this without even reading the fucking manual by themselves (or doing tutorials). And I hate to realize, that once upon a time, I was doing this myself.. There is nothing have to deal with master volume! (as it is master, it will decrease the volume of the whole game!), all you need to use is "ent_playsound" (and probably "ent_playloop"), read the manual for such simple stuff please, if you want to learn anything:
ent_playsound ( ENTITY*, SOUND*, var volume): handleAs if this isn't what you want (for example you need rain sound, which will fade in slowly, and then play with constant volume), you need to do something like this:
var rain_handle_snd = 0; // pointer to the rain sound
var rain_volume_snd = 0; // volume of the rain sound
SOUND* rain_wav = "rain.wav"; // rain sound file itself
function handle_rain(){
// play rain sound in a loop:
rain_handle_snd = snd_loop(rain_wav, 0, 0);
// endless while loop:
while(1){
// if we need to increase it:
if(rain_volume_snd < 50){
// then increase it:
rain_volume_snd += 2 * time_step;
}
// tune the volume of the rain:
snd_tune(rain_handle_snd, rain_volume_snd, 0, 0);
// wait one frame:
wait(1);
}
}