MZ Reset Single Event State When Leaving Map

Hi all.

I have a "campfire" event that I'm using. The base event page shows the campfire as being unlit, and once the player lights it, it uses a self switch to change the event options and of course the image used (the fire being lit). I have an option where the player can extinguish the fire, but there is no guarantees that the player will actually use it. So, if the player leaves the map and returns to it, and they did not choose to extinguish the campfire, the campfire is, of course, still active (on the self switch page where it is lit).

I want to auto-extinguish the fire (turn the self switch A of the event off) automatically if the player leaves the map. Any script or even plugin would be welcomed. Any advice, guidance or input would be appreciated.
Why not use normal switch then and reset it every time you enter the map with campfire?

If you still want to use self switch for this, this script should do the job:
Code:
$gameSelfSwitches.setValue([MapID, EventID, 'A'], false);
Why not use normal switch then and reset it every time you enter the map with campfire?

If you still want to use self switch for this, this script should do the job:
Code:
$gameSelfSwitches.setValue([MapID, EventID, 'A'], false);
Thank you very much for the reply - it worked perfectly! Yeah...maybe a normal switch might have been a better idea...
I use this script call for self switches all the time. It's super useful and saves a bunch of regular switches when it's really not necessary to use them.

Original thread: https://forums.rpgmakerweb.com/threads/reset-single-event-state-when-leaving-map.180501/