Avoiding overlap with randomly generated events?

Basically my question would be is there a simple way, like a script call or some such, to check randomly generated x,y coordinates and determine if an event is already present at them before placing a new event?  

I am looking to place several events randomly as pick-ups, but I need to avoid having any of them appear at the same coords as any of the others. I have tried several variations of loops, switches, and using variables for each generated event's x and y (then checking them against the randomly generated numbers) and none of my attempts have really worked, plus they are terribly complex and cumbersome. Needless to say, some form of event detection would be a much more elegant solution.

As always, if there is a solution any and all help will be deeply appreciated.

Cheers,

D.
There are several existing scripts that randomly place events based on region codes. They are in the master script list, one of them is from Tsukihime if I remember correctly.


You might try one of them - either if it could be used or to learn how they determine the coordinates.
Thanks!  (Unfortunately, I'm using regions for a different aspect of the game already).

I think that I may have stumbled across a solution to make this do what I want - using a loop to generate random x and y, get location info/event ID, and then breaking the loop and placing the event if the Event ID is 0. Hopefully that will do the trick.

Original thread: https://forums.rpgmakerweb.com/threads/avoiding-overlap-with-randomly-generated-events.16636/