Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: on Fri 16/01/2004 21:40:57

Title: How do I make it so a room changes after certain amount of time?
Post by: on Fri 16/01/2004 21:40:57
Hi -

How do you make it so "room1" shows for a specific number of seconds, then when the time has ellapsed, the game automatically switches to "room2"?
Title: Re:How do I make it so a room changes after certain amount of time?
Post by: Scorpiorus on Fri 16/01/2004 23:39:18
Try the next code:

room1 script:

at the top of room script
int time_seconds = 100;

player enters screen (after fade-in):

SetTimer(1, time_seconds*GetGameSpeed());


room's repeatedly execute:

if (IsTimerExpired(1)) NewRoom(2);

Title: Re:How do I make it so a room changes after certain amount of time?
Post by: on Sat 17/01/2004 06:13:45
Thank you for the help. Where exactly in the room's script should the "Set_Timer" and "if" code go?

I cannot exactly figure out where all of the lines should be placed.
Title: Re:How do I make it so a room changes after certain amount of time?
Post by: LordHart on Sat 17/01/2004 06:48:00
The set timer and if code shouldn't be put into the room script. Next to the room script button, which is the button with these { } is the interaction button. Press that.

Once the little interaction window pops up, look for player enters screen (after fade-in) and then double click on it to add a action, and choose from the dropdown box "Run Script", and then press edit script. Put the set-timer code in here.

Follow the same for the IF code, except put it into the repeatedly execute section.