How to trigger a Common Event when a player enters a new Region ID

Hi there, it's been a while since I've used RPG Maker MV.

I'm looking for a plugin similar to Hime's Custom Event Triggers which would allow me to trigger a Common Event once when a player enters a new Region ID.

Many thanks! Happy to pay if this plugin doesn't exist too.
Yanfly Region Events 🙂
@Eliaquim

Thank you so much! I've looked at the help file on this and it seems to trigger constantly, is that the case?
Every time you walk in a region the common event will play.
But, you can put a conditional branch in the common event itself for it not play again.
Example:
Add + 1 to a variable X.
If(X <= 1) {
Do your stuff
} Else {
Do nothing
}

That way, the common event will play only once, since every time the common event is a trigger, it will add + 1 to a variable X.

Alternatively, you don't need to use a plugin for that.
Put a parallel event in the map and in a conditional branch you can use the script call:
if($gamePlayer.regionId(X)) {
Call the Common event
Self switch A On (so the parallel event ends, and will not trigger again)
}

Replace X with the region number you want.
Thank you so much for the reply @Eliaquim, I think we're on the right track here.

I think I should have been a little more specific with my original question (my fault). Basically my map has 15 regions on it, and I want a common event to run once and only once when the player moves from Region to Region. So if they go from Region ID 1 to Region ID 2 it triggers, then again it would trigger if they went from Region ID 2 and Region ID 3
You could still do it with events instead of plugins. Something like this would work - make sure to put the wait at the top, because you're not going to need this to run 60 times a second ...

Code:
Wait 10 Frames
Control Variables [Current Region] = Script: $gamePlayer.regionId()
If Variable [Current Region] <> Variable [Previous Region]
  Control Variables [Previous Region] = Variable [Current Region]
  If Variable [Current Region] = 1
    Jump to Label: Region 1
  End
  If Variable [Current Region] = 2
    Jump to Label: Region 2
  End
  ... and so on
  If Variable [Current Region] = 15
    Jump to Label: Region 15
  End
End

<comment: region is not one we're interested in, so just skip>
Exit Event Processing

Label: Region 1
  ... do stuff for region 1 here
Exit Event Processing

Label: Region 2
  ... do stuff for region 2 here
Exit Event Processing

... and so on

Label: Region 15
  ... do stuff for region 15 here
Exit Event Processing

So what's happening here is that it's going to check every 10 frames to see if the region has changed. If it has, it's going to store away the region for the next comparison (initially the 'previous region' will be 0 because that's what a variable is before you set it), then check what the region is, and jump to the correct place to do the processing for that region. Then it won't do that processing again unless you leave the region and return.

Now, if this is just happening on a single map, put it into a map event, and set it to parallel process. If it's happening on all maps, or lots of maps, put it into a common event set to parallel process with a switch as the condition. Turn the switch on when you're on one of these special maps, and off again when you want to stop the checks from happening.

In a parallel process event (map event or common event), the commands will loop by default - once you get to the last command, it'll go back to the top and start over. So the Exit Event Processing will not actually cause the event to stop - it'll just skip everything else from that point down, go back to the top, and start over again.

You could do the same thing using nested If/Else/End branches rather than the Jump to Label / Label combo, but with 15 levels, it'll get hard to read due to the indenting.
Amazing, that worked beautifully ... thank you so much!

Original thread: https://forums.rpgmakerweb.com/threads/how-to-trigger-a-common-event-when-a-player-enters-a-new-region-id.114302/