Question about erasing events

Hi all.

I'm having a weird problem that has to do with, what I think is, erasing events.

Instead of random encounters, I have overworld encounters. The way I handle this is an autorun event. The autorun on page one generates a random seed from 1 to 100, and then all the following pages all change depending on what the variable is. So for example, if it's 1 or higher, as selected in the conditions field, it is one specific enemy. Then if its 2 or higher it's another. Then if it's 20 or higher, a different enemy, and so on. Each enemy event can be 5 different enemies, with a chance to also be a gold variant of that enemy. For some reason though, after I defeat an enemy and erase the event, it comes back as the exact same gold enemy. Technically this is possible, but it's literally a 1 in 100 chance, so I'm not sure what the problem is.

Here are the screenshots of the event pages.

Page 1 (note that its autorun, and the specific variable)
1752714301349.png


Here's page 2, which should only happen if the result of the variable is EXACTLY 1.
1752714380293.png


You'll see that it tracks the location of the player and stuff, but also that the battle process erases the event. Off screen it says that if the player escapes, it also erases the event.

Here's page 2, just for confirmation.
1752714506677.png

The other pages are all very similar, so I don't think it's relevant.

This seems to be happening with all the other enemies as well, but they are all different enemies. Almost like once the random variable is generated, it never changes, and erasing the event doesn't matter.


I figure that maybe it isn't forgetting the variable? I'm fine with it staying the same enemy UNTIL it gets defeated though.

What is the best way to handle this?
no, it is not forgetting the variable - a variable always stays the sam until changed by another control variable command.
and that means your events never go back to page 1 unless the variable is manually set to zero

The best solution would be to add another control variable command just before each erase event, setting the value of the variable to zero.

Forcing the event to reroll at entering the map is possible, but a bit more complex as the variables would have to be reset either on leaving (better) or on entering the map - with one command for each enemy event added to the transfer event
So I tried doing it before the erase event and there were some weird dissapear effects after the battle, but I set it to AFTER erase event and THAT did the trick! Thank you!

Wish I noticed this before I made all the events, it's gonna take me a long time to correct all of these! I figured it way working because the enemies WERE random, I just didn't realize that they were only random on fresh save files.

Original thread: https://forums.rpgmakerweb.com/threads/question-about-erasing-events.178974/