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.

I apologize for how blurry it may be, but this is how I have the enemy event set up and would love some help on getting this to work properly.

NPC Page 1.png


Thank you for any and all suggestions, tips, and help!
Have you tried making the area you escape to turn on a switch that turns the enemy off?
Have you tried making the area you escape to turn on a switch that turns the enemy off?

I was suggested to do it with a script and all it did was break the escape route so it didn't work. I'm gonna mess around with conditions and see what does and doesn't work but whenever I use conditions they hardly work half the time for me
I was suggested to do it with a script
The script call you were given in the other thread should have worked perfectly fine. At worst it would have not worked.
But that is the method to use either a script call or set a switch or variable on.
In the event the last tab should be with a self_switch or switch or variable selected. Self_switch works great as you don't have to use an actual switch.
I remember the command was given to you so I do not understand why it didn't work.
If the event id for the enemy is 5 and the map is 2 and the self_switch is D then the command would be
$game_self_switches[[2, 5, 'D']] = true

And that's it. the self_switch gets changed and the event does what you tell it. if the event for D switch is blank then the event will disappear.
This works, I use it all over my game.

The other option is to use a switch. on your exit event turn the switch on and presto same thing.

all it did was break the escape route
How did it break it?
The script call you were given in the other thread should have worked perfectly fine. At worst it would have not worked.
But that is the method to use either a script call or set a switch or variable on.
In the event the last tab should be with a self_switch or switch or variable selected. Self_switch works great as you don't have to use an actual switch.
I remember the command was given to you so I do not understand why it didn't work.
If the event id for the enemy is 5 and the map is 2 and the self_switch is D then the command would be
$game_self_switches[[2, 5, 'D']] = true

And that's it. the self_switch gets changed and the event does what you tell it. if the event for D switch is blank then the event will disappear.
This works, I use it all over my game.

The other option is to use a switch. on your exit event turn the switch on and presto same thing.


How did it break it?
When I used it on my test game (the game I have set up to test events and such before they go into my horro game) the exit didn't work after I put the script call in. However, I've never used script calls before and I may have just done it wrong? Either way, it made it so the character couldn't be transfered out and I would end up getting a gameover.

I don't doubt the script works, but I need a better example on how to set it up other than "set a self switch" as I'm very new to this even a month and half after working on my game. Half the time I feel almost like I don't know what I'm doing... and I finished playing the Events game, which helped a lot but never went into detail about script calls. So I know nothing about finding the IDs of maps and events, unless thats the map and event names...?
a month and half
I've been working on my second game for 4 years. My first game took 6 months using nothing but default assets.
feel almost like I don't know what I'm doing
I hear you, I feel that sometimes for some things.

But the script call I just posted is 'exactly' what you need. I can't say exactly because I don't know what your map id or event id is.
1599849192439.png
So how do I find my map and event ID?
map and event ID
The map id is on the bottom right or you can go to the map properties. (right click on the map select properties)
then the map properties will have the ID at the top left. Use 5 not 005.
Same for events. Open an event and the id is at the top left. Events by default name themselves the id number. (EV002)
The map id is on the bottom right or you can go to the map properties. (right click on the map select properties)
then the map properties will have the ID at the top left. Use 5 not 005.
Same for events. Open an event and the id is at the top left. Events by default name themselves the id number. (EV002)

Ooohh see, I thought the ID was seperate from the name. So, in my game the map ID is 024 and the Event is EV020. Would I write the script as:

$game_self_switches[[024, 020, 'A']] = true

or

$game_self_switches[[24, 20, 'A']] = true
So I added it to my test game and got this after leaving the room, maybe I set it up wrong?

View attachment 160372View attachment 160370
$game_self_switches[[24, 20, 'A']] = true
This. in the other thread you used $game_self_switch. you're missing the es on the end.
This. in the other thread you used $game_self_switch. you're missing the es on the end.

I have that set up in my test game and it works, but now whenever I transfer into a different area the game crashes and gives me this error. The 2 pictures is how I have the exit set up. Am I missing something?

