This section shows you how to make the bot follow objects that are not enemies. Remember, our A.I. system automatically chases after enemies so you don’t have to do anything. But what if you want to track non-enemy objects, like a human player or a taxi cab? What if you want to create a “Companion” bot that always follows the human player around? This shows you how to do it (and it’s quite simple!)
STEP 1: In the Tactics FSM, set the bot’s CurrentCommand to one of these 3 commands (USE ALL CAPS):
- MOVETO : The bot will follow the object and shoot at any enemies along the way.
- MOVETO_CHASE : This will tell the bot to follow your object, BUT, he will stop following as soon as he detects an enemy. He will pursue and engage the enemy instead.
- MOVETO_NOENGAGE : the bot will not shoot or chase enemies along the way.
STEP 2: In the Movement FSM, set the bot’s currentMoveToObj to the GameObject you want to track.
STEP 3: In the Movement FSM, set the bot’s moveTo_TrackObject to TRUE.
STEP 4: In the Movement FSM, set the bot’s MOVETO_Urgent to TRUE or FALSE. If set to TRUE, the bot will always run to the object. If false, the bot will walk.
STEP 5: If you’re doing this at run time, you need to disable the Movement FSM first, then do steps #1, 2, 3, 4 then re-enable the Movement FSM.
That’s it!
By the way, these FSM variables you see here are not available for editing on the side bar. You have to open up the FSM in PlayMaker, then go to “Variables” section to edit them.