How to refresh event layer on screen

When events overlap each other

I’m change Event priorityType in js

event priorityType already changed

But it didn’t change on screen

Until player trigger event

So

how to refresh screen

when event priorityType changed
Maybe calling $gameMap.refresh() ?
I try calling it in console but it didn’t work
Usually event priority is changed by switching to a different event page. Is there a reason you are using a script instead? 😅

By default events decide their _priorityType based on the event data ($dataMap), which gets loaded when the game is launched. So if you want the _priorityType change to remain after a player saves and quits then you'll need a plugin, e.g. something to change how event priorities are handled, or something to run an event or script on game load. 😮‍💨
I’m change Event priorityType in js
Did you do this:
  1. With a Script command in an event? Or in the console?
  2. With a plugin (separate js file loaded via the Plugin Manager)? (Recommended!)
  3. By editing rpg_objects.js? (Not recommended!)
It would be much easier for us to help if we could see your code. 😅
Usually event priority is changed by switching to a different event page. Is there a reason you are using a script instead? 😅

By default events decide their _priorityType based on the event data ($dataMap), which gets loaded when the game is launched. So if you want the _priorityType change to remain after a player saves and quits then you'll need a plugin, e.g. something to change how event priorities are handled, or something to run an event or script on game load. 😮‍💨

Did you do this:
  1. With a Script command in an event? Or in the console?
  2. With a plugin (separate js file loaded via the Plugin Manager)? (Recommended!)
  3. By editing rpg_objects.js? (Not recommended!)
It would be much easier for us to help if we could see your code. 😅


events are automatic change priorityType when player status changed

or event are overlap each other

it's better to use Plugin

i'm not go in to save event priorityType when player quits or change Map

now i try to make sure it's work on console

and then add to my Plugin



I found if event i already interact with and when i change priorityType on console

it will immediately change on screen .

but events player are not interact yet it's not change on screen until player

interact with it.

Code:
   //StepHigh is some player status return bool
    Game_Event.prototype.refreshPriorityType = function(x, y) {
        if(this.isEventOnSelf(x, y) && $gamePlayer.isStepHigh() && this.isNormalObject()){
            this._priorityType = 0;
        }else if(this.isOnEvent(x, y) && !$gamePlayer.isStepHigh() && this.isHoldableObject()){
            this._priorityType = 1;
        }
    };

    Game_Event.prototype.isEventOnSelf = function(x, y){
        var events = $gameMap.eventsXy(x,y);
        var eventLast = events[events.length - 1];
        return events.length > 1 &&  eventLast.eventId() === this.eventId();
    };

    Game_Event.prototype.isOnEvent = function(x, y){
        var events = $gameMap.eventsXy(x,y);
        var eventLast = events[events.length - 1];
        return events.length > 1 && !eventLast.isHoldableObject() && eventLast.eventId() !== this.eventId();
    };
.... I would propose alternative. If it were me, I will restructure my event and make use of event page to change the priority instead of depending on something I have no idea.

I don't know the details of your problem since you only mention "when event overlapped each other".
Note that when event with same priority overlapped, it will put event with higher ID in the front. Perhaps I'll start from there.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-refresh-event-layer-on-screen.122464/