Make a number of select events move away from player.

I have on map enemies, after a battle I'd like the other enemy events to move away from the player to prevent queued battles from occurring.

Any ideas?

Many thanks.
simply give them a move route to move away from the player for a short while.

how to do this depends on how you have them currently moving and how their battle sequence is processed and a few more things.
so if you need more detailed help you'll have to show us screenshots of how they work (event pages) first.
I understand that part, but how do I apply the moveroute to all of them, for example 15 enemies? Also, how do I make sure to target only enemy events?

I'm using the yanfly event spawner to spawn the enemies. They have a custom movement route to set to chase within a certain range using yanflys eventchase. I can provide screenshots if this is not enough info.

I tried using a loop to run through each id, but I'm unsure of the syntax to pass variables into gameEvent functions. I tried it like this - $gameMap.event(variable) to assign the numerical value.

Thanks.

Edit - I should add that using yanflys eventspawner, the ID's default value starts from 1000 for spawned events - so targeting the ID's shouldn't be a problem, I'm just unsure of how to go about it.
I understand that part, but how do I apply the moveroute to all of them, for example 15 enemies? Also, how do I make sure to target only enemy events?
that is why I said the specific needs of details for more help.

and you gave almost no info at all.
even if the events are spawned, they need a master to determine how they work and move.

as for identifying the enemy events - you as the developer need to do this. there are different possibilities on how to do this, but it all depends on how you place the enemies and how you want them selected - you never even specified if the effect should go to all enemies on the entire map or only in a certain distance or whatever.

but without screenshots of an example of your enemy event no one can do anything to help you.
I've figured out a way to make it work using a control switch, but I suppose what I really wanted to know is how to run a loop to select those events by ID.

This is the parallel spawner event which ultilizes the yanfly event spawner plugin along with the region events plugin.


◆If:Script:$gameMap.LastSpawnedEventID() <= 1015
◆Script:Yanfly.SpawnEventInRegion(17, 1, 50, true)
◆Script:Yanfly.SpawnEventInRegion(17, 2, 50, true)
◆Script:Yanfly.SpawnEventInRegion(17, 2, 51, true)
◆Script:Yanfly.SpawnEventInRegion(17, 1, 52, true)
◆Wait:20 frames
◆
:End


What I wanted to achieve was something on the lines of this -


var eventlist = [];
var counter;

for (counter = 0; counter < ($gameVariables.value(17)-1000; counter++) {
eventlist.push($gameMap.event(1000+counter));

eventlist.forEach(function(eventId) {
$gameMap.event(eventId).moveAwayFromPlayer();
});
}

Thanks for your time.

Original thread: https://forums.rpgmakerweb.com/threads/make-a-number-of-select-events-move-away-from-player.144897/