MV Need Help With Custom Battle Window

Hi guys,

I have a custom battle window setup to look like this:
Screenshot 2025-07-17 090316.png

It's designed to work with and without the YEP ATB plugin. I'm experiencing some issues with the setup I have, though. First, if there are less than 4 party members, the selection overlay gets really stretched like this:
Screenshot 2025-07-16 105624.png


Second, after playing some animations, the character portraits temporarily disappear:
Screenshot 2025-07-17 090819.png


If possible, I'd like some help fixing these issues and making the window look a little neater. Thanks!
Here's what I've got for the height and width of my custom window:
JavaScript:
Window_BattleStatus.prototype.numVisibleRows = function() {
    return 1;
};

Window_BattleStatus.prototype.maxCols = function () {
    // the maximum amount of columns is the number of members in the party      
    return $gameParty.battleMembers().length;
};

Window_BattleStatus.prototype.windowHeight = function() {
    return this.fittingHeight(this.numVisibleRows()) + 212;
};

Window_BattleStatus.prototype.itemHeight = function () {
    // the height of each item is the height of the battle status window minus from padding so it looks nicer      
    return Math.floor((this.height - this.padding * 2 + this.spacing()) / 1 - this.spacing());
};  

Window_Selectable.prototype.itemWidth = function() {
    return Math.floor((this.width - this.padding * 2 + this.spacing()) / this.maxCols() - this.spacing());
};

And here's my drawBasicArea function:
JavaScript:
Window_BattleStatus.prototype.drawBasicArea = function(rect, actor) {
    this.drawActorFace(actor, rect.x + (rect.width) / 2, rect.y + 30);
    this.drawActorName(actor, rect.x + (rect.width) / 2, rect.y, 150);
    this.drawActorIcons(actor, rect.x + 124 + (rect.width) / 2, rect.y, rect.width - 156);
};

Please let me know how I can fix/improve this!
Don't know about the animations making the portraits disappear, but I think you should change how it checks the item width on Window_BattleStatus. I think your maxCols should return like maxBattleMembers() and then maybe you also need to change that padding/spacing s*** a bit, don't know.
Don't know about the animations making the portraits disappear, but I think you should change how it checks the item width on Window_BattleStatus. I think your maxCols should return like maxBattleMembers() and then maybe you also need to change that padding/spacing s*** a bit, don't know.
My maxCols function already does that, and I've been fiddling with the draw functions to adjust the padding and spacing. It looks a little closer to what I want, but some stuff gets cut off by the box to the right of each box, and the selection highlight overlaps as well.

Screenshot 2025-07-22 103501.png

Screenshot 2025-07-22 104301.png

Here's what I changed for the height and width functions:
JavaScript:
Window_BattleStatus.prototype.maxCols = function () {
    // the maximum amount of columns is the number of members in the party       
    return $gameParty.battleMembers().length;
};

Window_BattleStatus.prototype.windowHeight = function() {
    return this.fittingHeight(this.numVisibleRows()) + 190;
};

Window_BattleStatus.prototype.windowWidth = function() {
    return Graphics.boxWidth - (400 * (5 - this.maxCols()));
};

Window_BattleStatus.prototype.itemHeight = function () {
    // the height of each item is the height of the battle status window minus from padding so it looks nicer       
    return Math.floor((this.height - this.padding * 2 + this.spacing()) / 1 - this.spacing());
};   

Window_BattleStatus.prototype.itemWidth = function() {
    return Math.floor((this.width - this.padding * 8) / this.maxCols());
};

And the draw functions:
JavaScript:
Window_BattleStatus.prototype.drawBasicArea = function(rect, actor) {
    this.drawActorFace(actor, rect.x + (rect.width) / 4, rect.y + 20);
    this.drawActorName(actor, rect.x + (rect.width) / 4, rect.y, 150);
    this.drawActorIcons(actor, rect.x + 124 + (rect.width) / 4, rect.y, rect.width - 156);
};

Window_BattleStatus.prototype.drawGaugeAreaWithTp = function(rect, actor) {
    if (Imported.YEP_X_BattleSysATB && !this.isATBGaugeStyle(0)) { 
        this.drawActorHp(actor, rect.x + (rect.width) / 4, rect.y + 148, this.gaugeAreaWidth());
        this.drawActorMp(actor, rect.x + (rect.width) / 4 , rect.y + 164, this.gaugeAreaWidth() / 2);
        this.drawActorTp(actor, rect.x + (rect.width) / 4 + 78, rect.y + 164, this.gaugeAreaWidth() / 2);
        this.drawActorAtbGauge(actor, rect.x + (rect.width) / 4, rect.y + 180, this.gaugeAreaWidth());
    }
    else{
        this.drawActorHp(actor, rect.x + (rect.width) / 4, rect.y + 148, this.gaugeAreaWidth());
        this.drawActorMp(actor, rect.x + (rect.width) / 4, rect.y + 164, this.gaugeAreaWidth() / 2);
        this.drawActorTp(actor, rect.x + (rect.width) / 4 + 78, rect.y + 164, this.gaugeAreaWidth() / 2);
    }

};

Original thread: https://forums.rpgmakerweb.com/threads/need-help-with-custom-battle-window.178984/