i would approach it differently.
i would grab all the waypoints, then make an ordered list of them, sorted by … order in which they need to be patroled *1.
I’ll do that at the start, or whenever the patroling needs to start or reset. not everytime it needs a new waypoint.
now for traveling between waypoints i’ll do this:
then have an index variable and just loop normally, incrementing that index and getting the waypoint, until finished.
this will also allow you to travel back & forth.
you’ll need to take into account other events where you’ll need to either stop, or recalculate.
*1 notice i don’t say sorted by distance. since that could lead to errors. you’ll probably need to build some sort of pathfinding algorithm to calculate the traveled distance between waypoints.
Depending on how many waypoints you have you can use a very simple algorithm.
pd your code has an issue.
you should do :
FindNearestActor(ControlledPawn->GetActorLocation(), BubblerWaypointsSelf)
(that is using BubblerWaypointsSelf directly as “Actors to check” input to the node)
instead you are creating an array with only ONE element which is always the 0
then on the Remove node, use the output of find nearest actor instead of the Get node.