Draw player above events with priority: Same as character?

Here is what I'm trying to do:
I have some events that I would like to activate when the player stands next to them (not on them), facing them, and presses the action button. The player should also be able to walk through these events.
By setting the events' priority to "Same as character" and Through to ON, I can achieve this.

My problem is that I would also like the player to visually appear on top of the events when the player walks through them. I would, obviously, be able to achieve that by setting the events' priority to "Below characters" (and in that case, Through would not need to be on) - but then the event is activated when the player stands on it, not next to it.

Another option would be to set the player's priority to "Above Characters" via script call ($gamePlayer.setPriorityType(2)😉 - but then the player also appears on top of tiles marked with star in the tileset settings.

So to summarize, I'm looking for a way to do the following:
  • Activate event when player stands next to it and presses action button
  • Display event below player when walked over
  • Keep 'star' tiles showing above the player
If a plugin is needed to do this efficiently, feel free to move this thread to plugin requests.
Hi there!

I believe if you change the screenZ function, it can do the trick:

JavaScript:
Game_CharacterBase.prototype.screenZ = function() {
    return this._priorityType * 2 + 1;
};

Sprite_Character.prototype.updatePosition = function() {
    this.x = this._character.screenX();
    this.y = this._character.screenY();
    this.z = this._character.screenZ();
};

Like, putting a decimal value:

return this._priorityType * 2 + 0.9

I would go creating a new property (extraZValue) on the Game_CharacterBase class(Or even only in Game_Event), and set a value on this property based on the event note field.

JavaScript:
const Game_CharacterBase_screenZ = Game_CharacterBase.prototype.screenZ
Game_CharacterBase.prototype.screenZ = function() {
    return Game_CharacterBase_screenZ.call(this) + this._extraZValue // -0.1
};

I think I did something like that in my jump plugin, but the property is only changed while the characters are jumping.

Another way to do it, is by changing the player priority type only:

return this._priorityType * 2 + 1.1

Didn't test it, but maybe it will work?
Another way to do it, is by changing the player priority type only:

return this._priorityType * 2 + 1.1
I gave that a try (changing it only for Game_Player) and it works for what I needed! But I really like the idea of an extra z value to add individually to events, so I think I'll write a small plugin for that tomorrow.

Thanks a lot, the screenZ function was exactly what I needed!
Nice! 😀
sry for necro posting,..
I just wanted to say that i searched for such a plugin,but couldnt find any for MV

So i builded one myself and it works for gameMap.event , gamePlayer & gameFollower..
here is the link

Original thread: https://forums.rpgmakerweb.com/threads/draw-player-above-events-with-priority-same-as-character.141142/