How can have a sound play every few secs ?
I would like it to do it in every room .
in rerepetabldy execute, have a loop that runs every few seconds (use a time_Wait or whatever AGS calls them) that plays a sound.
Simple really!
make a variable in the global script called time (time;)
in the global script:
function repeatedly_execute_always(){
time++;
if(time==x){//replace x with # of seconds x 40
time=0;
PlaySound(x);//replace x with sound #
}
}
if you are not using the lasest version of ags put the script in normal repeatedly execute, it won't run during blocking events.
Would it look like this for the first variable int time; and where would I put it in the script ?
Never mind I got it .. thank you for the help .. ;D that worked great .
How could I add more sounds to that code so I could have more play at diff times ?
Just copy it and chane the time and x sound ?
For multiple sounds that play at different times, do something like this:
function repeatedly_execute_always(){
time++;
if(time==x){
PlaySound(x);
}
else if(time==x){
PlaySound(x);
}
else if(time==x){
time=0;
PlaySound(x);
}
}
Oh man that kicks butt. thank you so much for the help .