Are time-triggered music and sound effects possible?

Started by chapter11studios, Sat 19/04/2003 15:27:16

Previous topic - Next topic

chapter11studios

I'd like to have time-triggered music and sound effects events in my game, but in looking over the documentation I can't seem to get confirmation that it's possible.

Example: I have a scene where the hero is walking along a rocky path with vultures perched in nests overhead. I'd like to do a time-triggered thing where every 15-20 seconds or so, a vulture lets out a screech.

Is this possible in AGS? It seems like it ought to be, but I wanted to make sure before I started planning on different sound effect schemes.

Thanks!
Josh

scotch

yeah, all that would be pretty basic.. ags can cover almost anything you would have in an adventure game by now I think.

as an example to play a sound every 80 game cycles you would do this:

In your room script,
In the 'Player Enters Screen' interaction:

SetTimer (1, 80);

Then in the 'Repeatedly Exectute' interaction:

if (IsTimerExpired (1)){
 PlaySound(1);
 SetTimer(1,80);}

That's all there would be to it.

AJA

15 seconds = 15*40 (default) game cycles = 600 game cycles.

this goes to the room scripts top:
int timer = 0;

And this to the repeatedly execute function of that room:

while (timer <= 600){  // While the timer is less or equal to 600
    timer++;                  // Adds 1 to the timer
}
if (timer >= 600){         // If the timer is more or equal to 600
    PlaySound(X);         // Plays sound X
    timer = 0;                // Resets the timer
}


This should work...


-EDIT-

*Sigh*
Maybe I should start using those timer functions... they seem so much easier... Tho' I haven't needed timers yet in my projects... :P

Ishmael

A reveal: Sledge Hammer and the BlueMoon uses timer in the intro to count when its the right time to get the hole in the glass...
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

Barcik

You can also set up a timer using a counting variable and repeatedly_execute (much the same like usign a proper timer).
Currently Working On: Monkey Island 1.5

SMF spam blocked by CleanTalk