Making an enemy patrol waypoints on a procedurally generated map

One idea that might get you going in the right direction, is on spawn, have the AI actor get all the waypoint actors, test then for distance then sorting them into an array using a for each loop