I've been trying to use a timer for a sequence in my game and I cannot figure it out.Ã, I read through the manual and the info on timers was not helpful.
Here's the situtation:
I have two characters in a room.Ã, (The playable character and a NPC).Ã, The playable character is "STAN", the npc is "SEC."
I wanted to set it up, so that ten seconds after stan enters the room, sec will turn and face him and say something.
So I started with this:
// script for Room: Player enters room (after fadein)
SetTimer (1, 400);
To begin Timer 1, to go for ten seconds (400 game loops).
Now, I have to use this:
if (IsTimerExpired(1) == 1) {
Character[SEC].FaceCharacter(STAN, eBlock);
Wait (20);
DisplayMessage (25);
This will make SEC face STAN, wait 20, then display message 25 after ten seconds have elapsed, I think....The above code may be wrong, so if anyone knows how I could correct it, that would be awesome!)
Another problem is, Where should I use the event for when the time expires (After Fade-in, Repeatedly execute, etc.)?
Any help would be awesome!Ã, Thanx everyone!!Ã, Ã, ;D
The codes seem to be working apart from possibly some small glitches (for example the character object names and the missing } in the second part, but I'll expect that's just a typo here), so why don't you try it first?
They can be just fine in repeatedly_execute(), since a timer will expire just once, so it guarantee the code would be execute once when the time's up.
And the (possibly) fixed code:
if (IsTimerExpired(1) == 1) {
Ã, cSec.FaceCharacter(cStan, eBlock);
Ã, Wait (20);
Ã, DisplayMessage (25);
}
(The first character[SEC] should actually be okay, just that cSec is easier to read.)
Thanks gilbot!Ã, it works now.
(I did forget the last "}".)
I made a simple mistakeÃ, :P , but thanks for pointing it out for me!Ã, Ã, ;D