Before hand, the transfer event didn't work at all. So I'd say this is definitely progress lol

Thank you for being so patient with me!

Error.png
Event Set UP.png
In your latest screenshot, your script call still says switch
It should say switches
It must be the plural form, even if you are only dealing with just one.
This is exactly the same answer that was given to you in your other thread. Why are you making a new thread for the same question? It just confuses everyone and causes extra work, and you are no closer to a solution than you were with the other.
This is exactly the same answer that was given to you in your other thread. Why are you making a new thread for the same question? It just confuses everyone and causes extra work, and you are no closer to a solution than you were with the other.

Because my other thread stopped recieving answer. I'm assuming it gotten burried under new threads?

This is exactly the same answer that was given to you in your other thread. Why are you making a new thread for the same question? It just confuses everyone and causes extra work, and you are no closer to a solution than you were with the other.

No, its not. Same solution, yes. But not the same answer. I was given far more information in this answer that genuinely contributed to helping me.

I fixed the issue and now the events work. However, a new issue arises where the event is still active when I re-enter the room. So again, I'm still not getting the help to a fix I need done in order to progress with the development of my game.
the event is still active when I re-enter the room
then you didn't specify the correct event.
map_id you got that, event id is the enemy. So your enemy will have a tab that is blank with a self switch. I presume D is free?

No, its not.
Yes it is. Kes gave you the same answer that I did. I just helped you understand where to find those numbers.
You Really do have two threads for the same thing.

When a thread doesn't get an answer in two minutes, that's ok. Give us time to help you.
We are not paid professionals that sit on our computers waiting for members to ask questions. We are volunteering our own free time to help others without any compensation. *well maybe good satisfaction.
If you don't hear anything in 72 hours then you can make another post in your thread. There is no need to make a new one. Note the 72 hours is part of the forums rules. If you haven't read those then that's something to consider as well.
then you didn't specify the correct event.
map_id you got that, event id is the enemy. So your enemy will have a tab that is blank with a self switch. I presume D is free?


Yes it is. Kes gave you the same answer that I did. I just helped you understand where to find those numbers.
You Really do have two threads for the same thing.

When a thread doesn't get an answer in two minutes, that's ok. Give us time to help you.
We are not paid professionals that sit on our computers waiting for members to ask questions. We are volunteering our own free time to help others without any compensation. *well maybe good satisfaction.
If you don't hear anything in 72 hours then you can make another post in your thread. There is no need to make a new one. Note the 72 hours is part of the forums rules. If you haven't read those then that's something to consider as well.

Fair enough I guess. When I get stuck I want to find answers pretty much there and now because I fear that I may put this game on a shelf somehwere for it to collect dust and never be touched again. I've done that with so many projects that I have struggled with never got answers to questions I've had. So I apologize for my impatience.

Anyway, as to the event, if I set up a self switch D in the enemy event, wouldn't it go to that last page where self switch D is active, or do I keep the box "Self Switch 'D' is ON" unchecked so the script call and turn it on?

Edit: Just tested it with self switch checked and it worked! I feel confident in putting this in my game and also @Kes I apogolize for my rude imptatience and I really do appreciate the help you've given me. I'm sorry for being a bit of a jerk.
That's okay. I can understand that you might be worried about things stagnating while you're waiting for an answer, but what I do in those circumstances is work on something else. There's always a new map to do, or something in the database that needs attention. If you switch to another task you can keep up the momentum, and come back to your problem with a refreshed mind, as you won't have been obsessing over it.
If you switch to another task you can keep up the momentum, and come back to your problem with a refreshed mind,
As long as too much time has not passed. lol. Like months!
@Kes @Roninator2
Thanks for the help guys! I'm actually running into a new problem now though... my game is starting to lag whenever I test it and I fear I may have too many events. A vast majority of them are to make my world more interractable so like checkable lockers, trash bins, restooms, readable papers and such... I wonder if I'm going to have to get rid of them and just keep the important things making my game sort of bland...

Edit: Turns out my browser was pulling a lot of memory causing my game to lag, so if I play test it again I'm gonna have to close my browser -.-

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