Help Window Height

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,626
Reaction score
1,195
First Language
English
Primarily Uses
RMMV
So I'm trying to reduce the amount of line for the help window from 2 down to 1 in certain scenes. I previously just edited rpg_windows.js directly but that affects all scenes. So this time around I'm editing specific scenes like the equip screen for instance. Here is the snippet in YEP_EquipCore.js for the equip scene.
JavaScript:
Scene_Equip.prototype.create = function() {
    Scene_MenuBase.prototype.create.call(this);
    this.createHelpWindow();
    this.createCommandWindow();
    this.createStatusWindow();
    this.createSlotWindow();
    this.createItemWindow();
    this.createCompareWindow();
    this._lowerRightVisibility = true;
    this.updateLowerRightWindows();
    this.refreshActor();
};
I tried changing this.createHelpWindow(); to this.createHelpWindow(this, 0, 0, Graphics.boxWidth, this.fittingHeight(1)); but I got TypeError: "this.fittingHeight is not a function". The same happens when I try _fittingHeight(1) as well (I'm basically just guessing at this point). Can anyone help me with the correct syntax?

Edit: I've also tried something as simple as this.createHelpWindow(1); but that had no effect.

Edit2: I've tried the following as well, but got a TypeError: "cannot read property 'fittingHeight' of undefined".
this._helpWindow.height = this._helpWindow.fittingHeight(1);
this.createHelpWindow();

or
this._helpWindow.fittingHeight() = 1;
this.createHelpWindow();
 
Last edited:

SeaPhoenix

Veteran
Veteran
Joined
May 14, 2015
Messages
252
Reaction score
233
First Language
English
Primarily Uses
RMMV
I don't have YEP_EquipCore.js to test with, but Scene_Equip is based on Scene_MenuBase, which has the createHelpWindow function. You can try adding the following code in a new plugin - it's just a modification of the function from Scene_MenuBase that specifies the height of the help window (the 1 in the parentheses, in terms of lines) for Scene_Equip. (Scene_File does pretty much the same thing.)

Code:
Scene_Equip.prototype.createHelpWindow = function() {
    this._helpWindow = new Window_Help(1);
    this.addWindow(this._helpWindow);
};
 

Mewgles

Veteran
Veteran
Joined
Jul 24, 2020
Messages
85
Reaction score
89
First Language
German
Primarily Uses
RMMZ
JavaScript:
Window_Help.prototype.initialize = function(numLines) {
    var width = Graphics.boxWidth;
    var height = this.fittingHeight(numLines || 2);
    Window_Base.prototype.initialize.call(this, 0, 0, width, height);
    this._text = '';
};
This is probably what you're looking for. The line var height = this.fittingHeight(numLines || 2); should deal with this.
EDIT:
Deleted the last sentence of the original post due to brainfart..Really shouldn't stay up for 3 days straight ^^"
Anyways. You can pass the ammount of lines on creation, otherwise it will take a default of 2.
 
Last edited:

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
2,604
Reaction score
1,961
First Language
English
Primarily Uses
RMMV
Just to explain why what you tried didn't work:

createHelpWindow is a function defined in the scene class, and its signature doesn't take any parameters, so trying to pass parameters to it like you were doing wouldn't work; the engine wouldn't know what to do with them.

Also, fittingHeight is a function of windows, not scenes.
 

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,626
Reaction score
1,195
First Language
English
Primarily Uses
RMMV
JavaScript:
Window_Help.prototype.initialize = function(numLines) {
    var width = Graphics.boxWidth;
    var height = this.fittingHeight(numLines || 2);
    Window_Base.prototype.initialize.call(this, 0, 0, width, height);
    this._text = '';
};
This is probably what you're looking for. The line var height = this.fittingHeight(numLines || 2); should deal with this.
EDIT:
Deleted the last sentence of the original post due to brainfart..Really shouldn't stay up for 3 days straight ^^"
Anyways. You can pass the ammount of lines on creation, otherwise it will take a default of 2.
This was actually what I edited in the beginning, but like I said, editing this in rpg_windows.js would affect all scenes. This method is actually what I'm using currently until I figure out the solution to my OP.

I don't have YEP_EquipCore.js to test with, but Scene_Equip is based on Scene_MenuBase, which has the createHelpWindow function. You can try adding the following code in a new plugin - it's just a modification of the function from Scene_MenuBase that specifies the height of the help window (the 1 in the parentheses, in terms of lines) for Scene_Equip. (Scene_File does pretty much the same thing.)

Code:
Scene_Equip.prototype.createHelpWindow = function() {
    this._helpWindow = new Window_Help(1);
    this.addWindow(this._helpWindow);
};
Eureka! Thank you!!
 

Solar_Flare

Veteran
Veteran
Joined
Jun 6, 2020
Messages
533
Reaction score
235
First Language
English
Primarily Uses
RMMV
Edit2: I've tried the following as well, but got a TypeError: "cannot read property 'fittingHeight' of undefined".
this._helpWindow.height = this._helpWindow.fittingHeight(1);
this.createHelpWindow();

or
this._helpWindow.fittingHeight() = 1;
this.createHelpWindow();
Just noting that these examples would probably work if you swapped the order of the lines - this._helpWindow only exists after you've called this.createHelpWindow().
This was actually what I edited in the beginning, but like I said, editing this in rpg_windows.js would affect all scenes. This method is actually what I'm using currently until I figure out the solution to my OP.
It looks the particular edit that Mewgles posted doesn't actually change the number of lines but rather makes the window take the number of lines as an extra parameter.
 

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,626
Reaction score
1,195
First Language
English
Primarily Uses
RMMV
Just noting that these examples would probably work if you swapped the order of the lines - this._helpWindow only exists after you've called this.createHelpWindow().
Hmm, not sure if I should try it or not. @SeaPhoenix's solution is working beautifully.

It looks the particular edit that Mewgles posted doesn't actually change the number of lines but rather makes the window take the number of lines as an extra parameter.
@Mewgles's post is actually unedited, it exactly what's written in rpg_windows.js.
 

Solar_Flare

Veteran
Veteran
Joined
Jun 6, 2020
Messages
533
Reaction score
235
First Language
English
Primarily Uses
RMMV
Ah, fair enough, I didn't look at the file myself.
 

Mewgles

Veteran
Veteran
Joined
Jul 24, 2020
Messages
85
Reaction score
89
First Language
German
Primarily Uses
RMMZ
@Mewgles's post is actually unedited, it exactly what's written in rpg_windows.js.
My post is edited. I stated I removed a >Sentence< not something int the code. And it now actually points at the solution SeaPhoenix posted just 1 minute before me. Just didn't want to make it look like it was copied. What the code says is that you can set the ammount of lines on creation by handing it over to the function.

Window_Help.prototype.initialize = function(numLines) <- Indicates that you can hand over the parameter 'numLines' when calling the function.

var height = this.fittingHeight(numLines || 2); <- Shows how the function deals with the parameter 'numLines'.

Anyways. You can pass the ammount of lines on creation, otherwise it will take a default of 2.
States just that in my edit. I hope it's more clear now. Sorry for eventual confusion.
 

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,626
Reaction score
1,195
First Language
English
Primarily Uses
RMMV
Window_Help.prototype.initialize = function(numLines) <- Indicates that you can hand over the parameter 'numLines' when calling the function.

var height = this.fittingHeight(numLines || 2); <- Shows how the function deals with the parameter 'numLines'.
Exactly, that's what I was thinking too! But I guess I wasn't doing it correctly. What would be the correct syntax to have it use 1 line instead of 2 upon creation?
 

Mewgles

Veteran
Veteran
Joined
Jul 24, 2020
Messages
85
Reaction score
89
First Language
German
Primarily Uses
RMMZ
Exactly, that's what I was thinking too! But I guess I wasn't doing it correctly. What would be the correct syntax to have it use 1 line instead of 2 upon creation?
The following Edits should work. Probably not the best solution, but it shouldn't cause any errors.
JavaScript:
Scene_MenuBase.prototype.createHelpWindow = function(numLines) {
    this._helpWindow = new Window_Help(numLines);
    this.addWindow(this._helpWindow);
};

Scene_Equip.prototype.create = function() {
    Scene_MenuBase.prototype.create.call(this);
    this.createHelpWindow(1);
    this.createStatusWindow();
    this.createCommandWindow();
    this.createSlotWindow();
    this.createItemWindow();
    this.refreshActor();
};
The change in Scene_MenuBase makes sure to hand the numLines down to the original function so you can just set them with this.createHelpWindow(numLines); whenever you set up a new help window. Keeping the bracket empty will default back to 2 lines since that's already given in the original function.
 

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,626
Reaction score
1,195
First Language
English
Primarily Uses
RMMV
@Mewgles Ah I c, that's essentially the solution @SeaPhoenix provided. It's reassuring the solutions are the same actually, I feel more confident it's the correct way to go, thx. The only difference I see is the use of Scene_MenuBase instead of Scene_Equip. What impact would this difference make?
 

Mewgles

Veteran
Veteran
Joined
Jul 24, 2020
Messages
85
Reaction score
89
First Language
German
Primarily Uses
RMMZ
@Mewgles Ah I c, that's essentially the solution @SeaPhoenix provided. It's reassuring the solutions are the same actually, I feel more confident it's the correct way to go, thx. The only difference I see is the use of Scene_MenuBase instead of Scene_Equip. What impact would this difference make?
Both ways should work. The solution SeaPhoenix posted fixes your issue for just the Scene_Equip while my workaround will also let you change the line numbers on other functions where the window creation is done via a third function instead of directly.
It's basically up to you what you use. If it's just a one-time thing, go for the one SeaPhoenix posted since it does less overall changes. If you might need it for other situations too, go for my version.
The goal should always be to make as little changes as possible while achieving exactly what you're looking for.

I hope that made any sense ^^"
 

Solar_Flare

Veteran
Veteran
Joined
Jun 6, 2020
Messages
533
Reaction score
235
First Language
English
Primarily Uses
RMMV
The following Edits should work. Probably not the best solution, but it shouldn't cause any errors.
JavaScript:
Scene_MenuBase.prototype.createHelpWindow = function(numLines) {
    this._helpWindow = new Window_Help(numLines);
    this.addWindow(this._helpWindow);
};

Scene_Equip.prototype.create = function() {
    Scene_MenuBase.prototype.create.call(this);
    this.createHelpWindow(1);
    this.createStatusWindow();
    this.createCommandWindow();
    this.createSlotWindow();
    this.createItemWindow();
    this.refreshActor();
};
Suggestion: Change the first line to:

JavaScript:
Scene_MenuBase.prototype.createHelpWindow = function(numLines = 2) {
That way you don't have to find all other calls to this.createHelpWindow and add a 2 to them.
 

Mewgles

Veteran
Veteran
Joined
Jul 24, 2020
Messages
85
Reaction score
89
First Language
German
Primarily Uses
RMMZ
Suggestion: Change the first line to:

JavaScript:
Scene_MenuBase.prototype.createHelpWindow = function(numLines = 2) {
That way you don't have to find all other calls to this.createHelpWindow and add a 2 to them.
It's literally pointless to do that. It would not just directly interfere with what was requested in this thread but only really change it to never allow anything other than 2 lines.

If you don't set a number for numLines it will default to 2 lines anyways as the Window_Help.prototype.initialize already does that.

JavaScript:
Window_Help.prototype.initialize = function(numLines) {
    var width = Graphics.boxWidth;
    var height = this.fittingHeight(numLines || 2);
    Window_Base.prototype.initialize.call(this, 0, 0, width, height);
    this._text = '';
};
The line >var height = this.fittingHeight(numLines || 2);< already declares that it takes numLines as indicator for its height OR 2 if numLines doesn't have a value, which I explained in the post you quoted.
 

Solar_Flare

Veteran
Veteran
Joined
Jun 6, 2020
Messages
533
Reaction score
235
First Language
English
Primarily Uses
RMMV
It's literally pointless to do that. It would not just directly interfere with what was requested in this thread but only really change it to never allow anything other than 2 lines.
While it is pointless given the rest of your post, it would not hurt anything. It does pretty much exactly the same thing as the Window_Help.prototype.initialize function you posted, which makes it pointless but harmless.

Still, I retract my suggestion, given that it doesn't have any effect after all.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!
one bad plugin combo later and one of my followers is moonwalking off the screen on his own... I didn't even more yet on the new map lol.

Forum statistics

Threads
106,034
Messages
1,018,446
Members
137,820
Latest member
georg09byron
Top