Question about the 'Erase Event' command

So, I've got a question regarding how the Erase Event command actually works. I'm trying to set up a brief scare in my game, where if certain conditions are met, an image will appear on screen during room transitions, and then quickly fade out once the new room has loaded. I have it working now via self switches, but I'm confused about why the Erase Event command was causing errors.

The way I have it set up, the player will leave a room, and during the screen transition, a common event will be called which sets up the image.

The common event (no trigger method, random number is 1...1 for testing purposes and will be changed later) :

1665633563428.png


Once the screen transition finishes and the new room is visible, the image quickly fades out via the Move Picture command, followed by the Erase Picture command, both of which are set up via a parallel process.

1665633691126.png


Now, to avoid the parallel process constantly running once the picture has been erased, I tried to call the Erase Event command once the Erase Picture command had finished executing. For some reason, the Move Picture and Erase Picture commands don't get run, so the event is erased before they can execute, leaving the image on the screen.

However, replacing the Erase Event command with a Self Switch command allows the picture to fade and erase properly. The one downside to this is that I'll need to figure out a way to set the self switch off again so that it isn't just a one-time random event, without causing the parallel process to run.

I guess what I'm mostly wondering is, why does the Self Switch method work here, but the Erase Event method doesn't?
can you show us screenshots of the event that calls the common event, and the one that contains the erase event command?
without that info we can't really understand what you're doing.

both common events and erase event have multiple uses and effects, and your description is missing details to understand what happens in your case.
can you show us screenshots of the event that calls the common event, and the one that contains the erase event command?
without that info we can't really understand what you're doing.

both common events and erase event have multiple uses and effects, and your description is missing details to understand what happens in your case.
Okay, so, the Erase Event method was nearly identical to the Self Switch method I wound up using, so I didn't see any point in posting that variant, however, going back in and testing it, I realized that the one thing I was doing different between either method was that I was calling the Self Switch command inside of the Conditional Branch, while the Erase Event command was being called outside of the Conditional Branch. I'm going to assume that that was the mistake I was making, so, my bad.

For posterity's sake, however, here's the transition event:

1665636798372.png


The original Erase Event parallel process I had set up:

1665636673104.png


And the new Erase Event parallel process which works:

1665636602554.png
With the erase event command, the event stops running, but it won't be disabled. The event disappears from the map.

When you reload the map, either by loading a saved game or by re-entering the map, this event will be back and will run again.

When you use a switch and a new page to disable an event, it will be disabled forever, unless you enable it again.

Edit, to solve your issue, place a "wait X frames" command before the "erase event" command, giving the event a bit time to execute all commands before being erased. 7 frames seems to be enough in most cases.
Maybe some command needs the Eventcode to Wait 1 Frame to allow other code elsewhere first.
Not sure if it is helpful but here one example:
1.
Set Moveroute Player - Move Right
Control Variables to Player X and Y
Player had no Time to Move, you get the Coordinates he is on before Moving.

Set Moveroute Player - Move Right
Wait 1 Frame
Control Variables to Player X and Y
Now the Player had Time to initialise the Moveroute, you get the Coordinates where he is moving to.
The Visible Representation of the Player might still be on the previous Maptile.

This can also come true for some Scriptlines or other Code, but it is rare, just wanted to mention it.

Such things can also happen when you change Maps, if you have code but you change the Map before the code had 1 Frame to get initialised it might not happen.
When a Eventpage is finished and before it starts new, it also behaves like it would also Wait 1 Frame.
I guess that is happening when you change Eventpages.

Just guesses, ignore it in case it does not apply here.

Original thread: https://forums.rpgmakerweb.com/threads/question-about-the-erase-event-command.151938/