How do I trigger an event stop by leaving the area?

I'm trying to find a way to trigger an event to stop once the player leaves the area. I'm making a horror game where the player encounters an enemy on the map. The enemy's appearance is triggered by collecting an item and if the player is caught by the enemy it is gameover. I'm trying to set a trigger on my transfer events that will call for the enemy event to end and never return.

I'm not good with scripting, so map IDs and event IDs are NOT my strong suit. I've played the tutorial game "Events" and even dabbled in some of the events in the tutorial but they haven't helped with this particular situation. I was suggested in using a scrip call but I don't know how it works as it wasn't used in the Events tutorial game.

Thank you for any and all suggestions, tips, and help!

Use 2 switches.

Switch1 is called to the on position in an event on the square before the transition leading to where the enemy is. This will cause the enemy to spawn, because your enemy is a switch as well. The enemy will have it's switch checkbox clicked and calling for Switch1 Then the enemy will have a second Switch Condition Which is calls for on it's Event Page 2. On event page 2 you need to make sure not to set a sprite for your monster or it will appear like it is still there even after the switch is flipped off. in the space before the area's exit you want to have an event that calls for a switch condition and it sets Switch 2 to be on.

Original thread: https://forums.rpgmakerweb.com/threads/how-do-i-trigger-an-event-stop-by-leaving-the-area.127164/