How do I get AI to move between two patrol points?

Hi! I’ve been following along the tutorial in the “Blueprints Visual Scripting for Unreal Engine” book from Brenden Sewell, which has you build a basic First Person Shooter prototype. So far I’ve been successful at figuring everything out as it comes but I’m currently stuck at getting the AI to move properly, and I haven’t been able to figure out what needs to be changed in the logic for my blueprints and/or behavior tree.

Right now the AI moves to the first patrol point and then just stays there without moving to the 2nd. Thanks in advance for any help at getting this to work!

Hi grycen, i had the same problem and i came up to this:

In my scene i got my Patrol Waypoints (I use actors with a flag stand mesh to see them, but you can use a default Target Point sa well of course, the important is that your waypoint don’t collide with the character).

In my custom AI controller i save an array of vectors to store the waypoints position, and than made a custom Behavior Tree, with a custom BT Task to select next waypoint as destination (the destination is saved as a vector value in my BlackBoard)

To select the next waypoint the way is:

  • check if the vector array is not empty (just to be sure, and call it’s lenght “len”)
  • default “next waypoint index” (let’s call it “x”) is -1
  • update index as: x = (x+1)%len (first execution set x=0, the first waypoint)
  • set blackboard vector value as vactor[x]

Turn and wait nodes are optional, but helps to make character look acting better.