MZ Adding More State Icons to Battle Screen and Visustella

Late 2025 edit: He's the current version I wrote:
JavaScript:
//=============================================================================
// More Buff and State Icons
// AL_MoreBuffStateIcons.js
//=============================================================================

/*:
 * @target MZ
 * @plugindesc More buff and state icons.
 * @author Antilurker77
 *
 * @help AL_MoreBuffStateIcons.js
 *
 * This plugin increases the number of buffs and states viewable on the battle
 * status window. This is designed only for the list layout style with the
 * Visustella battle core.
 *
 * It does not provide plugin commands.
 *
 * @param OffsetX
 * @text X Offset
 * @desc Sets the X offset.
 * @default 700
 * @type number
 *
 * @param OffsetY
 * @text Y Offset
 * @desc Sets the Y offset.
 * @default 6
 * @type number
 *
 * @param Margin
 * @text Margin
 * @desc Space between each icon.
 * @default 4
 * @type number
 *
 * @param RowHeight
 * @text Row Height
 * @desc Height per row.
 * @default 44
 * @type number
 *
 * @param MaxStates
 * @text Max States
 * @desc Maximum number of states to display. Buffs and debuffs always display.
 * @default 9
 * @type number
 *
 */
 
 const antilurkerIconXOffset = parseInt(PluginManager.parameters('DoS_MoreBuffStateIcons')['OffsetX']);
 const antilurkerIconYOffset = parseInt(PluginManager.parameters('DoS_MoreBuffStateIcons')['OffsetY']);
 const antilurkerIconMargin = parseInt(PluginManager.parameters('DoS_MoreBuffStateIcons')['Margin']);
 const antilurkerIconRowHeight = parseInt(PluginManager.parameters('DoS_MoreBuffStateIcons')['RowHeight']);
 const antilurkerIconMaxStates = parseInt(PluginManager.parameters('DoS_MoreBuffStateIcons')['MaxStates']);

 Window_BattleStatus.prototype.changeTextColor = function(color) {
     this.contents.textColor = color;
 }
 
Window_BattleStatus.prototype.drawActorIconsEX = function(actor, x, y, maxStates) {
    const iconWidth = ImageManager.iconWidth + antilurkerIconMargin;
    let xPos = x;
    for (let i = 0; i < 8; i++) {
        if (actor.buff(i) !== 0) {
            buffIcon = actor.buffIconIndex(actor.buff(i), i);
            this.drawIcon(buffIcon, xPos, y);
            this.drawActorBuffTurns(actor, i, xPos, y);
            this.drawActorBuffRates(actor, i, xPos, y);
            xPos += iconWidth;
        }
    }
    for (const state of actor.states().slice(0, maxStates)) {
        if (state.iconIndex > 0) {
            this.drawIcon(state.iconIndex, xPos, y);
            this.drawActorStateTurns(actor, state, xPos, y);
            this.drawActorStateData(actor, state, xPos, y);
            xPos += iconWidth;
        }
    }
};

var OldBattleStatusUpdate = Window_BattleStatus.prototype.update;
Window_BattleStatus.prototype.update = function() {
    OldBattleStatusUpdate.call(this);
    this.refresh();
    let yIcons = antilurkerIconYOffset;
    for (const actor of $gameParty.members()) {
        this.drawActorIconsEX(actor, antilurkerIconXOffset, yIcons, antilurkerIconMaxStates);
        yIcons += antilurkerIconRowHeight;
    }
}


I'm trying to get the battle status window to display more states at once, rather than having them cycle through one-by-one. Visustella doesn't seem to be interested in adding this, so I tried writing my own mini-plugin for this functionality. I'm totally stuck, however. I can't figure out how to actually draw something--I'm not very familiar with the UI side of MZ's code base. It also seems like VS overwrites (and of course obfuscates) pretty much everything related to drawing buff and state icons.

This is the closest I've gotten. Nothing actually gets drawn, but I know that the code is getting called and is getting the icon indexes:

JavaScript:
Window_Base.prototype.drawActorIconsEX = function(actor, x, y, width) {
    //console.log('inside drawActorIcons');
    width = width || 144;
    const iconWidth = ImageManager.iconWidth;
    const icons = actor.allIcons().slice(0, Math.floor(width / iconWidth));
    let iconX = x;
    let count = 0;
    for (const icon of icons) {
        //const key = "actor%1-stateIcon%2".format(actor.actorId(), count);
        //const sprite = this.createInnerSprite(key, Sprite_StateIcon);
        //sprite.setup(actor);
        //sprite.move(iconX, y);
        //sprite.show();
        //console.log('state icon: ' + iconX + ', ' + y);
        this.drawIcon(icon, iconX, y + 2);
        iconX += iconWidth;
        count++;
    }
};

