MV Trying to make MZ Style Window_Selectable for MV

I'm trying to make the MZ Button Style Interface for MV.
I am trying to replicate the interface style of Rpg Maker MZ, where Window_Selectable looks very good with tight buttons, being more friendly for a mobile conversion.

I noticed that in the MV, you create a Background behind each Rect, where that background will always be behind the information. I got good results in the Menu Interface in general.
Spoiler
1600881974889.png

1600882032445.png

1600882055782.png

However, in the Actors Status window in the Battle Scene , the background ends up over the information for some reason.
In the combat window the bug is more visible, as the background is alternating its position whenever it enters an actor's combat turn.
Spoiler
1600882133570.png
The changes I made were directly in Window Selectable, where I added and modified the following lines:
JavaScript:
Window_Selectable.prototype.drawAllItems = function() {
    var topIndex = this.topIndex();
    for (var i = 0; i < this.maxPageItems(); i++) {
        var index = topIndex + i;
        if (index < this.maxItems()) {
            this.drawItemBackground(index);
            this.drawItem(index);
        }
    }
};

Window_Selectable.prototype.drawItem = function(index) {
};

Window_Selectable.prototype.clearItem = function(index) {
    var rect = this.itemRect(index);
    this.contents.clearRect(rect.x, rect.y, rect.width, rect.height);

};

Window_Selectable.prototype.drawItemBackground = function(index) {
    var rect = this.itemRect(index);
    this.drawBackgroundRect(rect);
};

Window_Selectable.prototype.drawBackgroundRect = function(rect) {
    var c1 = 'ffffff';
    var c2 = '000000';
    var x = rect.x;
    var y = rect.y;
    var w = rect.width;
    var h = rect.height;
    this.contents.paintOpacity = 64;
    this.contents.fillRect(x+2, y+2, w-4, h-4, c1);
    this.contents.paintOpacity = 64;
    this.contents.fillRect(x+3, y+3, w-6, h-6, c2, c2, true);

};

Window_Selectable.prototype.redrawItem = function(index) {
    if (index >= 0) {
        this.clearItem(index);
        this.drawItemBackground(index);
        this.drawItem(index);
    }
};

Window_Selectable.prototype.redrawCurrentItem = function() {
    this.redrawItem(this.index());
};

Window_Selectable.prototype.refresh = function() {
    if (this.contents) {
        this.contents.clear();
        this.drawAllItems();
    }
};

What could this problem be? It remains even when I don't use any plugin.
This is the problem:
Code:
    this.contents.paintOpacity = 64;
    this.contents.fillRect(x+2, y+2, w-4, h-4, c1);
    this.contents.paintOpacity = 64;
    this.contents.fillRect(x+3, y+3, w-6, h-6, c2, c2, true);

You changed the paintOpacity to 64 and never changed it back.

The other menus just happened to call changePaintOpacity whenever they are doing their drawing and reset it to normal, but Window_BattleStatus (and Window_BattleActor and Window_BattleEnemy) simply don't.

So when they draw their text, they are drawing it with the same opacity you changed it to for drawing the background, which is 64.
This is the problem:
Code:
    this.contents.paintOpacity = 64;
    this.contents.fillRect(x+2, y+2, w-4, h-4, c1);
    this.contents.paintOpacity = 64;
    this.contents.fillRect(x+3, y+3, w-6, h-6, c2, c2, true);

You changed the paintOpacity to 64 and never changed it back.

The other menus just happened to call changePaintOpacity whenever they are doing their drawing and reset it to normal, but Window_BattleStatus (and Window_BattleActor and Window_BattleEnemy) simply don't.

So when they draw their text, they are drawing it with the same opacity you changed it to for drawing the background, which is 64.
Okay! I put a third line changing the opacity to 255 after the second concents.fillRect and resolve my problem! Thank You! <3

EDIT: How I put a condition to not show this background in the Battle Status Window?
They show and dissapear during the battle, causing a strange effect during command selection.
How I put a condition to not show this background in the Battle Status Window?
They show and dissapear during the battle, causing a strange effect during command selection.
I'm guessing you're using some other plugins as well, because I don't see any show/disappear or strange effects happening when testing with a fresh project, I cannot help you with that issue.

If you want your background not to show up in Window_BattleStatus or other specific windows, you will have to specifically make those windows NOT draw the background. Window_Selectable is their prototype, so by default they will automatically run all the code that is in Window_Selectable when they initialize.

So you would need to manually overwrite your background drawing functions again for every individual type of Window that uses Window_Selectable but that you don't want drawing the background.

EDIT: And of course, if you are using other plugins that modify BattleStatus and similar windows, you will need to check them and make sure your changes don't also overwrite whatever they are doing or that they don't overwrite yours, if you are getting "strange effects" happening due to your plugins, it is likely they are actually already doing this somewhere. Otherwise you shouldn't be getting some of your bars and numbers being drawn with full paint opacity like in your screenshot, I'm guessing from the thickness of the bars and your menu screens you're using Yanfly plugins which already make a lot of visual edits to the windows.

Original thread: https://forums.rpgmakerweb.com/threads/trying-to-make-mz-style-window_selectable-for-mv.127788/