MV Change an event's direction from another map

Hello!

I am in need of a plugin or script call that allows one to change an event's direction from another map. This is important because all of my NPCs have dialogue markers, including one that shows when a new line of dialogue is available, and NPCs dialogues can be affected by things you do in other maps, and I hate having to make extra events just to change the direction of the marker event upon entrance.

Thank you to whoever takes on this plugin, or lets me know of an appropriate script call~
By default only one map's data is loaded at a time. E.g. none of the events on map 1 actually exist while you're on map 2. That's why many event properties reset when you leave the map.

I don't know about plugins for this, but have you considered giving each NPC a different page for each dialogue marker? Then you could toggle their appearance from any map in the game just by meeting the appropriate page condition (switch, variable, item, etc).
By default only one map's data is loaded at a time. E.g. none of the events on map 1 actually exist while you're on map 2. That's why many event properties reset when you leave the map.

I don't know about plugins for this, but have you considered giving each NPC a different page for each dialogue marker? Then you could toggle their appearance from any map in the game just by meeting the appropriate page condition (switch, variable, item, etc).
I could relegate the markers to self switches, but that'd require me to overhaul tons and tons of NPCs. (I have roughly 40 atm, and a lot of them are affected by lots of different things, so it'd be time consuming to make such a change.)

It'd be more efficient to do what I've been doing and create temporary events to switch the direction of dialogue markers. (Each direction is another state of the marker.)

The most efficient way of going about this is being able to switch the directions from other maps. Having a script call or plugin call to do this would help a lot.
Event direction is hardcoded data. You can't change it unless you're on that map when they're loaded onto the map scene. You would have to either have the different directions be on different pages then switch which page they're on from the other map, or queue up all your direction change commands in an array then execute all those commands in sequence when you enter that map.
I think you might be able to pull it off using game system and an approach similar to self switch data.

Here is a quick plugin I came up with (attached below). Please test as needed. Pretty straight-forward - no credit needed (just appreciated).

Caveat:
Spoiler
You need to keep track of any event and any map that references the key/values in this object because it will override any normal direction setting.

Though it takes more time to setup, I really do think that creating the correct page/direction/switch/selfswitch is better for your workflow than to inject something globally that you won't be able to keep track of in the editor.

This means you will need to print to console or check to see if there are any references to that specific key in the object in case you encounter an error, a dead-end, or nothing happens at all.
Assign each npc a variable and set up a parallel run event that changes the direction the npc is facing based on the value of that variable. I think of condition branches like IF coding: if variable=1, make npc face up, else if variable=2, make npc face right, else if variable=3, make npc face down, else if variable=4, make npc face left. Run that for every npc on the map you want to change the direction of, then flip a designated switch to on (not a self switch) and give the direction changer event a second state that it’s in whenever that switch is on so it isn’t constantly forcing events to only face that direction. Finally, adjust every event that takes you to another map to first turn the direction changer event switch off. You can use the same switch for the direction changer event on every map.

Original thread: https://forums.rpgmakerweb.com/threads/change-an-events-direction-from-another-map.176648/