Author Topic: Looping AI Function  (Read 546 times)

I am trying to create a function that every 5 seconds or so, a bot will randomly move using
Code: [Select]
function AIPlayer::moverand(%a)
{
%a.schedule(5000,randomMove);
}
it works so the bot moves around in a random direction but only once. is there a way to set it to loop forever, like this firegun function does?
Code: [Select]
function AIPlayer::fireGun(%a)
{
%a.setImageTrigger(0,0);
%a.setImageTrigger(0,1);
%a.schedule(1000,fireGun);
}
(the firegun function loops forever as far as i know)


Note: Fixed.
« Last Edit: May 16, 2009, 12:52:17 PM by Healbadbad »

Well obviously you'd just schedule the function that randomly moves them again...

FireGun will not work on certain weapons such as the Minigun. It'll keep stopping every second and never actually start firing.

In the function, you make another schedule to fire the function.

I am trying to create a function that every 5 seconds or so, a bot will randomly move using
Code: [Select]
function AIPlayer::moverand(%a)
{
%a.schedule(5000,randomMove);
}
You would schedule this in it I think:
Code: [Select]
function AIPlayer::moverand(%a)
{
%a.schedule(time,moverand);
%a.schedule(5000,randomMove);
}
« Last Edit: May 16, 2009, 11:42:52 AM by AGlass0fMilk »

FireGun will not work on certain weapons such as the Minigun. It'll keep stopping every second and never actually start firing.
i know that, but on the gun it DOES fire forever.

In the function, you make another schedule to fire the function.
You would schedule this in it I think:
Code: [Select]
function AIPlayer::moverand(%a)
{
%a.schedule(time,moverand);
%a.schedule(5000,randomMove);
}
this works extremely well, thanks glass.

Locking.