Download

Getting Caught AI functions

So I’m developing my first game in Unreals VR system. I’m try to make it where the Enemy AI is patrolling in his area and if the player stands up from their chair they have the probability of getting caught and they’ll lose. I’ve already made the enemy AI successfully patrol the area using Path Nodes and now I need to add in the getting caught functions into the bahviour tree. He just needs to see the player standing up and then they’ll lose the game but no one i see is giving answers that I can work with.

Attach a boolean called “IsStanding” to the player, and set to true only when standing up. In the NPC AI, on tick, get perceived actors, loop through them and see if they are the player (e.g. Cast to Third Person, or whatever you are using), and then check the value of the boolean. If it is true, trigger the game loss event. :slight_smile: