Request: Easy-to-Use, User-Friendly Timers

Started by WackyWildCard, Sat 28/01/2006 22:47:17

Previous topic - Next topic

WackyWildCard

AGS Staff and Fellow AGS Forum Members:

I first want to say that this Adventure Game Studio is a radical program, and I am having hours of fun design my Adventure Game on it!

However, I was wondering if the AGS Staff could add a new (no-scripting knowledge necessary) Function regarding Adventure Game Timing. What do I mean?

Y'know in certain adventure games where the hero is underwater and holding his breath, and only has a limited amount of time to reach the surface before he expires? Or perhaps he is confronted with a vampire or a werewolf (e.g. King's Quest II) and the hero has a limited amount of time to act quickly or the monster will kill him!

I want to be able to add those kind of features to my game, so the hero has a limited amount of time to act or (kkkeeech!!!)

Could the next AGS Adventure Game Program have an easy, user-friendly function that allows us to easily set a time limit in certain rooms?

I would really appreciate it!

Thanks!

Wacky Wild Card


Pumaman

It's a difficult task to balance how many features should be available in the interaction editor without having to use scripting; however really, this is a complex enough situation that it's best to do it with scripting.

It would be possible to add an interaction thingy for this, but then where would it end... almost any feature could then be requested as an interaction command. There comes a point where realistically you need to learn a basic amount of scripting in order to make your game.

This particular case is very easy to do with scripting, just do this:

When you want the timer to start, select "Run script" as the inteaction and do:

SetTimer(1, 160);

where 160 is the number of game loops to wait -- divide by 40 to get seconds. So this example would start a 4-second timer.

Then, go to the Room menu, Interactions option, and under "Repeatedly execute" add a new Run Script interaction.

There, simply put:

if (IsTimerExpired(1)) {
  Display("You're dead!");
}


That will display the message after 4 seconds -- obviously you could change the Display() to any other command of your choice.

Try reading the scripting tutorial here for more information:
http://www.adventuregamestudio.co.uk/actutor.htm

edmundito

To do cool things on AGS, you must learn a bit of scripting. Yeah, it can be hard at first if you've never done it before, but once you get it it's not bad.

Here are some functions that should be added to a script module that would make the handling of time a lot easier:

function Minutes(int amount) {
  return GetGameSpeed() * 60 * amount;
}

function Seconds(int amount) {
  return GetGameSpeed() * amount;
}

This way you can do easier timers and waits:

SetTimer(1, Minutes(6) + Seconds(20));

In 6 minutes and 20 seconds the timer expires. or...

Wait(Seconds(5));

Easier than multiplying 40 times 5. and also, what if you change the speed of the game to 60 later on? ;)

As for naming timers, the other way is to have an enum on the script header for timers, like this

enum TIMERS {
   timerWerewolf, timerUnderwater, timerVampire
};


and therefore you can understand what the script does a lot better:

SetTimer(timerUnderwater, Minutes(10));

if(IsTimerExpired(timerUnderwater)) {
   Display("Guybrush is dead.");
}

monkey0506

I had already explained to him how to use the timer functions, he just wanted to be able to do it from the interaction editor.  However it is understandable why some features would be left to scripting.

WackyWildCard

 ;D

I'm so sorry for sounding so demanding regarding the scripts! I didn't realize how, easy, and fun it is to set up Scripts in Adventure Game Studio! It goes to show you, that, in many cases, our worst obsticles are our own attitudes!

Anyways, it worked! My Game does just what I wanted to with the Timer that is set up. In fact, it worked even better; I was able to set up a script that could move the Hero to another room if the  time runs out! I'm so excited about how I am progressing!

Thanks again for all your patient help, and

Happy Adventuring!

Wacky Wild Card


Pumaman

Glad to hear things are working for you.

Have fun :)

SMF spam blocked by CleanTalk