Battle Symphony make player foreground relative to enemy battlers

I am using Battle Engine Symphony, whose code can be found here:

This script adds the players' party as sprites on the battlefield. I am having trouble with player sprites going into the background behind enemy battlers when they overlap.

See clip for demonstration of the problem -
CLIP

In battles, the enemy battlers are considered foreground relative to player party members. This looks bad when player characters overlap enemy battlers. Player characters should always remain foreground when overlapped with enemy battlers.

Any help would be much appreciated, ty
Fixed, I believe. Still testing for unknown side effects but so far so good.

I don't understand what exactly I did, but through guess-and-check I eventually got it to work by changing line 2148 of the Battle Symphony code.

Previously the block said:

def create_actors
max_members = $game_party.max_battle_members
@actor_sprites = Array.new(max_members) { Sprite_Battler.new(@viewport1) }
end


But I swapped to viewport2 and now party members appear foreground relative to enemies

def create_actors
max_members = $game_party.max_battle_members
@actor_sprites = Array.new(max_members) { Sprite_Battler.new(@viewport2) }
end
If it works for you then great.
Take note that viewport 2 is normally used for weather.

What you may find is that the player will now be above events. Even events that you have set to above player, since events are still on viewport 1.
The viewports work like z layering. 1 on the bottom then 2 then 3.

This is as much as I know. Others may offer their thoughts as well.

I wonder if you can adjust the actor sprite z level
@actor_sprites.z = 200
Any other ideas please? Here I am still trying to fix this a year later.

My solution of changing viewport to 2 results in a new bug - afterimages of revived characters appear after revival.

Does anyone know how I could tell the program
"refresh sprites after revival from death state"?

I can't for the life of me find the code for making a sprite reappear after reviving from death.

Another possible solution would be to change the order of laying down sprites from being actors first > enemies second to enemies first > actors second. This is assuming as sprites are laid down 1 by 1, their z values relative to one another are determined by the order of initialization.
I'm wondering if there is something else going on here. Do you have any other scripts which might be affecting/overwriting this particular function? Could you have edited something e.g. in Yanflys Ace Core or Battle Core scripts which might be influencing this?

The reason I'm wondering this is because I used Battle Symphony for 3 games without ever getting this problem, and I was doing all sorts of things with it including, in my last game, marrying it up with a predictive CTB system.
I'm wondering if there is something else going on here. Do you have any other scripts which might be affecting/overwriting this particular function? Could you have edited something e.g. in Yanflys Ace Core or Battle Core scripts which might be influencing this?

The reason I'm wondering this is because I used Battle Symphony for 3 games without ever getting this problem, and I was doing all sorts of things with it including, in my last game, marrying it up with a predictive CTB system.
Thanks, it is fixed. I went over customizations I made in the past with more scrutiny, and finally found the 'revive' code:

#--------------------------------------------------------------------------
# * Revive from Knock Out
#--------------------------------------------------------------------------
def revive
@hp = 1 if @hp == 0
#$game_temp.reserve_common_event(7)
end

By commenting out the bold, a customization I had made a loooong time ago, there is no more afterimage while using viewport2.

Original thread: https://forums.rpgmakerweb.com/threads/battle-symphony-make-player-foreground-relative-to-enemy-battlers.146244/