じ☆ve冰风 发表于 2026-7-26 21:58:29

HP and MP numeric values resize

HP and MP Value Resize - 1.0
Kissá​

Introduction

Resizes the HP and MP numeric values in menus and battles apart from the default.

Features

- Changes the default font size of the game;

- Changes the HP and MP value's font size apart from the default;

- Changes the space between Current HP/MP and Max HP/MP.

History

So... I made it specifically for my game.

I have always find very cool having the HP and MP values bigger than the rest of the text shown in windows (who knows... Maybe there is someone somewhere else whith this same taste).

I failed at finding something like this on the internet (found just plugins that changes the size of the bars), then, I decided having a try doing it (I think it looked pretty nice with the custom font I am using).

It is, actually, my first attempt to write a plugin and my first time ever with coding.

Screenshots
Spoiler
https://i.imgur.com/9TqImJV.png


https://i.imgur.com/6kKXvRE.png


https://i.imgur.com/7jyV7Gw.png


https://i.imgur.com/asXW9P0.png


https://i.imgur.com/cOe39YE.png


https://i.imgur.com/3nzpfiN.png





How to Use

There are three parameters: fontsize for the default font size of the game (you imput a number), numbersize for the HP and MP values font size (you put a number), and numberwidth to change the space between max and current HP and MP values.

For this third one, you write more characters (usually zero's) to have more space (default is = '0000'), or less characters for less space.

Script
Spoiler                Code:       
//==============================================================================
// Kissá - HP and MP Value Resize
//==============================================================================
//------------------------------------------------------------------------------
// KSS_HPMPvalueResize.js
//------------------------------------------------------------------------------

// =============================================================================
/*:
*
* @plugindesc Changes HP and MP's values font size apart from the default game's
* size.
*
* @author Kissa
*
* @param fontsize
* @desc Changes the default font size of the game.
* default = 28
* @default 28
*
* @param numbersize
* @desc Changes the size of the HP and MP numeric values.
* default = 28
* @default 28
*
* @param numberwidth
* @desc Changes the space between max and current values of HP
* and MP. Add zeros for more space. Default = 0000
* @default '0000'
*
* @help
*
* Parameters ===================================================================
*
* font size = Changes the default font size of the game.
*
* numbersize = Changes only the HP and MP numeric value's font size in menus and
* battles.
*
* numberwidth = Changes the space between max and current values of HP and MP.
* Write more zeros to have more space between current and max values
* (or less space with less zeros).
*
* Terms of use ==================================================================
*
* I made it for my game, I thought that something like this would work well
* for the font I am using in my project (and it really did, that's why this plugin
* is something so specific), but you are free to use it in a non comercial or
* comercial game.
*
*/

(function() {

// Variables ====================================================================================

    var parameters = PluginManager.parameters('KSS_HPMPvalueResize');

    var fontsize = Number(parameters['fontsize']);
    var numbersize = Number(parameters['numbersize']);
    var numberwidth = parameters['numberwidth'];

// Game font size ===============================================================================

    Window_Base.prototype.standardFontSize = function() {
            return fontsize;
    };

// HP and MP numbers font size and width ========================================================

    Window_Base.prototype.drawCurrentAndMax = function(current, max, x, y,
                                                   width, color1, color2) {
          var labelWidth = this.textWidth('HP');
            var valueWidth = this.textWidth(numberwidth);
            var slashWidth = this.textWidth('/');
            var x1 = x + width - valueWidth;
            var x2 = x1 - slashWidth;
            var x3 = x2 - valueWidth;
      this.contents.fontSize = numbersize
            if (x3 >= x + labelWidth) {
            this.changeTextColor(color1);
            this.drawText(current, x3, y, valueWidth, 'right');
            this.changeTextColor(color2);
            this.drawText('/', x2, y, slashWidth, 'right');
            this.drawText(max, x1, y, valueWidth, 'right');
            } else {
            this.changeTextColor(color1);
            this.drawText(current, x1, y, valueWidth, 'right');
            }
    };


// MP text font size ============================================================================

    Window_Base.prototype.drawActorHp = function(actor, x, y, width) {
            width = width || 186;
            var color1 = this.hpGaugeColor1();
            var color2 = this.hpGaugeColor2();
            this.drawGauge(x, y, width, actor.hpRate(), color1, color2);
            this.changeTextColor(this.systemColor());
            this.drawText(TextManager.hpA, x, y, 44);
            this.drawCurrentAndMax(actor.hp, actor.mhp, x, y, width,
                  this.hpColor(actor), this.normalColor());
      this.contents.fontSize = fontsize;
    };

// HP and actor text font size ==================================================================

    Window_Base.prototype.drawActorMp = function(actor, x, y, width) {
            width = width || 186;
            var color1 = this.mpGaugeColor1();
            var color2 = this.mpGaugeColor2();
            this.drawGauge(x, y, width, actor.mpRate(), color1, color2);
            this.changeTextColor(this.systemColor());
          this.drawText(TextManager.mpA, x, y, 44);
          this.drawCurrentAndMax(actor.mp, actor.mmp, x, y, width,
                           this.mpColor(actor), this.normalColor());
      this.contents.fontSize = fontsize;
    };

})();






Terms of use

Free to use in comercial or non-comercial games.


本贴来自国际rpgmaker官方论坛作者:Kissa处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/hp-and-mp-numeric-values-resize.103609/
页: [1]
查看完整版本: HP and MP numeric values resize