MZ - Changing Z Index of Battler Sprite (SOLVED)

● ARCHIVED · READ-ONLY
Started by Puppet Knight 1 posts View original ↗
  1. Hey ya'll

    I was wondering if anyone (and if its even properly possible) to change the Z index (layering priority) of an Actors battler sprite mid battle?


    I assume as much since VS has settings related to it. The issue I'm running into is a Summon that comes in mid battle obviously is drawn "last" and as such ends up sometimes on top of other actors heads lol


    1705156036597.png


    Any help here would be great.

    For reference the actor being changed will always be party Index 4. But a catch all solution that others can use too would be nice.

    SOLVED:

    Use the following Script:
    Adjust Z Layer of Actor
    // Assuming a 4 member party // Party Member 5 var partyMemberIndex = 4; // Get the actor ID of the party member at index 4 var actorId = $gameParty.members()[partyMemberIndex].actorId(); // Get the corresponding game actor var actor = $gameActors.actor(actorId); // Get the sprite associated with the actor in battle var actorSprite = BattleManager._spriteset._actorSprites.find(sprite => sprite._battler === actor); // Now, actorSprite contains the sprite parent of the party member at index 4 in battle // Make it changeable actorSprite.parent.sortableChildren = true; // Change to desired index. Default = 0, so reduce or increase by the amount needed. actorSprite.zIndex = -2;

    Result:


    1705171519025.png