MV Enemy Clipping with Yanfly Battle Engine Core

hi there friends!
i just installed yanfly's battlecore, i love it but unfortunately after i installed it i started having clipping issues.
all of my enemies are actually made of several smaller enemies representing their body parts, with a base showing them dismembered. I position all of these enemies in the same place using mr trivel's Enemy Positions
does anybody know any ways to set definite layer orders to stop this from happening?

Spoiler: gore/dismemberment
And you can verify that doesn't happen when you turn the Battle Engine off, save your project, and start a new game? Then happens again when you turn it on, save your project, and start a new game?

Because that looks like some kind of graphics card kind of error - layered sprites in the game aren't moving, there should be nothing to make them change layers like that.
And you can verify that doesn't happen when you turn the Battle Engine off, save your project, and start a new game? Then happens again when you turn it on, save your project, and start a new game?

Because that looks like some kind of graphics card kind of error - layered sprites in the game aren't moving, there should be nothing to make them change layers like that.

Can confirm I turned Battle Engine off and it worked completely fine.
What about when you turn the Enemy Placement off?

Is is a conflict between the two plugins, or does it happen with any overlapping sprites and Battle Engine?
What about when you turn the Enemy Placement off?

Is is a conflict between the two plugins, or does it happen with any overlapping sprites and Battle Engine?
Tried turning Enemy Placement off. Happens with any overlapping sprites and battle engine.
JavaScript:
Spriteset_Battle.prototype.battleFieldDepthCompare = function(a, b) {
    var priority = BattleManager.getSpritePriority();
    if (a._battler && b._battler && priority !== 0) {
      if (priority === 1) {
        if (a._battler.isActor() && b._battler.isEnemy()) return 1;
        if (a._battler.isEnemy() && b._battler.isActor()) return -1;
      } else if (priority === 2) {
        if (a._battler.isActor() && b._battler.isEnemy()) return -1;
        if (a._battler.isEnemy() && b._battler.isActor()) return 1;
      }
    }
    if (a.z < b.z) return -1;
    if (a.z > b.z) return 1;
    if (a.y < b.y) return -1;
    if (a.y > b.y) return 1;
    return 0;
};
The plugin actually does sort the sprites, by comparing z first, then y.
The plugin actually does sort the sprites, by comparing z first, then y.
Right, and neither of those should be changing during the battle to cause layer movement and flickering like that.
Yeah, but it is fishy. If you trust the sort function of javascript, when it compares two element with the same value. (The battle core sort them in every update)
Well, it's simple to test. Open the plugin in a text editor, go to line 3358, and comment it out with //

1721187783074.png


Save the change, right-click the plugin in the plugin manager, Refresh, save your project, start a new game.
Well, it's simple to test. Open the plugin in a text editor, go to line 3358, and comment it out with //

View attachment 311657

Save the change, right-click the plugin in the plugin manager, Refresh, save your project, start a new game.
Commenting it out worked! Thank you!

Only problem is, now there's this strange flashing box at the bottom?
1721220073878.png
Well instead of remove all of them, maybe you can sort them by id or something or you editor the picture to use different y positions.

Original thread: https://forums.rpgmakerweb.com/threads/enemy-clipping-with-yanfly-battle-engine-core.170370/