On Map Encounters

I have no idea if this is the right place for this and I'm sorry if not but I'm having difficulty figuring out how I could make random on map enounters. I have the on map encounter part but I don't want the battle to be the same every time you run into an enemy, I want it to randomly pick between multiple troops and on top of that I'd like them to respawn after either going through multiple rooms or after saving or something similar.
when touch the event have it roll a random number variable then use condition checks with that variable to select from the list of troops.
use normal switches for the 'when win' to turn off that event when you beat it. (if you know the script call for controlling self switch from different events you could use those instead of normal switches)
then to reset the events so can redo the fights you just need to turn those switches off. when i do respawning events i usually have the switches reset from the transfer events that leave that dungeon/region so that can just use the same switches for the next zones respawning events.

edit: the battle process event can also just pick randomly from the random encounter troops from that map. just remove random encounters and can still use the map troop list for the visual encounters instead of random variable and multiple condition checks.
also depending out the order of the troops in the database you could also just use the variable directly as the battle process troop ID (i say depending on the order because you might be using troops 7-9 and 11-13 but the variable rolling random 7-13 could end up rolling a 10 which might be a rare fight dont want from these encounters)
when touch the event have it roll a random number variable then use condition checks with that variable to select from the list of troops.
use normal switches for the 'when win' to turn off that event when you beat it. (if you know the script call for controlling self switch from different events you could use those instead of normal switches)
then to reset the events so can redo the fights you just need to turn those switches off. when i do respawning events i usually have the switches reset from the transfer events that leave that dungeon/region so that can just use the same switches for the next zones respawning events.

edit: the battle process event can also just pick randomly from the random encounter troops from that map. just remove random encounters and can still use the map troop list for the visual encounters instead of random variable and multiple condition checks.
also depending out the order of the troops in the database you could also just use the variable directly as the battle process troop ID (i say depending on the order because you might be using troops 7-9 and 11-13 but the variable rolling random 7-13 could end up rolling a 10 which might be a rare fight dont want from these encounters)
Dude you're a life saver, I didn't even realize that battle processing could be the same as the random encounter, I've had MV for well over a year and this is the first time I've noticed it lol thanks a ton!

Original thread: https://forums.rpgmakerweb.com/threads/on-map-encounters.140025/