Possible to Change Line Height?

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,116
Reaction score
808
First Language
English
Primarily Uses
RMMV
Hi, I'm wanted to know if it was possible to change the line height halfway into a window. Screenshot:
Sprite-0002.png
Notice how the last line on the bottom is cut off just a bit. If I could halve the line height of the 2 gray lines/dividers then that should be enough to get the last line into view. Here's the code for that window:
JavaScript:
Description_Window.prototype.refresh = function() {
    if (this.contents) {
        this.contents.clear();

        let fullW = this.windowWidth() - this.padding * 2;
        let w = (fullW - Window_Base._faceWidth) / 2;
        let line = 0;

        if (this._actor) {
            // Line 0.
            this.drawActorFace(this._actor, 0, this.lineHeight() * line, Window_Base._faceWidth, Window_Base._faceHeight);

            this.drawActorName(this._actor, Window_Base._faceWidth + this.spacing(), this.lineHeight() * line, w);
            this.drawActorLevel(this._actor, Window_Base._faceWidth + this.spacing() + w, this.lineHeight() * line++);

            // Line 1.
            this.drawActorClass(this._actor, Window_Base._faceWidth + this.spacing(), this.lineHeight() * line, w);
            this.drawActorFreePoints(this._actor, this._tree, Window_Base._faceWidth + this.spacing() + w, this.lineHeight() * line++, w);

            // Line 2.
            if (Yanfly.JP && !SkillTreesSystem.useJP())
                this.drawJP(this._actor, this._tree, Window_Base._faceWidth + this.spacing() + w, this.lineHeight() * line, w);

            line++;

            // Line 3.
            if (this._tree)
                this.drawActorTreePoints(this._actor, this._tree, Window_Base._faceWidth + this.spacing(), this.lineHeight() * line++, w * 2);

            // Line 4 is empty.
            this.drawLine(this.lineHeight() * line++);
        }

        if (this._skill) {
            // Line 5.
            var skill = this._skill.nextLevel();

            this.drawIcon(this._skill.iconId(), 0, this.lineHeight() * line);
            this.drawText(skill.name, Window_Base._iconWidth + this.spacing(), this.lineHeight() * line, this.windowWidth() - w - Window_Base._iconWidth - this.spacing());
            this.drawCastCost(skill, fullW - w, this.lineHeight() * line++);

            // Lines 6 and 7.
            this.drawTextEx(skill.description, 0, this.lineHeight() * line++);
            this.resetFontSettings();
            this.resetTextColor();
            line++;
            line++; //extra line added for longer skill descriptions

            // Lines 8, 9, 10.
            var reqs = this._skill.requirements();

            if (reqs) {
                this.drawLine(this.lineHeight() * line++);
                this.drawText(SkillTreesSystem.requirementsText(), 0, this.lineHeight() * line++);
                this.drawRequirements(reqs, this.lineHeight() * line++);
            }
        }
    }
};
This is @SomeFire's Skill Tree plugin btw.
 

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
1,418
Reaction score
671
First Language
Portuguese - Br
Primarily Uses
RMMV
Hi!
Try to add the following code in your plugin:
JavaScript:
Description_Window.prototype.lineHeight = function(){
    return 32;
};
I think the default value is 32... Not sure...
Anyway, you can change the number to your liking :)
 

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,116
Reaction score
808
First Language
English
Primarily Uses
RMMV
I'll try it, but wouldn't this simply change the line height for every line in the window? I only need the 2 lines with the long gray dividers to have smaller line height. I'll try it anyway though, thx.

Edit: Worked beautifully!
1594092549761.png
 
Last edited:

Solar_Flare

Veteran
Veteran
Joined
Jun 6, 2020
Messages
487
Reaction score
212
First Language
English
Primarily Uses
RMMV
Hmm... I think you could try adding line -= 0.5; just before the two calls to drawLine? I don't think there's any reason why the line count needs to be an integer...

I think the default value is 32... Not sure...
Isn't the default line height 36? Or maybe that's what you meant to say...
 

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,116
Reaction score
808
First Language
English
Primarily Uses
RMMV
Hmm... I think you could try adding line -= 0.5; just before the two calls to drawLine? I don't think there's any reason why the line count needs to be an integer...

Isn't the default line height 36? Or maybe that's what you meant to say...
That worked too! I'm glad the two of you offered different ways to solve this problem. I can probably utilize both techniques to fine-tune the look of this window. Thanks!:kaojoy:
 

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
1,418
Reaction score
671
First Language
Portuguese - Br
Primarily Uses
RMMV
I'll try it, but wouldn't this simply change the line height for every line in the window? I only need the 2 lines with the long gray dividers to have smaller line height. I'll try it anyway though, thx.

Edit: Worked beautifully!
View attachment 150391
No, this will change the line height only for this window.

Isn't the default line height 36? Or maybe that's what you meant to say...
Yes, exactly! I was not sure if it is really 32 or 34 or 36 xD

That worked too! I'm glad the two of you offered different ways to solve this problem. I can probably utilize both techniques to fine-tune the look of this window. Thanks!:kaojoy:
Glad it worked!
 

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

Latest Threads

Latest Profile Posts

Goal for MZ? None... I'm still curious how to finish my VXA project and how it looks like when it actually finished. Which will take at least another two years. Coming late again to the party.
Finding it amusing that people are posting support questions in new threads for an engine that isn't even released yet. Touch and Archeia are the only ones authorised to say anything, and there's only one active thread where they'll be answering questions.
I think my goal for MZ ... is to actually release a game and not have twenty technical demos and debugging projects. Let's see if I can manage that. ;o
I am starting to enjoy writing. I never thought I would enjoy it since my dyslexia was holding me back so much.
Thanks to the community here :)
For those interested chapter 2 and 3 are available to read here:
I'm having a fun time working with the MZ RTP. The waterfall hasn't changed, though, so I'm wondering if they didn't make a new one or if they forgot to put it in...

Forum statistics

Threads
100,652
Messages
978,094
Members
132,260
Latest member
enciasduras
Top