Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: sgt. Pepper on Thu 25/05/2006 19:47:57

Title: I want an enemy to wait a while before firing
Post by: sgt. Pepper on Thu 25/05/2006 19:47:57
I have a problem. I want an enemy to wait for 4 seconds and then kill the player, and i want the player to be able to do stuff while the enemy is waiting. I've got all the stuff after the wait done (the death of the player), all i need is a command that makes the enemy wait for 4 seconds and the player should be able to do whatever while the enemy waits.
Title: Re: I want an enemy to wait a while before firing
Post by: Ashen on Thu 25/05/2006 21:18:34
Use Timers. Look up SetTimer and IsTimerExpired, and do a forum search. for more details.
Title: Re: I want an enemy to wait a while before firing
Post by: R4L on Thu 25/05/2006 21:19:43
Set Timer (int timer_id, int timeout)

Its in the manual but I looked it up for you to save you some time. You could call this:

SetTimer(1,400);

That's about 10 seconds. Then you could call this:

if (IsTimerExpired(int timer_id) == 1){ //where timer id is the SetTimer id.
Do whatever; //This is your emeny shoot script.
}

Not too hard, just look it up next time, and glad to help! Ã, :)
Title: Re: I want an enemy to wait a while before firing
Post by: sgt. Pepper on Thu 25/05/2006 21:35:17
Thanks a lot.  :)