A little help with last known position

After seeing the player, I want the agent to save the position so it can check the last known place after losing sight of the player. I'm using A * for navigation so I can't use the built in one from Deathmatch AI Kit.

My setup isn't working after tinkering for a couple hours. I have a vactor3 variable storing the target position, with the target being the player. Then in the 'Get Position' action I'm reading this variable to the agent can seek that location. Not working though
howToFindLastPosition.png
 
What part isn't working? Set Position will set the position immediately after Can See Object is run, so if the player moves while the agent is pursing then the position will be out of date. Instead you should add a parallel task so both set position and pursue is called repeatedly.
 
The issue I was having was once the AI chased me and I was out of sight, it still continued to pursue me after the ‘can see’ returned failure, rather than checking the last known position right before I was gone out of sight at the last tick. I’ll try the parallel node and report the outcome.
 
Didn't work. Long after I'm out of sight, the agent continues to pursue me. Running around objects and hiding to confuse agent is futile. Once the 'can see' returns success, the branch does not return failure when I'm out of sight. When I outrun him and go to the opposite side of map, eventually he catches up to attack me.


enemyStillchasing.png
 
Last edited:
Set Position is still only running once. You will want it to run for as long as the Pursue task is active, which you can do by adding a Repeater that repeats forever. Then instead of Parallel you'll want to use Parallel Selector so it ends when the Pursue task is done.

With that said, another way would be to get the position after the Pursue task is done instead of before. This will then be the most up to date position before moving on to the next branch.
 
Back
Top