var OldBattleStatusRefresh = Window_BattleStatus.prototype.updateRefresh;
Window_BattleStatus.prototype.updateRefresh = function() {
    OldBattleStatusRefresh.call(this);
    for (const actor of $gameParty.members()) {
        this.drawActorIconsEX(actor, 0, 0, 500);
    }
}

Can anyone give me some advice? If I could figure out how to at least get the icons to draw that would be a start.
Are you sure Skills and States doesn't do this, maybe in a plugin parameter someplace? The thumbnail for their video shows what you're asking you about.

Aside from that...it's an uphill climb trying to mess with anything already modified by their obfuscated code.
Surprisingly, no. I'm not the first one to request this either.

Though I did make a bit of a breakthrough. If I call the previous refresh function after my draw calls, I actually get the icons to appear!

JavaScript:
var OldBattleStatusRefresh = Window_BattleStatus.prototype.updateRefresh;
Window_BattleStatus.prototype.updateRefresh = function() {
    for (const actor of $gameParty.members()) {
        this.drawActorIconsEX(actor, 0, 0, 500);
    }
    OldBattleStatusRefresh.call(this);
}

They even draw relative to the battle status window and automatically anchor to it. I think this is workable.
And here we have it. I figured out what the arguments for the VS calls were. I also changed the order icons get displayed (buffs/debuffs first, then states). Posting it here for all the folks who find this thread on Google.

JavaScript:
//=============================================================================
// More Buff and State Icons
// AL_MoreBuffStateIcons.js
//=============================================================================

/*:
 * @target MZ
 * @plugindesc More buff and state icons.
 * @author Antilurker77
 *
 * @help AL_MoreBuffStateIcons.js
 *
 * This plugin increases the number of buffs and states viewable on the battle
 * status window. This is designed only for the list layout style with the
 * Visustella battle core.
 *
 * It does not provide plugin commands.
 *
 * @param OffsetX
 * @text X Offset
 * @desc Sets the X offset.
 * @default 700
 * @type number
 *
 * @param OffsetY
 * @text Y Offset
 * @desc Sets the Y offset.
 * @default 6
 * @type number
 *
 * @param Margin
 * @text Margin
 * @desc Space between each icon.
 * @default 4
 * @type number
 *
 * @param RowHeight
 * @text Row Height
 * @desc Height per row.
 * @default 44
 * @type number
 *
 * @param MaxStates
 * @text Max States
 * @desc Maximum number of states to display. Buffs and debuffs always display.
 * @default 9
 * @type number
 *
 */
 
 const antilurkerIconXOffset = parseInt(PluginManager.parameters('AL_MoreBuffStateIcons')['OffsetX']);
 const antilurkerIconYOffset = parseInt(PluginManager.parameters('AL_MoreBuffStateIcons')['OffsetY']);
 const antilurkerIconMargin = parseInt(PluginManager.parameters('AL_MoreBuffStateIcons')['Margin']);
 const antilurkerIconRowHeight = parseInt(PluginManager.parameters('AL_MoreBuffStateIcons')['RowHeight']);
 const antilurkerIconMaxStates = parseInt(PluginManager.parameters('AL_MoreBuffStateIcons')['MaxStates']);

Window_BattleStatus.prototype.drawActorIconsEX = function(actor, x, y, maxStates) {
    const iconWidth = ImageManager.iconWidth + antilurkerIconMargin;
    const buffIcons = actor.buffIcons();
    let xPos = x;
    for (let i = 0; i < 8; i++) {
        if (actor.buff(i) !== 0) {
            buffIcon = actor.buffIconIndex(actor.buff(i), i);
            this.drawIcon(buffIcon, xPos, y);
            this.drawActorBuffTurns(actor, i, xPos, y);
            //this.drawActorBuffRates(actor, i, xPos, y);
            xPos += iconWidth;
        }
    }
    for (const state of actor.states().splice(0, maxStates)) {
        if (state.iconIndex > 0) {
            this.drawIcon(state.iconIndex, xPos, y);
            this.drawActorStateTurns(actor, state, xPos, y);
            //this.drawActorStateData(actor, state, xPos, y);
            xPos += iconWidth;
        }
    }
};

