Possible to Change Line 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
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,709
Reaction score
1,127
First Language
Portuguese - Br
Primarily Uses
RMMZ
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,626
Reaction score
1,195
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
533
Reaction score
235
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,626
Reaction score
1,195
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,709
Reaction score
1,127
First Language
Portuguese - Br
Primarily Uses
RMMZ
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

Day 9 of giveaways! 8 prizes today :D
He mad, but he cute :kaopride:

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.

Forum statistics

Threads
106,038
Messages
1,018,466
Members
137,821
Latest member
Capterson
Top