Sound alternation

Does anyone know how to Alternate sounds/audios, like say for instance footsteps with 2 different audios (left foot audio play and then right foot audio play and etc.) Is there a specific variable I can use for that, just like how choose is a built in variable?
 

obscene

Member
You can make your own script for this. The idea would be to increment a variable every time you call the script, then use the modulo function to choose the correct one.

var snd=scr_alternate(snd_footstep_left,snd_foostep_right);
audio_play_sound(snd,1,0);

Script....
footstep_count+=1;
return argument[footstep_count mod argument_count-1];

I think that should work.
 
You can make your own script for this. The idea would be to increment a variable every time you call the script, then use the modulo function to choose the correct one.

var snd=scr_alternate(snd_footstep_left,snd_foostep_right);
audio_play_sound(snd,1,0);

Script....
footstep_count+=1;
return argument[footstep_count mod argument_count-1];

I think that should work.
will this code work with anything else, because I'm asking for Pac-Man related stuff? the footstep thing was just an example.
 

Yal

šŸ§ *penguin noises*
GMC Elder
Randomly alter its playback speed a bit, it will sound like it's pitched up and down a bit (so it's more natural variations, instead of always sounding the same):
Code:
///sfx_pitchy(sound)
var n = audio_play_sound(argument0,10,false);
audio_sound_pitch(n,1 + random_range(-0.1,0.1))
return n;
 
Top