Change region on event touch.

Hello everyone!

I got another small pickle. Look at this screenshot.


Capture.PNG

Region 120 are set as pitfalls. Whenever the player touches those, they fall and it's gameover.

You see the two bridge events on the bottom platform? I'm using the Pick Up and Throw plugin to be able to pick them up and throw them over the black void.

I want those bridge events to change the region ID from 120 to 0 so the player can go through the black void safely and reach the top.

The idea I've been cooking is to get the event ID of one of the bridges, and compare it to the region ID of where the player drops it. Unfortunately I can't seem to find anything that facilitates it.
I wouldn't use changing regions. The reason is, they are engraved inside map data and changes will therefore not survive map change. Instead I'd use a different region and an interaction with the event would then check if the bridge is down or up.
I wouldn't mind if it doesn't survive the map change. The player is not meant to return to that map on the same play through. I'm gonna see if I use more events, but I kinda want to use the less events possible since the game has a lot of random things happening and I want to keep it sane and as modular as possible.
Look for my Tile Changer / Copy plugin. That will allow you to change the regions (use the tile change option and specify the region layer), and save the changes between map reloads (if you don't want it to do that, just add a parallel process event that changes the regions back again then erases itself, so they're reset every time you load the map).
@Shaz, once again you come to the rescue. Thank you.

BTW, I figured out what I did wrong on the random variable thing, but I ended up doing it with events instead because I couldn't figure out how to actually change the item you receive when a switch is on. Your insistence on having me figure out what I didn't understand and your advice still helped out a lot while doing the eventing, though. I even managed to keep it relatively sane.

Edit: I took a look at your plugin, amazing work. I couldn't find a way to make it so it changes the tile the event itself is on, however. Is there a way I could use it as something like ChangeTile this.x this.y 5 0? "This" is of course referring to the event itself.
You can use Control Variables to get the event's X and Y position into two variables, then use those variables in the plugin command.

If you're using the change tile command, you don't need to worry about adding any loading info in the map's note tags. If the event is always the same one (will always have the same id), you can use this (let's assume it's event 5):
ChangeTile $gameMap.event(5).x $gameMap.event(5).y 5 0

Or if you use Control Variables and your variables are 7 and 8, it would be:
ChangeTile $gameVariables.value(7) $gameVariables.value(8) 5 0

Original thread: https://forums.rpgmakerweb.com/threads/change-region-on-event-touch.102879/