Best way to position event a certain distance from player

I am trying to make a little script in Ace that will position an event a certain number of tiles away from the player, in a random direction, such that it could be given a "move toward player" move route that would eventually put it on the player's tile (or right next to).


So it's not really a pathfinding script - if there's an obstacle or passage issue that would force the event to move away from the player to get around it, that would be an invalid starting point. 


The two approaches I can come up with are to start with all tiles that are X distance away, and simulate a 'move toward player' repeated route and see which ones don't get blocked, or to start at the player's position and spread out in all directions until I end up X tiles away.  I think both options have drawbacks.  Looking for some suggestions on how to best handle this.
Oh, so it spawns events and the player attracts them much like a magnet?


I would consider checking it from the nearest tile to the player to the furthrest tile. Once the checker finds an obstacle, it returns to the last tile checked and spawns the event.


DiM47yc.png



this would ensue a clean path between the spawned event and the player -- with the drawback that it could spawn the event far too close to the player, which could or could not be a bad thing.


If it is a bad thing, then a simple possible fix would be to not allow the script to spawn an event if it's too close!


Hope it helps.
It's close to what you describe.  Just one event that already exists on the map but is not visible until the player uses an item.  At that time, the event will jump to a location X tiles away from the player, become visible, and start moving toward the player using the Move Toward Player event command.  It doesn't have to be directly above or to the side of the player - could be a zig-zag path that it follows - as long as the Move Toward Player can get it there (which means it's only allowed to move in two directions).


Edit: I think I know what I need to do ... it's amazing how much simpler things become when you use a diagram to explain the possibilities.


Thanks for your input 🙂

Original thread: https://forums.rpgmakerweb.com/threads/best-way-to-position-event-a-certain-distance-from-player.61203/