MZ How do I create a one time random encounter?

Hi I've been racking my brain over this one and I feel that the answer is right there.

So the thing that I want to achieve is having a encounter appear in a specified region on the map, have it appear there randomly and after the enemy in said encounter is defeated, it doesn't appear anymore in that region. Even if I exit and re-enter that map. I feel that it's something that has to be done in the Troop Battle Event, but I can't seem to figure it out. I've tried using switches with Conditional branches and looked at using variables but that didn't seem to make sense either. When I used switches on a map event as an alternative the whole event does not spawn.

Any help would be very much appreciated.

if you want an idea of what I mean, it's like in Pokémon when a legendary Pokémon would randomly appear and if defeated it never spawns in the game again unless you reload the save from before the encounter.
is this battle a random encounter like roaming legendaries, or is it a set encounter via events? If its by event, then you just flip a self switch on after the battle and add a blank page to the event that triggers if that self switch is on
doing this as a random encounter is not directly possible, because the random encounter table is static by default.

you either need to use an invisible event like described above (which means the encounter is in the location of the event)
Or you'll need to look for a Plugin that allows for dynamic adding and removing of entries to the encounter table. Tsukihime wrote one for MV, but I don't know about MZ plugins.

the third optiopn is to fake it. Make a copy of a troop that is used in said area, add the special enemy to it.
then make all enemies "appear halfway" and a troop event running on turn 0 that decides to either appear the special enemy or all other enemies depending on a switch.
is this battle a random encounter like roaming legendaries, or is it a set encounter via events? If its by event, then you just flip a self switch on after the battle and add a blank page to the event that triggers if that self switch is on
It would be like a roaming legendary. I set up a section of the map where it spawns.

I tried the self switch, but it made the event not spawn (or despawn) for some reason.
I can think of a clunky solution that involves a parallel event to fake random battles
doing this as a random encounter is not directly possible, because the random encounter table is static by default.

you either need to use an invisible event like described above (which means the encounter is in the location of the event)
Or you'll need to look for a Plugin that allows for dynamic adding and removing of entries to the encounter table. Tsukihime wrote one for MV, but I don't know about MZ plugins.

the third optiopn is to fake it. Make a copy of a troop that is used in said area, add the special enemy to it.
then make all enemies "appear halfway" and a troop event running on turn 0 that decides to either appear the special enemy or all other enemies depending on a switch.
I actually was able to find out what I did wrong when it comes to the invisible event and now it works. For now I'll be able to continue with my project. Appreciate the tips, those will surly come in handy.
I can think of a clunky solution that involves a parallel event to fake random battles
Iv'e never used parallel events. I did see some tutorials on them so I may have to look them up. What would be the way to use them?
You could just create an invisible event that wanders, is Below the player, and is activated on player touch. After the battle, change a switch or self-switch to de-activate the event.
You could just create an invisible event that wanders, is Below the player, and is activated on player touch. After the battle, change a switch or self-switch to de-activate the event.
That combination works swimmingly! Thank you! The illusion has been created.

Original thread: https://forums.rpgmakerweb.com/threads/how-do-i-create-a-one-time-random-encounter.179183/