If you don't want to use a timer, you can achieve the same with a simple boolean variable:
Code: ags
Replace the '3's with your frame number for the sound, obviously.
I didn't check this, it's all from the top of my head. I'm pretty sure the method works, there might be typos in there however. You'll also need to look up the parameters for the PlaySound command or use the new functionality to play your sound in the new version of AGS, I'm sure you already know how to do this.
EDIT: BTW, depending on your game, it might be way better to use an object with an animated view for the drip (performance wise and it'll make adding the sound trivial, just do it via the frame-sound functionality in the view editor).
bool sound_played;
function repeatedly_execute ( )
{
if ( GetBackgroundFrame ( ) == 3 )
{
if ( !sound_played )
// if the sound hasn't played yet
{
// play your drip sound
PlaySound ( ... );
sound_played = true;
}
}
else if ( GetBackgroundFrame ( ) == 3 - 1 )
// the frame right before the sound frame
{
sound_played = false;
}
}
Replace the '3's with your frame number for the sound, obviously.
I didn't check this, it's all from the top of my head. I'm pretty sure the method works, there might be typos in there however. You'll also need to look up the parameters for the PlaySound command or use the new functionality to play your sound in the new version of AGS, I'm sure you already know how to do this.
EDIT: BTW, depending on your game, it might be way better to use an object with an animated view for the drip (performance wise and it'll make adding the sound trivial, just do it via the frame-sound functionality in the view editor).