I want an enemy to wait a while before firing

Started by sgt. Pepper, Thu 25/05/2006 19:47:57

Previous topic - Next topic

sgt. Pepper

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.

Ashen

Use Timers. Look up SetTimer and IsTimerExpired, and do a forum search. for more details.
I know what you're thinking ... Don't think that.

R4L

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! Ã, :)


SMF spam blocked by CleanTalk