Hello Guys,
Could you tell me how do I make a Hidden Countdown Timer to A Game in AGS? I would like to know. Thank you! :)
I'm not sure what you mean by hidden timer, but if you look up SetTimer in the manual I think you will find what you need.
Yeah, all timers are "hidden" unless you specifically script something to happen while the timer's running.
Assuming you just want to set a timer and have it count down to a game event, then
SetTimer(1, 80);
will set Timer No. 1 to 80 game loops, i.e. 2 seconds. You want to set this at the point in the script where you want the timer to start counting down.
Then, in RepEx, you control what happens when the timer reaches 0. This is so that the game is checking every loop to see if there's any time left.
if (IsTimerExpired(1)) //This continually checks whether or not Timer No. 1 has expired and returns the below if it has.
{
//Whatever you want to happen
}
Thanks but...
How do I know if I set by Let's just say 7 Seconds... What should be it's int timeout integer of it?
Use this:
SetTimer(1, GetGameSpeed() * 7);
That way the timer will expire after 7 seconds regardless of the frames per second setting (which is 40 by default, so you pass 280 or 40 * 7).