SV_Enemy showing under SV_actor?

Its probably something standart in RPG Maker, but the sideview enemy has lower priority than the actors, this shows when i make a big sprite, it shows under the other actor and looks so dumb, i want the enemy to have layering priority whenever he attacks (same for the actors)

I don't know if this should be in javascript request, but does anyone knows a fix?

1581812837829.png
No idea how to change it manually in an action sequence but if you want always attacker on top of everything.

Code:
Spriteset_Battle.prototype.battleFieldDepthCompare = function(a, b) {
    var priority = BattleManager.getSpritePriority();
    if (a._battler && b._battler) {
    if (!$gameSwitches.value(1)) {
        if (a._battler.isActor() && b._battler.isEnemy()) return 1;
        if (a._battler.isEnemy() && b._battler.isActor()) return -1;
    } else {
        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;
};

and run a check at beginning of every skill for the switch.

if user.isEnemy()
CHANGE SWITCH 1: on
else
CHANGE SWITCH 1: off
end

Put it below battle engine core.
Battle engine core also without said plugin lets you choose between actors or enemy on top or normal which is only based off position, I think it defaults to actors on top, so try switching to 0 first and see if that is better in side view sprite priority.
No idea how to change it manually in an action sequence but if you want always attacker on top of everything.

Code:
Spriteset_Battle.prototype.battleFieldDepthCompare = function(a, b) {
    var priority = BattleManager.getSpritePriority();
    if (a._battler && b._battler) {
    if (!$gameSwitches.value(1)) {
        if (a._battler.isActor() && b._battler.isEnemy()) return 1;
        if (a._battler.isEnemy() && b._battler.isActor()) return -1;
    } else {
        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;
};

and run a check at beginning of every skill for the switch.

if user.isEnemy()
CHANGE SWITCH 1: on
else
CHANGE SWITCH 1: off
end

Put it below battle engine core.
Battle engine core also without said plugin lets you choose between actors or enemy on top or normal which is only based off position, I think it defaults to actors on top, so try switching to 0 first and see if that is better in side view sprite priority.


The plugin worked! Thanks
Btw, i tried to setting the parameters in battle engine core to 0, and even to 2 (enemies on top) and got no results, maybe its broke? idk
The plugin worked! Thanks
Btw, i tried to setting the parameters in battle engine core to 0, and even to 2 (enemies on top) and got no results, maybe its broke? idk
Well if you put mine in it won't anymore, otherwise maybe you were changing front sprite and not side view, could also be compatibility, I seem to have something overwriting it below yanfly plugins.
Well if you put mine in it won't anymore, otherwise maybe you were changing front sprite and not side view, could also be compatibility, I seem to have something overwriting it below yanfly plugins.

I tried both, no results, but thats ok, as long as yours work thats cool. I figured i'd set Battle core to 0, idkl if that helps to avoid conflicts with your plugin
No idea how to change it manually in an action sequence but if you want always attacker on top of everything.

Code:
Spriteset_Battle.prototype.battleFieldDepthCompare = function(a, b) {
    var priority = BattleManager.getSpritePriority();
    if (a._battler && b._battler) {
    if (!$gameSwitches.value(1)) {
        if (a._battler.isActor() && b._battler.isEnemy()) return 1;
        if (a._battler.isEnemy() && b._battler.isActor()) return -1;
    } else {
        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;
};

and run a check at beginning of every skill for the switch.

if user.isEnemy()
CHANGE SWITCH 1: on
else
CHANGE SWITCH 1: off
end

Put it below battle engine core.
Battle engine core also without said plugin lets you choose between actors or enemy on top or normal which is only based off position, I think it defaults to actors on top, so try switching to 0 first and see if that is better in side view sprite priority.

Is there a way to make the game check to turn the switch only if its an attack in actor 3? So it wont go over the actor one like in the image
1581829569757.png
.
Is there a way to make the game check to turn the switch only if its an attack in actor 3?
View attachment 134341

You can try

if user.isEnemy() && target.actorId() === 3
CHANGE SWITCH 1: on
else
CHANGE SWITCH 1: off
end

should work.
You can try

if user.isEnemy() && target.actorId() === 3
CHANGE SWITCH 1: on
else
CHANGE SWITCH 1: off
end

should work.

B E A U T I F U L! it worked! Thanks my dude

@matgraz , please avoid double posting, as it is against the forum rules. You can use the "Edit" function on your posts to add additional information you've forgotten or respond to multiple people. You can review our forum rules here. Thank you.

Moved to: JS Plugin Requests
@matgraz if this has fully answered your query please Report your post and ask for it to be closed. Mods might not see a post but they will see a Report.
Thanks
Double-post notice: @matgraz
i did by accident, couldnt find where to deleted so i reported my own reply

Original thread: https://forums.rpgmakerweb.com/threads/sv_enemy-showing-under-sv_actor.118271/