MV Increase number of lines for help window in battle?

Hey all,

I found this tidbit of code from a Google search:

JavaScript:
Window_Help.prototype.initialize = function(numLines) {
    var width = Graphics.boxWidth;
    var height = this.fittingHeight(numLines || 2);
    var height = this.fittingHeight(6);//six lines
    Window_Base.prototype.initialize.call(this, 0, 0, width, height);
    this._text = '';
};
Window_Help.prototype.setText = function(text) {
    if (this._text !== text) {
        this._text = text.replace(/\\nn/g,"\n");
        this.refresh();
    }
};

// by mogwai on the forums

The problem is that it affects EVERY help window in the game and ruins how I've resized a lot of scenes. If I could get this to ONLY work in the battle scene (and the Skill menu while I'm at it), it would be perfect. I tried adding Scene_Battle but that just broke the whole thing.
the help window's initialization function accepts input for the number of lines. instead of messing with the actual definitions for the help window, change the battle scene's call for it
Code:
Scene_Battle.prototype.createHelpWindow = function() {
    this._helpWindow = new Window_Help(6);
    this._helpWindow.visible = false;
    this.addWindow(this._helpWindow);
};

edit: didnt notice the skill scene mention, but its the same idea except you dont start the window invisible
JavaScript:
Window_Help.prototype.initialize = function(numLines) {
    var width = Graphics.boxWidth;
if (SceneManager._scene instanceof Scene_Battle || SceneManager._scene instanceof Scene_Skill) {
    var height = this.fittingHeight(6)
} else {
    var height = this.fittingHeight(numLines|| 2);
}
    Window_Base.prototype.initialize.call(this, 0, 0, width, height);
    this._text = '';
};

Window_Help.prototype.setText = function(text) {
    if (this._text !== text) {
        this._text = text.replace(/\\nn/g,"\n");
        this.refresh();
    }
};
@Robro33 Ah, unfortunately there is some sort of conflict with one of my plugins:

JavaScript:
TypeError: Cannot read property 'createNewSprites' of undefined
    at Function.BattleManager.makeActionOrders (Olivia_BattleSysOTB.js:909)
    at Function.BattleManager.startTurn (YEP_BattleEngineCore.js:1850)
    at Function.BattleManager.startTurn (Olivia_BattleSysOTB.js:616)
    at Function.BattleManager.startInput (Olivia_BattleSysOTB.js:607)
    at Function.BattleManager.startInput (YEP_BattleStatusWindow.js:243)
    at Function.BattleManager.update (YEP_BattleEngineCore.js:1898)
    at Scene_Battle.updateBattleProcess (rpg_scenes.js:2265)
    at Scene_Battle.update (rpg_scenes.js:2257)
    at Scene_Battle.update (YEP_CoreEngine.js:1431)
    at Scene_Battle.update (MOG_BattleHud.js:2449)

@ShadowDragon This one seems to be working! I'll have to test everything more but looks good, thanks!


EDIT: Found an issue in some of the other windows. But the solution is simple:

JavaScript:
Window_Help.prototype.initialize = function(numLines) {
    var width = Graphics.boxWidth;
if (SceneManager._scene instanceof Scene_Battle || SceneManager._scene instanceof Scene_Skill) {
    var height = this.fittingHeight(6)
} else {
    var height = this.fittingHeight(numLines|| 2); //the L in numLines needed to be capitalized
}
    Window_Base.prototype.initialize.call(this, 0, 0, width, height);
    this._text = '';
};
Window_Help.prototype.setText = function(text) {
    if (this._text !== text) {
        this._text = text.replace(/\\nn/g,"\n");
        this.refresh();
    }
};
my bad missing the L bit, as I correct it just in case someone don't look further.

nice catch.

correctly heights can sometimes be modified inside a plugin as well.
I took a simple but could be simplified too which might work

JavaScript:
Window_Help.prototype.initialize = function(numLines) {
    var width = Graphics.boxWidth;
var scene = SceneManager._scene instanceof Scene_Battle || SceneManager._scene instanceof Scene_Skill);
    var height = scene ? this.fittingHeight(6) : this.fittingHeight(numLines|| 2);
    Window_Base.prototype.initialize.call(this, 0, 0, width, height);
    this._text = '';
};

Window_Help.prototype.setText = function(text) {
    if (this._text !== text) {
        this._text = text.replace(/\\nn/g,"\n");
        this.refresh();
    }
};

this needs to be tested, but a slightly cleaner.

Original thread: https://forums.rpgmakerweb.com/threads/increase-number-of-lines-for-help-window-in-battle.172534/