Conditional Branch - Moving Between Maps

Hi there!

I'm wondering how to set up a conditional branch that triggers -only- when a player switches maps (from one map to any other map, not any specific maps). This conditional branch is going to be on a common event that is always active and, thusly, would trigger something every time a map switch occurs.

Is there any way to do this?
Code:
Wait 60 Frames
Control Variables: Current Map = Game Data > Other > Map ID
If Variable: Current Map <> Variable: Last Map
  Control Variables: Last Map = Variable: Current Map
  ... do stuff you want to be done on map change
End

You need to have the common event set to parallel process, and you need to have a wait in there, as you don't need to check it 60 times a second (and doing so would cause lag).

If you don't want it to happen on the very first map, then in your intro event on the first map, where you're turning on the switch that triggers this common event to run, add this before turning on the switch:
Code:
Control Variables: Last Map = Game Data > Other > Map ID
Hey, thanks! That was super helpful, and a very speedy reply. This is exactly what I needed, thank you.
... or you could have an autorun event on every map which trigger the condition. Like a switch that would be turned off later on your common event. Or it's preferable to use regular common event call on that autorun if your parallel common event sole purpose is just doing that.

But I guess that would be a hassle. Whatever suit your need.

Original thread: https://forums.rpgmakerweb.com/threads/conditional-branch-moving-between-maps.120331/