I tried a couple things. There has got to be an cleaner way to do it.
What its supposed to do:
I want to define about half a dozen relative positions around the player pawn. When the player moves, the positions stay attached to them.
Whenever an enemy pawn spawns it should pick one free position, smoothly move there, and follow the player until destroyed or I tell it to stop.
When a second enemy spawns, it should do the same, but pick another, unoccupied spot.
What it does so far (Blueprint screenshot attached):
I have created an empty blueprint class “enemyCombatPositions”, which I drag and dropped into my scene a couple of times and parented to my Player pawn. Relatively comfortable setup.
Then I call all actors of said class, pick a random one, lerp between the enemy-pawns current position and the new location using a timeline and attach the enemy to the player-pawn so I dont have to run a tick event to update the Position.
However this setup does not prevent multiple enemies choosing the same location and moving into each other.
I have thought about simply destroying the chosen emptyCombatPosition BP and respawning it after my enemy is destroyed. However thast does not seem quite right. Also it would mess up my Lerp, since the player-pawn is constantly on the move. My enemy would try to move to the position where my enemyCombatPosition was when it spawned, but with no guarantee of it still being there.
Any advice would be great. With a cleaner solution I could maybe even make them switch positions randomlyduring combat. Luckily the movment itself is quite simple, since they are flying enemies.
*Thank you in advance!