Basically, I am creating a horror game and my enemy has a chase ai with pawn sensing and pawn perception. I have been following tutorials and don’t know why this bug is occurring. When my character is in the sight radius of the enemy’s pawn sensing it will not react and start to chase him and then sometimes it will. I have been trying to figure the issue out for around 4 hours and cannot find a solution to the problem. Another issue as well is how when I go out of the enemy’s pawn sensing radius distance it still chases me.
It keeps chasing you because you didn’t set the Actor target to Null when the target is not in sight, I would assume that’s the issue, for the first problem I would just print a message when a target is found to see if that’s the issue or your AI tree.
The first issue sounds like you have a task that doesn’t have a “Finish Execute” node and stays stuck on it. Debug its behaviour tree, see where it’s stuck.
Also, if you have a “TargetActor” that the AI is supposed to chase, make sure it’s of type “Actor”: https://youtu.be/nshHCycft4A?t=1837 (hear that “very important note here”? Yeah…).
The second issue sounds like you’re not making the AI “forget” he saw you once you exit its line of sight (after a few seconds, preferably). There’s a “Clear Blackboard Value” node with which you can clear the “TargetActor” mentioned above.
Hi I have fixed the second problem I was having but I still can’t find a solution to the first problem