Encounter System Help

Hi there,

I'm looking to create the following described encounter system (on-map encounters) with as much eventing as possible. A custom plugin may be inevitably required but I wanted to see if anyone could see a way of doing this with the RTP.

I need enemy events to "spawn" outside of the player's field of view (I am using the standard 800x600 resolution) at timed intervals, and then approach the player. The battle initiation and the like I can handle myself after I get this hurdle out the way.

The main problem is I need these enemies to spawn and follow normal tiles without using "through". So, even if I could think up a way of getting the events to spawn a certain amount of tiles away from the player, how would I make sure they could spawn on normal "walkable" tiles and not in walls, on the sides of cliffs, etc.

If this is going to be done, I imagine it is with using variables and regions. Has anyone got any thoughts?
You can use regions to specify the tiles where the enemies are allowed to spawn
Through event commands or would it require scripting?
I have discovered one of Galv's plugins can spawn events, and on particular region IDs. I will look into this as a potential solution.

Thanks.
Hi there,

I'm looking to create the following described encounter system (on-map encounters) with as much eventing as possible. A custom plugin may be inevitably required but I wanted to see if anyone could see a way of doing this with the RTP.

I need enemy events to "spawn" outside of the player's field of view (I am using the standard 800x600 resolution) at timed intervals, and then approach the player. The battle initiation and the like I can handle myself after I get this hurdle out the way.

The main problem is I need these enemies to spawn and follow normal tiles without using "through". So, even if I could think up a way of getting the events to spawn a certain amount of tiles away from the player, how would I make sure they could spawn on normal "walkable" tiles and not in walls, on the sides of cliffs, etc.

If this is going to be done, I imagine it is with using variables and regions. Has anyone got any thoughts?

I think this can be done with the help of Orange Custom Event plugin (allow you to add an event from anywhere to current map)
http://mvplugins.com/plugin/Hudell/OrangeCustomEvents
So you will have a script like this:
var event_created = 0;
while (event_created < 1) {
var ranX = Math.randomInt(30);//max of your MapX - 1
var ranY = Math.randomInt(17);//max of your MapY - 1
if( ((ranX < $gamePlayer.x - 5) || (ranX > $gamePlayer.x + 5)) && ((ranY < $gamePlayer.y - 5) || (ranY > $gamePlayer.y + 5)) ) {
if([2,4,6,8].some(function(d) {$gameMap.isPassable(ranX,ranY,d})) {
$gameMap.copyEvent(1, ranX, ranY, true);//this is from Orange Custom Event
event_created++;}
}
};

run it once whenever you need to create 1 enemy (be careful if you try to run it in parallel event that may cause endless loop)
Through event commands or would it require scripting?
It would require minimal scripting. But so would spawning events, so I assumed you were scripting already.
It might be doable with event commands.
You could probably use one event (or whatever number you need) that you move around with "set event location" and use random variables for the x and y
The tricky part would only be to make sure it's moved on a walkable area far enough from the player probably using a loop.

Original thread: https://forums.rpgmakerweb.com/threads/encounter-system-help.95216/