actors keeping distance from each other

Hi.
I've just started out with GS and apart from the nice and easy ways to do some things, a few others just seem beyound me. This Problem i've tried approaching from every direction that occured to me:
I'm prototyping an old school side-scroll shooter with enemies all around.
The setting:
Enemy type 1 is spawned 15 times in a Stage. They wait until the player char enters a magnitude below a globally set distance, "hear" a shot or are triggered otherwise, which is when they move toward the player and start firing at the player.
The Problem: If more than one moves towards the player, they overlap and can therefore be shot with one single blast - also they can't e.g. find if there is another enemy actor already there and make them "kneel" in order to fire above that one's head (that last part is more for aesthetics than any real use but hey...)
I'd need them to stop their movement as soon as they come within a certain range of another actor of the same (or other) type.
I've tried collide - didn't work out as one actor pushes the other away and into the player
I've tried spawning a "spaceholder" with collide attributes - can't get that one to move alongside (or follow) the actor that spawned it.
Since there is a number of actors of the same type, I havent been able to use global attributes as that would apply to all enemy actors alike instead of just the one I'd like to stop.
Any thoughts on how to achieve this?
Thx a lot for any advice.
I've just started out with GS and apart from the nice and easy ways to do some things, a few others just seem beyound me. This Problem i've tried approaching from every direction that occured to me:
I'm prototyping an old school side-scroll shooter with enemies all around.
The setting:
Enemy type 1 is spawned 15 times in a Stage. They wait until the player char enters a magnitude below a globally set distance, "hear" a shot or are triggered otherwise, which is when they move toward the player and start firing at the player.
The Problem: If more than one moves towards the player, they overlap and can therefore be shot with one single blast - also they can't e.g. find if there is another enemy actor already there and make them "kneel" in order to fire above that one's head (that last part is more for aesthetics than any real use but hey...)
I'd need them to stop their movement as soon as they come within a certain range of another actor of the same (or other) type.
I've tried collide - didn't work out as one actor pushes the other away and into the player
I've tried spawning a "spaceholder" with collide attributes - can't get that one to move alongside (or follow) the actor that spawned it.
Since there is a number of actors of the same type, I havent been able to use global attributes as that would apply to all enemy actors alike instead of just the one I'd like to stop.
Any thoughts on how to achieve this?
Thx a lot for any advice.
Comments
Thanx for the Input, I've tried doing exactly that but can't get the invisible cube to stay with the actor that spawned it.
I spawn the "spaceholder" (an invisible cube) inside the actor it's supposed to follow and tried all sorts of expressions in the "position" part of the spawn actor bahavior... it spawns but doesnt move.
All in all i am having troubles figuring out how to constrain the positions (can't find it in the behaviors of GS) without a global attribute which in turn wouldnt work for a number of "enemies" above 1...