Force an enemy with a ranged weapon to keep their distance from the player.

I just did a experiment and found that the cone and circle don’t generate locations behind walls.

so I used a donut instead.

see if it’s close to what you need.

what it does is generate a circle of points(use donut) around the player and choose the closest point to the enemy AI.
here’s how it set up.