Algorithm design: drawing battlers on the screen

I've been thinking about this problem for some time now but couldn't come up with ANY decent solution.

Here is the problem.

You have your default battle engine using the typical battle scene with a bunch of enemy sprites drawn on the screen at the coordinates specified in troop editor.

Now, I have written several scripts that add new enemies into the battle dynamically.

They are instantiated with their x and y coords, and pushed into the troop list.

However, I've been using a very simple formula for deciding where to draw the enemy, and it just makes it look ugly and unrealistic. They might overlap each other, appear in places that don't really make sense (a slime in the sky, or in lava)

Can someone come up with a good way to introduce new sprites onto the screen while looking aesthetically acceptable?
Maybe you can create an "ghots troop" and setup the new enemies to use this new ghost troop coordinate.

Also you can check if the sprite rects collides, if they collide, pass to the next sprite.

Or maybe use one of the current troop as reference and move the sprite left, right, down or up based on the settings.
That would work, since data_troops is globally accessible.

Though, that would require set-up on the user's part, but it's a good solution for accurately introducing extra enemies without relying on luck to get it right.

How about some way to write a method position_sprite that would arbitrarily pick a decently open spot on the screen?
How about some way to write a method position_sprite that would arbitrarily pick a decently open spot on the screen?
This would work too, you can use the current enemies as reference and check if their sides are free.

Original thread: https://forums.rpgmakerweb.com/threads/algorithm-design-drawing-battlers-on-the-screen.3084/