Possible to Change Line Height?

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,116
Reaction score
813
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,552
Reaction score
887
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
813
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
525
Reaction score
230
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
813
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,552
Reaction score
887
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 Posts

Latest Profile Posts

trying to wrap up the boat/ship/castaway tilesets with a great galleon - no promises
Mail from campus: we will have the lessons this semester not remote, if possible. All my my profs: Remote it is.
https://gyazo.com/5a19cfce090a2585b3c0fcb7c699b92c Just finished a stealth system, its not metal gear solid level though, maybe elder scrolls level, it just works.
I ain't dead btw, just trying to keep up with university :)

Forum statistics

Threads
103,104
Messages
997,318
Members
134,573
Latest member
MrUnanamed
Top