Events Not Working After Coming Back To The Program (SOLVED)

I don't know why but every time I make my events they work just fine but when I come back to program after awhile, even if I've come back several times before, some of my events just stop working properly.
Like today a door you can pass through would always bring the player back to the entrance of the door despite it saying you will be taken to the other map location, I figured out if I copy all of the programming inside the event then delete the event and double click to make a new event then copy all those codes inside it again it suddenly starts working normally without me changing anything in it.

Also sometimes my events I just placed will not work until I move them up or down a tile or do the copy paste thing to them too, I just updated my RPG maker MV to version 161 recently and I don't know if it broke my game but I've never had this problem before and it's really annoying.

Does anyone know what's going on? I'd really like to know, it makes game making really hard and lengthy.
It may is because self switches stay on even after you leave a map. Also other switches.

you can use this to turn off all self switches when leaving maps by adding this "script" in the Event to the map transfer event Contents field.

Script:
var m = $gameMap.mapId(Map ID Goes Here);

for (var s = 1; s < $dataMap.events.length; s++){

$gameSelfSwitches.setValue([m, s, 'A'], false);

$gameSelfSwitches.setValue([m, s, 'B'], false);

$gameSelfSwitches.setValue([m, s, 'C'], false);

$gameSelfSwitches.setValue([m, s, 'D'], false);

}

This will turn off all self switches when leaving the map/

Sorry I might be reading this incorrectly. My mistake if I am.
I'll give it a try and update you if it works, thanks for the suggestion.
It seems so odd self switches can mess up a game so much.
I'll give it a try and update you if it works, thanks for the suggestion.
It seems so odd self switches can mess up a game so much.

Well I could be reading into this wrong. Maybe if you can post an image of your events that are going haywire and try to mimic when they do.

Are you using custom tilesets?
No I'm not using custom tilesets (yet), I don't know if self switches are the reason since if I deactivate them wouldn't everything including events just reset again?

...I just went to take a screen shot of it and now I feel dumb, there was a self switch at the bottom of the event after you go through the door 😩gods I'm so stupid.

Thank you for your help nonetheless, so sorry for wasting your time.
Edit: Now i feel stupid =) i overread that you allready found a solution.
When you update your RPG Maker to a New Version, your Game is still running the Old Java Script Libraries, those need to be replaced manualy.
Also it could be possible that you need to update some of the 3rd Party Plugins.
Some needed a few fixes after rpg maker updates.

Maybe this Thread can help fix the most possible causes:

I had similiar Error like you describe also a few times, but i believe it always happened in an older project of which i did not update the Folders, but i cant say for sure. I cant reproduce the error anymore.

Original thread: https://forums.rpgmakerweb.com/threads/events-not-working-after-coming-back-to-the-program-solved.123413/