MZ How to add window to the battle screen.

I'm not sure why it's not appearing in game like the other windows(partyCommand, ActorCommand and the StatusWindow (character faces, names, hp/mp/tp, etc), despite writing the methods in an almost identical way. I suspect it has to do with the windows not actually being added, though the createxxxWindow() would suggest otherwise. I know how to move, resize, add rows, columns, etc existing windows. According to Scene_Base, these are added to the scene via addChild() method (inside addWindow()).



Spoiler
JavaScript:
const _Scene_Battle_ = Scene_Battle.prototype.createAllWindows;

Scene_Battle.prototype.createAllWindows = function() {
    _Scene_Battle_.apply(this, arguments);
    this.createScanWindow();
};
   

Scene_Battle.prototype.createScanWindow = function() {
    const rect = this.scanWindowRect();
    const scanWindow = new Window_BattleStatus(rect);
    this.addWindow(scanWindow);
    this._scanWindow = scanWindow;
};

Scene_Battle.prototype.scanWindowRect = function() {
    const ww = 192
    const wh = this.windowAreaHeight();
    const wx = 0;
    const wy = Graphics.boxHeight - 100;
    return new Rectangle(wx, wy, ww, wh);
};
It's OK, the window is there, it just needs to be opened: Window_BattleStatus starts closed.

To make the scan window start in an open state, you can add this line to the end of your createScanWindow method:
JavaScript:
    this._scanWindow.open();
The usual status window is opened/closed via the updateStatusWindowVisibility method of Scene_Battle.
Thank you, that took care of the problem.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-add-window-to-the-battle-screen.139610/