Stop or Cancel the AI Bot on a Path
by Matt Cuda · in Technical Issues · 02/28/2008 (8:39 am) · 2 replies
I have a guard (bot) on a path. When she is approached she turns and starts walking toward the enemy.
All of that works, but what is happening is she is eventually pulled backward down the path while she is fighting. I need a way to cancel the path following by the AI bot.
Does anyone know how to do this?
All of that works, but what is happening is she is eventually pulled backward down the path while she is fighting. I need a way to cancel the path following by the AI bot.
Does anyone know how to do this?
About the author
#2
Assuming you are using the path following scripts that come starter.fps, the path following works in this way. The bot is given a move to (setMoveDestination(...)) position which is a node on a path. When it arrives there, a script call back is initiated (onReachDestination(...)) which figures out the position of the next node on the path, that it is following, and sets the bot to move to that new position.
What is probably happening is you are tell your bot to move to attack the enemy. However when it arrives at the enemy position the callback (onReachDestination(...)) is triggered and the path following logic automatically tells it to move to the next node on the path.
What you want to do is check the current state of your bot within that callback and if it is in a attack state or any other state then path following, do not instruct it to move on to the next node.
Gabriel
02/28/2008 (11:21 am)
I probably should explain a bit more. Assuming you are using the path following scripts that come starter.fps, the path following works in this way. The bot is given a move to (setMoveDestination(...)) position which is a node on a path. When it arrives there, a script call back is initiated (onReachDestination(...)) which figures out the position of the next node on the path, that it is following, and sets the bot to move to that new position.
What is probably happening is you are tell your bot to move to attack the enemy. However when it arrives at the enemy position the callback (onReachDestination(...)) is triggered and the path following logic automatically tells it to move to the next node on the path.
What you want to do is check the current state of your bot within that callback and if it is in a attack state or any other state then path following, do not instruct it to move on to the next node.
Gabriel
Torque Owner Gabriel Notman
Assuming %bot is the script handle of your bot.
It works for Kork in the fps starter kit.
Gabriel