Please help, Its melting my BRAIN!!!

Hi guys, can you help me, I am spawning some actors in my game, but I don't want them to spawn together, they are all instances of the same actor (pit) and I want them to not spawn anywhere in a certain radius around the actor, please help.
Comments
Make the actor that is spawning Pit follow the actor that you don't want Pit to spawn within a radius of (assuming that actor moves, otherwise just place it on top).
Then when that actor is spawning Pit, set the spawning position as 'relative to actor' and set it up so they spawn within a random distance, the minimum value being the radius you want to keep clear around your other actor, and the maximum distance however far out you want them to go. So if the min random value is 150, you should always get at least 150 pixels between Pit and the actor in all directions.
Like I said, I've not tested it, but in my head that's how I'd try, it might need some fine tuning and more precise maths, but it should be a start.
Liamo
A rule on the Spawn item.
If Collide With (The Same Actor)
Then Destroy.
then you WONTt Have them spawn on the same spot.
Cheers.
Liamo
create 2 real attributes
ranX
ranY
on pit;
create self boolean attribute "do_it"
when "do_it" is true;
change attribute game.ranX to "random(100,300)"
change attribute game.ranY to "random(100,300)"
spawn "pit" to coordinates
ranX
ranY
Timer, after 0.05 seconds change self.attribute "do_it" to false
Now;
on pit, if colliding with "pit" change "do_it" to true.
-*-*-*-
And start the actor with "true" is checked. And let me know how this does. I have no idea. eheh
Pit spawns 'spawnChecker' and 'spawnChecker' has the following behavior(s):
Timer (every 0 seconds)
--When actor overlaps or collides with actor of type pit
----Change Attribute: self.Position.X To: random (0,480)
----Change Attribute: self.Position.Y To: random (0,360)
--Otherwise
----Spawn Actor pit, in front of actor, 0,0,0 relative to actor
----Destroy this actor
I just tested it out and it works. It will randomly find place for pit until there is absolutely no place left for one to be placed. (However it does not stop, it keeps checking for a place forever if there is no space left for another one.)
Hope this helps!