How can I make events execute a command when they step into a specific region?

How can I assign an action to a specific region? For example, any event that has a specific name or something that differentiates it from the others, when he steps on a tile with region 10 for example, does he turn left and continue walking?

I made a drawing to better demonstrate:
imagem_2024-01-22_140958861.png

These regions only need to affect specific events, in this case I'm trying to make a busy city and this would be the way pedestrians would move.
Does anyone have any ideas? I thought about using notes or something to differentiate the events...
Your example doesn't really support the question. If it's specifically about having a randomized move route like this, there's no need for it to have anything to do with a region ID.

Start your event on space 4, make it parallel, and do:
Control Variables -> Random 1-2
Conditional Branch -> Variable == 1
- Move Route for the rectangle to the left
Else
- Move Route for the rectangle to the right

If you really do need to do something based on a region ID, you use the Get Location Info event command, and one of the pieces of info you can store is the Region ID.
Your example doesn't really support the question. If it's specifically about having a randomized move route like this, there's no need for it to have anything to do with a region ID.

Start your event on space 4, make it parallel, and do:
Control Variables -> Random 1-2
Conditional Branch -> Variable == 1
- Move Route for the rectangle to the left
Else
- Move Route for the rectangle to the right

If you really do need to do something based on a region ID, you use the Get Location Info event command, and one of the pieces of info you can store is the Region ID.
If I were to do this I would have to create an x and y variable for several events... and it would take a lot of work to mess with them.
If I were to do this I would have to create an x and y variable for several events...
Why? I didn't use an X and Y variable.

And because you're setting a value in a variable and immediately checking it, it can be reused in other events.
two things:
one: do you care about the actual ID in the tile?
two: you may try this, open to variation depending on that question:

in the move route, set it to script.
Code:
r = $gameMap.regionId(x,y)
setDirection(switch(r){case 4: return [6,4].value(Math.randomInt()); default: return r;})
moveForward()

I *THINK*
my MV is rusty, but that's the structure: get the region ID at the spot, send it to the setDirection block, and pick 4 or 6 (left or right) depending on one case (4 in the picture).
everything else, *IF* you don't care about the actual ID, you can set the ID to the actual direction to be taken: 2, 8, 4 or 6... 5 if it's a random pick.

I use a similar system to move patrolling guards.

Original thread: https://forums.rpgmakerweb.com/threads/how-can-i-make-events-execute-a-command-when-they-step-into-a-specific-region.165023/