Game Development Community

Where to set AIPlayer animation/switch fr walk to run animation

by ST Electronics (#0001) · in Technical Issues · 08/31/2006 (1:32 am) · 5 replies

Hi all,

I havnt been able to find any resources on setting AIPlayer's animation, particularly from walk to run animation. Basically, i want to switch my aiplayer to walk until there is an explosion, then they start to run.

This is the only post i managed to find but no solution too:

http://www.garagegames.com/mg/forums/result.thread.php?qt=22785

Appreciate anyone's help..

#1
09/06/2006 (10:29 pm)
Hi all,

Any help would be really appreciated.
#2
09/07/2006 (3:02 pm)
Here's an idea for ya.

Loop around this using schedule()

When the bomb goes off 1. stop playing the animation 2. raise the speed

%this.PlayCelAnimation("walk");
#3
09/14/2006 (3:46 pm)
I don't know how to change the run anim to a walk (I'd would also like to know this).

Using schedule can slow down your system, so if you have particle FX this is not a good thing, after you figure out how to change the animations, you could do something like the following:

In your explosion code after your bomb explodes, check your AI's distance with vectorDist(ai.getPosition(), explosion.getPosition()).

If the AI is less then a safe distance change the AI's speed like this, AIPlayer.maxForwardSpeed = 8 (or whatever you want, 3 or 4 is a good walking speed).

Change you AI's animations to run and make him run to a safe distance whatever way you see best.

And you now got some fairly scared AIs.
#4
09/14/2006 (3:54 pm)
Couldnt one just swap datablocks for this? when an AI is about to run, switch to a run datablock which is exactly the same as the default AI datablock just with a different maxforwardspeed and forward animation.
#5
05/03/2007 (9:09 pm)
Isn't there an ai.walk() function? ill try it tomorrow