How can I set Ai to attack a player/building which clicked and from range?

I’m using this RTS template

The dev has plans to add Ai however I would like to try out and learn to implement some Ai myself. The template is a point and click RTS, the player pawn is already setup to follow the location of each click (+run to buildings & objects clicked on).

At the moment I intend to create Ai that will spawn randomly on the map to attack both the players units and buildings, I would just like advice for setting up the attack once enemy is within range.

I think I could potentially copy the existing BP to make the Ai move towards a player/building in sight so I can figure that out myself. The question is how do I make the Ai stop at an “attack range/radius” to start firing from a safe distance, basically like a car following a car in front while maintaining a safe distance. Here’s a quick illustration of the BP I’m hoping for.

Thanks in advance for any suggestions.