var OldBattleStatusRefresh = Window_BattleStatus.prototype.updateRefresh;
Window_BattleStatus.prototype.updateRefresh = function() {
    let yIcons = antilurkerIconYOffset;
    for (const actor of $gameParty.members()) {
        this.drawActorIconsEX(actor, antilurkerIconXOffset, yIcons, antilurkerIconMaxStates);
        yIcons += antilurkerIconRowHeight;
    }
    OldBattleStatusRefresh.call(this);
}
Whoops, actually there's a pretty massive performance bug I need to figure out. Probably me screwing up drawing somehow.
JavaScript:
 Window_BattleStatus.prototype.changeTextColor = function(color) {
     this.contents.textColor = color;
 }
 
Window_BattleStatus.prototype.drawActorIconsEX = function(actor, x, y, maxStates) {
    const iconWidth = ImageManager.iconWidth + antilurkerIconMargin;
    let xPos = x;
    for (let i = 0; i < 8; i++) {
        if (actor.buff(i) !== 0) {
            buffIcon = actor.buffIconIndex(actor.buff(i), i);
            this.drawIcon(buffIcon, xPos, y);
            this.drawActorBuffTurns(actor, i, xPos, y);
            this.drawActorBuffRates(actor, i, xPos, y);
            xPos += iconWidth;
        }
    }
    for (const state of actor.states().slice(0, maxStates)) {
        if (state.iconIndex > 0) {
            this.drawIcon(state.iconIndex, xPos, y);
            this.drawActorStateTurns(actor, state, xPos, y);
            this.drawActorStateData(actor, state, xPos, y);
            xPos += iconWidth;
        }
    }
};

var OldBattleStatusUpdate = Window_BattleStatus.prototype.update;
Window_BattleStatus.prototype.update = function() {
    OldBattleStatusUpdate.call(this);
    let yIcons = antilurkerIconYOffset;
    for (const actor of $gameParty.members()) {
        this.drawActorIconsEX(actor, antilurkerIconXOffset, yIcons, antilurkerIconMaxStates);
        yIcons += antilurkerIconRowHeight;
    }
}

This is the best I can come up with. The previous version was flooding an array called "_textColorStack" every time I drew an icon. It would quickly bloat to tens/hundreds of thousands of values and cause the performance issues. It's something from VS; I have no idea what it's actually used for but overwriting the "changeTextColor" function stops it from happening and doesn't seem to break anything from my brief testing.

I feel like I'm fundementally drawing icons the wrong way but I have no idea what the correct way would be. I would welcome any assistance with this.
JavaScript:
 Window_BattleStatus.prototype.changeTextColor = function(color) {
     this.contents.textColor = color;
 }
 
Window_BattleStatus.prototype.drawActorIconsEX = function(actor, x, y, maxStates) {
    const iconWidth = ImageManager.iconWidth + antilurkerIconMargin;
    let xPos = x;
    for (let i = 0; i < 8; i++) {
        if (actor.buff(i) !== 0) {
            buffIcon = actor.buffIconIndex(actor.buff(i), i);
            this.drawIcon(buffIcon, xPos, y);
            this.drawActorBuffTurns(actor, i, xPos, y);
            this.drawActorBuffRates(actor, i, xPos, y);
            xPos += iconWidth;
        }
    }
    for (const state of actor.states().slice(0, maxStates)) {
        if (state.iconIndex > 0) {
            this.drawIcon(state.iconIndex, xPos, y);
            this.drawActorStateTurns(actor, state, xPos, y);
            this.drawActorStateData(actor, state, xPos, y);
            xPos += iconWidth;
        }
    }
};

var OldBattleStatusUpdate = Window_BattleStatus.prototype.update;
Window_BattleStatus.prototype.update = function() {
    OldBattleStatusUpdate.call(this);
    let yIcons = antilurkerIconYOffset;
    for (const actor of $gameParty.members()) {
        this.drawActorIconsEX(actor, antilurkerIconXOffset, yIcons, antilurkerIconMaxStates);
        yIcons += antilurkerIconRowHeight;
    }
}

This is the best I can come up with. The previous version was flooding an array called "_textColorStack" every time I drew an icon. It would quickly bloat to tens/hundreds of thousands of values and cause the performance issues. It's something from VS; I have no idea what it's actually used for but overwriting the "changeTextColor" function stops it from happening and doesn't seem to break anything from my brief testing.

I feel like I'm fundementally drawing icons the wrong way but I have no idea what the correct way would be. I would welcome any assistance with this.
Sorry if it's necro post (is 5 month necro posting?),

I just wrote a plugin like that (but providing different features), and the way I used to draw some pictures is to draw only one bitmap containing all states icons. And every update, I remove child and draw again, this way no flooding issues.

Original thread: https://forums.rpgmakerweb.com/threads/adding-more-state-icons-to-battle-screen-and-visustella.159762/