Possible to Change Line Height?

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,116
Reaction score
809
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,419
Reaction score
673
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
809
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
493
Reaction score
216
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
809
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,419
Reaction score
673
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

And back. Trying to work online with no internet for 1.5 days was...interesting. I felt like a character in a old Sierra game trying to find internet due to all the hoops I had to jump through just to get online for work.
grief... if MV didn't have certain plugins already, I think I'd upgrade to MZ. seeing like 10 MV plugins in 1 MZ one is hilariously convenient lol.
Have you already checkes out my mapping tutorial on the blog? I would love to hear your feedback and things you'd like to see in the future!

one of character for my upcoming game idk how to design o_O

Designing patches that can 'augmented' to clothing based armor. Such good fun. A bit time consuming due to the need to create image displays, but the patches are limited so it's not too tiring.
Note: lol, posting this made me find a couple mistakes.

Forum statistics

Threads
100,736
Messages
978,940
Members
132,359
Latest member
PhilKeepItReal
Top