AI Stalking (Following) Player Character

I followed the official Behavior Trees Documentation to create an AI which roams around randomly, can see the player and if so starts running after the Player.

What would be a efficient way to instead of having the AI run up to the Player, have the AI stalk the Player (Following but keeping it’s Distance) for a while before actually running up to the Player? Preferably, changing it’s stance to crouching while stalking.

Thanks in advance!

Hi,

Here are two ways I would try implementing this:

  1. Setting the acceptance distance on the move to node to the distance you want the AI to stay at. The downside here is that they won’t run away if the player approaches and there could be some other downsides like the AI not coming within line of sight

  2. Using EQS. With EQS you can have points that have line of sight and proper distance have a higher score

Thank you for your response!

Wondering how i didn’t see the acceptance distance option myself…
That one doesn’t feel too great though.

I’ll look into EQS though, seems like a interesting system!

Hey there @SiariGames! Welcome to the community! I second DLPS on using the EQS and deciding to use places outside of vision would do the job. This is UE official training, but the Query system bits are near the end.

This looks great!
I’ll take a closer look at EQS over the weekend.

Thanks again to the both of you.