MZ Toggle Region Passability

Hello, I need help creating this mechanic for my game. The idea is having region restriction/allowance that can be toggled ON/OFF mid-game using plugin command (or script call).

I tried a bunch of region-altering plugins: VisuStella's Events and Movement Core, Tyruswoo's Map Properties, Tomoaky's Region Passable. But none of them provide a function to toggle the passage restriction/allowance ON and OFF on command (unless I missed it).

My game context:
I have an item that makes the player "fly" on the map. When flying, certain areas of the map will be traversable. I'm hoping to mark these unique areas using regions.
Spoiler
passage01.png
Passage02.png
If the region with 'allow' passability is active, the player will be able to pass through the marked tiles from all directions. But if it's inactive, the marked tiles will follow the default passage settings from the database.

I hope this is understandable enough. I’d be really grateful if someone could help make this possible. Thank you!
I have DynamicRegions that can be toggled on and off [found here].
while its old, I cannot test if it works in MZ, but I would try to make it
work for for MZ too, so feel free to test it.
@ShadowDragon This plugin works well! But it’s only for creating 'blocking' regions. I also need 'allow' regions to make areas that normally can't be accessed become traversable from all directions.
Is there a reason you're not using the airship? The airship does pass over absolutely everything, but maybe you can make it avoid blocking regions if needed.
If you're using VisuStella's EventsMoveCore, you can append region ID's to $gameMap._regionRules.AllAllow
So if you wanted to make region 101 available for walking, you can execute $gameMap._regionRules.AllAllow.push(101), which adds it to the array.
To remove it from the array, you can use $gameMap._regionRules.AllAllow.pop(101).

You can probably also do this for other region rules, such as PlayerAllow, PlayerForbid, EventAllow, etc.
I tested it out and it seems to preserve between map changes.
@ShadowDragon This plugin works well! But it’s only for creating 'blocking' regions. I also need 'allow' regions to make areas that normally can't be accessed become traversable from all directions.
than check the one above, as a single line or block can be blocked, unless the switch
is ON or OFF, than allow them to walk over.

if it works differently you intend it to be used, than the post above might do
what you want or I need more details, so I can create what you need (hopefully).
as I cannot test on MZ, but the language are the same though ^^

if the poster above does the trick, go for it, if not, sign me and I see what I can do,
if there is no suitable plugin available.
@SolarFlare Yes, because I'm using a unique sprite with some gimmicks when the player is in "flying mode", which doesn't seem possible if I use vehicles.

@satilte I can't seem to make it work. I tried with this train track tile, which normally only passable from left and right direction. Using $gameMap._regionRules.AllAllow.push(101) allows me to enter the track from top/bottom, but then I can't exit it from the same way.
passage01.png


@ShadowDragon Yes, I'd like that very much, if it's no trouble!
@SolarFlare Yes, because I'm using a unique sprite with some gimmicks when the player is in "flying mode", which doesn't seem possible if I use vehicles.

@satilte I can't seem to make it work. I tried with this train track tile, which normally only passable from left and right direction. Using $gameMap._regionRules.AllAllow.push(101) allows me to enter the track from top/bottom, but then I can't exit it from the same way.
View attachment 345046

@ShadowDragon Yes, I'd like that very much, if it's no trouble!
You might have to add a region around the train track (north and south), since the borders still apply. After leaving the track, you could remove the regionId from the array.
@satilte You're right! I did this and it works perfectly.
Passage00.png

Thank you so much!

@ShadowDragon I'm really sorry for speaking too soon >< But if you make the plugin, I’ll definitely use it. Thank you nonetheless.
@ShadowDragon I'm really sorry for speaking too soon >< But if you make the plugin, I’ll definitely use it. Thank you nonetheless.
didn't saw it, just now, but if the switch is ON, you cannot cross the region.
and events aren't blocked currently.

if you were able to cross the region, if it was ON or OFF, than it might be a bug
as for testing, it didn't on my end.

so if it worked as the above told, keep that way 🙂 as I cannot do much without
detail on what exactly happens.

so feel free to DM with details, so I know what you exactly mean if you really
want to switch, but got low time to update it for event side 🙂
You're right! I did this and it works perfectly.

Actually, there are still a couple of issues. When I exit the map while still in 'flying mode' and enter it again, the passability changes don't persist. The script needs to be re-executed for them to take effect. I think I can make a workaround for this, but I'm really hoping this whole thing can be more streamlined.

So I'm still open for ideas. Or plugins.

@ShadowDragon Thank you for your time. I'll DM you.
@SolarFlare Yes, because I'm using a unique sprite with some gimmicks when the player is in "flying mode", which doesn't seem possible if I use vehicles.
I'm not sure what you mean by "unique sprite with some gimmicks", but:

  1. There's no restriction on the sprite you can set the vehicle to. If you want to set it to Actor1_1, you can.
  2. The vehicle is the same kind of game object as the on-map player, so if you're using something that does unusual things different from standard sprite drawing, it's probably possible in theory to apply the exact same thing to a vehicle.

Note that the airship does have some "gimmicks" itself – it draws roughly one tile higher than its true position, with a shadow on the ground showing its actual location. This means you're invisible if you're on the topmost row of the map.
@Solar_Flare
Sorry, I guess I didn’t provide enough context.

My game is a Yume Nikki fan game. A core feature of most Yume Nikki games is the ability to change the player's sprite by using items on the map. Sort of like equipping costumes.

The mechanic I’m trying to create is a “flying” costume, where the player can move over certain tiles that are normally not passable.

Using an airship would be the obvious solution, but the problem is that the player should still behave like a regular character; able to interact with events and still collide with tiles that aren’t deemed “passable when flying.”

I’m trying to create a puzzle mechanic, not just a fly-across-the-map mechanic.
I think that makes sense. Getting the airship to collide with stuff at all is probably nontrivial. I remember I managed to make it collide with specifically-annotated events, but that's definitely not sufficient for your use-case.
ShadowDragon delivered a fantastic plugin that does exactly what I need.

Thank you everyone for your help and insight. 😍

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/toggle-region-passability.178914/