Inconsistent Z sorting

Hey folks,

I'm setting up a mining system in my game, which has the player change their sprite to one that is 3 tiles wide for a "pickaxe swing" animation.

This means partially overlapping with the adjacent object (a rock) with the pickaxe part of the sprite.

An issue I'm having though, is that whether my sprite overlaps an adjacent object or displays behind it seems to be totally random. Sometimes, I will always render above the event, and sometimes behind it. It will sometimes change for a bit on a map, and change again when I load a new one.

Is there any way I can guarantee that my player has a higher Z priority than any other events on the same Y axis?

This issue persists without any plugins, and seems to become more common when there are a lot of events on screen.

Screenshot examples of the inconsistency:

1sdsa.JPG
fsdfsdf.JPG
you can manually set the priority of all events, although that has more consequences than just where on the z axis the sprite is drawn.

how do you trigger the animation? setting the event to below player changes the position from where the action button works, but if the animation is triggered by other means that would still be ok.
you can manually set the priority of all events, although that has more consequences than just where on the z axis the sprite is drawn.

how do you trigger the animation? setting the event to below player changes the position from where the action button works, but if the animation is triggered by other means that would still be ok.

The animation is triggered directly by interacting with the object (through a common event in the object).

For now, I have added an event that checks if the player is on the same or lower Y, and if so, lowers the event priority to 0 before the animation plays, then resets it to 1 after the animation has finished. This has solved the issue for now, though it is something I feel shouldn't have to be "solved" at all, if that makes sense.
How is this animation shown? It is a sprite change, or an MV-compatible animation? I think you will have less consistency issue if you use animations (hide player -> show one of four animations depending on the direction player is facing -> show player).
How is this animation shown? It is a sprite change, or an MV-compatible animation? I think you will have less consistency issue if you use animations (hide player -> show one of four animations depending on the direction player is facing -> show player).

It is a sprite change. The animation method might work, but if I have to run checks to get the player direction and play different animations based on the result, it sounds like it might be easier just to do one comparison between event Y and player Y, and change the event priority until the animation ends.

Original thread: https://forums.rpgmakerweb.com/threads/inconsistent-z-sorting.165593/