How to refresh event layer on screen

dayseven0314

Villager
Member
Joined
Jul 25, 2017
Messages
6
Reaction score
1
First Language
Chinese
Primarily Uses
RMMV
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
 

Eliaquim

Raze: The Rakuen Zero's Guardian!
Veteran
Joined
May 22, 2018
Messages
1,338
Reaction score
591
First Language
Portuguese - Br
Primarily Uses
RMMV
Maybe calling $gameMap.refresh() ?
 

dayseven0314

Villager
Member
Joined
Jul 25, 2017
Messages
6
Reaction score
1
First Language
Chinese
Primarily Uses
RMMV
I try calling it in console but it didn’t work
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
1,651
Reaction score
1,105
First Language
EN
Primarily Uses
RMMV
Usually event priority is changed by switching to a different event page. Is there a reason you are using a script instead? :kaoswt2:

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. :kaophew:
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. :kaoswt:
 

dayseven0314

Villager
Member
Joined
Jul 25, 2017
Messages
6
Reaction score
1
First Language
Chinese
Primarily Uses
RMMV
Usually event priority is changed by switching to a different event page. Is there a reason you are using a script instead? :kaoswt2:

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. :kaophew:

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. :kaoswt:

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();
    };
 

Kuro DCupu

Trust me, I'm a veteran RMer
Veteran
Joined
Jul 6, 2014
Messages
430
Reaction score
1,376
First Language
Bahasa
Primarily Uses
RMMV
.... 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.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

made a bio for the protag in my project!
Beggar : "I haven't eat for days..."
Kid : "Just do crime! You will get daily necessity for free in prison~"
Stream is a bit late but will be live shortly with some game development! Feel free to drop by!
omg, why persona 5 is so good?

Forum statistics

Threads
99,158
Messages
962,438
Members
130,725
Latest member
teendinsaikha
Top