How can I get my AI to walk around character?

I’ve got my simple AI skeleton enemy hear. The nav mesh is set up and I’ve got him to so a simple move to actor once a certain trigger is set.
I have another trigger for when I get close. An animation makes him get down and walk a little slower.
I’d like him to do a different movement while that trigger is on.

I wanted to get the enemy kinda of circle around the player like in dark souls…
is there a certain node or function that would make him not come any closer and kinda walk round or away from me??

Maybe try a MoveTo command that loops? (but make sure you don’t put it in a whileloop, nothing with delays can go into that)

You may want to set a vector variable that makse the enemy move to where that is, which’ll be right in front of your character, then once the enemy’s there change it to the left of the player, then the back, then the right, and so on.
It won’t be a perfect circle but it’ll be close.

Could u explain a little further possibly?
A pic would be awesome if possible but…
Like I understand. Set the variable to my location plus so much on the X or Y…vet wouldn’t I need 2 variables then?
And how exactly would u go about about the it go left and right? Or to switch? More variables? Or just change the variable and have hi. Always moving towards the same one? But like…how do I know which axis to move on…X or y…considering the player is in first person view I move along with both axises regularly.

Thank you for trying to help me. :slight_smile:

I actually need help on this, anything new happen?

watch this tutorial

Here is an example that I thought up. In your AI character, add four variables. All vectors. Current_player_front, current_player_right, ect. Then, when the proximity is triggered, take the out overlapped actor and cast it to your player character class. In your player character, you have arrow components, one in front, one in back, and one on each side. Set the according vectors into your four variables. Then you can set up a move to sequence where the AI moves to the first point, then the next, then next, then next to make a sort of box cycle around the player. I haven’t tried this, but I will later today.

Because ‘character’ blueprints tend to hang on one another - particularly while following the same target (think zombies swarming players) - it is often better Not to use MoveTo → a target actor.

Try – Get Actor Location of the target actor

Then Get Reachable Point in a radius around that actor (varying by the size of your characters)

And moveto that point rather than the actual character.

.

It is also a good idea if there is the potential for more than a small number of AIs to be moving in the same space to include an “Unstuck” timer.

  • Set a boolean while the AI should be moving.
  • Timer checks every ~ .5 seconds for that bool, and if it is set - gets the velocity of the actor and increments a counter if it should be moving but is not.
  • (clearing the counter if it is moving of course)

Then any time the counter goes beyond a number reasonable for the given game - set a random point some distance away from the navigation goal and move there.
It helps with crowd clogging and the occasional odd bit of collision clutter.

2 Likes