MZ Visustella - Display HP MP TP text as Icons

StatIcon.png


Plugins Required:
http://www.yanfly.moe/wiki/Core_Engine_VisuStella_MZ
http://www.yanfly.moe/wiki/Skills_and_States_Core_VisuStella_MZ

Spoiler: I'm clever, give me the code!
Spoiler: Making Status HP
Plugin Manager > VisuMZ_1_SkillsStatesCore > Skill Cost Types
ParameterStart.png

Scroll all the way down to JS: Draw Gauge.
Replace code with:
Spoiler: HP Code
Code:
// Declare Settings
const icon = 32;
const color1 = ColorManager.hpGaugeColor1();
const color2 = ColorManager.hpGaugeColor2();

// Declare Variables
const sprite = this;
const settings = sprite._costSettings;
const bitmap = sprite.bitmap;
const user = sprite._battler;
const currentValue = sprite.currentDisplayedValue();
const bitmapWidth = sprite.bitmapWidth();
const bitmapHeight = sprite.textHeight ? sprite.textHeight() : sprite.bitmapHeight();
const gaugeHeight = sprite.gaugeHeight();

// Draw Gauge
const gx = 0;
const gy = bitmapHeight - gaugeHeight;
const gw = bitmapWidth - gx;
const gh = gaugeHeight;
this.drawFullGauge(color1, color2, gx, gy, gw, gh);

// Draw Icon
const iconBitmap = ImageManager.loadSystem("IconSet");
const iw = ImageManager.iconWidth;
const ih = ImageManager.iconHeight;
const ix = (icon % 16) * iw;
const iy = Math.floor(icon / 16) * ih;
bitmap.blt(iconBitmap, ix, iy, iw, ih, 0, 0, 24, 24);

// Draw Value
const vw = bitmapWidth - 2;
const vh = bitmapHeight;
sprite.setupValueFont();
bitmap.textColor = ColorManager.hpColor(user);
bitmap.drawText(currentValue, 0, 0, vw, vh, "right");
The first line "const icon =32;
change this to the icon number you want.

Spoiler: Making Status MP
Plugin Manager > VisuMZ_1_SkillsStatesCore > Skill Cost Types
Scroll all the way down to JS: Draw Gauge.
Replace code with:
Spoiler: MP Code
Code:
// Declare Settings
const icon = 33;
const color1 = ColorManager.mpGaugeColor1();
const color2 = ColorManager.mpGaugeColor2();

// Declare Variables
const sprite = this;
const settings = sprite._costSettings;
const bitmap = sprite.bitmap;
const user = sprite._battler;
const currentValue = sprite.currentDisplayedValue();
const bitmapWidth = sprite.bitmapWidth();
const bitmapHeight = sprite.textHeight ? sprite.textHeight() : sprite.bitmapHeight();
const gaugeHeight = sprite.gaugeHeight();

// Draw Gauge
const gx = 0;
const gy = bitmapHeight - gaugeHeight;
const gw = bitmapWidth - gx;
const gh = gaugeHeight;
this.drawFullGauge(color1, color2, gx, gy, gw, gh);

// Draw Icon
const iconBitmap = ImageManager.loadSystem("IconSet");
const iw = ImageManager.iconWidth;
const ih = ImageManager.iconHeight;
const ix = (icon % 16) * iw;
const iy = Math.floor(icon / 16) * ih;
bitmap.blt(iconBitmap, ix, iy, iw, ih, 0, 0, 24, 24);

// Draw Value
const vw = bitmapWidth - 2;
const vh = bitmapHeight;
sprite.setupValueFont();
bitmap.textColor = ColorManager.mpColor(user);
bitmap.drawText(currentValue, 0, 0, vw, vh, "right");
The first line "const icon =33;
change this to the icon number you want.

Spoiler: Making Status TP
Plugin Manager > VisuMZ_1_SkillsStatesCore > Skill Cost Types
Scroll all the way down to JS: Draw Gauge.
Replace code with:
Spoiler: TP Code
Code:
// Declare Settings
const icon = 87;
const color1 = ColorManager.tpGaugeColor1();
const color2 = ColorManager.tpGaugeColor2();

// Declare Variables
const sprite = this;
const settings = sprite._costSettings;
const bitmap = sprite.bitmap;
const user = sprite._battler;
const currentValue = sprite.currentDisplayedValue();
const bitmapWidth = sprite.bitmapWidth();
const bitmapHeight = sprite.textHeight ? sprite.textHeight() : sprite.bitmapHeight();
const gaugeHeight = sprite.gaugeHeight();

// Draw Gauge
const gx = 0;
const gy = bitmapHeight - gaugeHeight;
const gw = bitmapWidth - gx;
const gh = gaugeHeight;
this.drawFullGauge(color1, color2, gx, gy, gw, gh);

// Draw Icon
const iconBitmap = ImageManager.loadSystem("IconSet");
const iw = ImageManager.iconWidth;
const ih = ImageManager.iconHeight;
const ix = (icon % 16) * iw;
const iy = Math.floor(icon / 16) * ih;
bitmap.blt(iconBitmap, ix, iy, iw, ih, 0, 0, 24, 24);

// Draw Value
const vw = bitmapWidth - 2;
const vh = bitmapHeight;
sprite.setupValueFont();
bitmap.textColor = ColorManager.tpColor(user);
bitmap.drawText(currentValue, 0, 0, vw, vh, "right");
The first line "const icon =87;
change this to the icon number you want.
Complete.png


Spoiler: Extra Icon Option
Replace const icon = x
with const icon = $gameVariables.value(x);
to change icons at any time(be sure to use a different variable for each stat)


Spoiler: I'm not confidant; I want to learn more.
Spoiler: Making Status HP
Plugin Manager > VisuMZ_1_SkillsStatesCore > Skill Cost Types
ParameterStart.png

Copy line 1 "HP" and paste it at the bottom.
Open the pasted version.
Change the name as to identify/call (using HPi for this example).
Scroll all the way down to JS: Draw Gauge.
Replace code with:
Spoiler: HP Code
Code:
// Declare Settings
const icon = 32;
const color1 = ColorManager.hpGaugeColor1();
const color2 = ColorManager.hpGaugeColor2();

// Declare Variables
const sprite = this;
const settings = sprite._costSettings;
const bitmap = sprite.bitmap;
const user = sprite._battler;
const currentValue = sprite.currentDisplayedValue();
const bitmapWidth = sprite.bitmapWidth();
const bitmapHeight = sprite.textHeight ? sprite.textHeight() : sprite.bitmapHeight();
const gaugeHeight = sprite.gaugeHeight();

// Draw Gauge
const gx = 0;
const gy = bitmapHeight - gaugeHeight;
const gw = bitmapWidth - gx;
const gh = gaugeHeight;
this.drawFullGauge(color1, color2, gx, gy, gw, gh);

// Draw Icon
const iconBitmap = ImageManager.loadSystem("IconSet");
const iw = ImageManager.iconWidth;
const ih = ImageManager.iconHeight;
const ix = (icon % 16) * iw;
const iy = Math.floor(icon / 16) * ih;
bitmap.blt(iconBitmap, ix, iy, iw, ih, 0, 0, 24, 24);

// Draw Value
const vw = bitmapWidth - 2;
const vh = bitmapHeight;
sprite.setupValueFont();
bitmap.textColor = ColorManager.hpColor(user);
bitmap.drawText(currentValue, 0, 0, vw, vh, "right");
The first line "const icon =32;
change this to the icon number you want.

Spoiler: Making Status MP
Plugin Manager > VisuMZ_1_SkillsStatesCore > Skill Cost Types
Copy line 2 "MP" and paste it at the bottom.
Open the pasted version.
Change the name as to identify/call (using MPi for this example).
Scroll all the way down to JS: Draw Gauge.
Replace code with:
Spoiler: MP Code
Code:
// Declare Settings
const icon = 33;
const color1 = ColorManager.mpGaugeColor1();
const color2 = ColorManager.mpGaugeColor2();

// Declare Variables
const sprite = this;
const settings = sprite._costSettings;
const bitmap = sprite.bitmap;
const user = sprite._battler;
const currentValue = sprite.currentDisplayedValue();
const bitmapWidth = sprite.bitmapWidth();
const bitmapHeight = sprite.textHeight ? sprite.textHeight() : sprite.bitmapHeight();
const gaugeHeight = sprite.gaugeHeight();

// Draw Gauge
const gx = 0;
const gy = bitmapHeight - gaugeHeight;
const gw = bitmapWidth - gx;
const gh = gaugeHeight;
this.drawFullGauge(color1, color2, gx, gy, gw, gh);

// Draw Icon
const iconBitmap = ImageManager.loadSystem("IconSet");
const iw = ImageManager.iconWidth;
const ih = ImageManager.iconHeight;
const ix = (icon % 16) * iw;
const iy = Math.floor(icon / 16) * ih;
bitmap.blt(iconBitmap, ix, iy, iw, ih, 0, 0, 24, 24);

// Draw Value
const vw = bitmapWidth - 2;
const vh = bitmapHeight;
sprite.setupValueFont();
bitmap.textColor = ColorManager.mpColor(user);
bitmap.drawText(currentValue, 0, 0, vw, vh, "right");
The first line "const icon =33;
change this to the icon number you want.

Spoiler: Making Status TP
Plugin Manager > VisuMZ_1_SkillsStatesCore > Skill Cost Types
Copy line 3 "TP" and paste it at the bottom.
Open the pasted version.
Change the name as to identify/call (using TPi for this example).
Scroll all the way down to JS: Draw Gauge.
Replace code with:
Spoiler: TP Code
Code:
// Declare Settings
const icon = 87;
const color1 = ColorManager.tpGaugeColor1();
const color2 = ColorManager.tpGaugeColor2();

// Declare Variables
const sprite = this;
const settings = sprite._costSettings;
const bitmap = sprite.bitmap;
const user = sprite._battler;
const currentValue = sprite.currentDisplayedValue();
const bitmapWidth = sprite.bitmapWidth();
const bitmapHeight = sprite.textHeight ? sprite.textHeight() : sprite.bitmapHeight();
const gaugeHeight = sprite.gaugeHeight();

// Draw Gauge
const gx = 0;
const gy = bitmapHeight - gaugeHeight;
const gw = bitmapWidth - gx;
const gh = gaugeHeight;
this.drawFullGauge(color1, color2, gx, gy, gw, gh);

// Draw Icon
const iconBitmap = ImageManager.loadSystem("IconSet");
const iw = ImageManager.iconWidth;
const ih = ImageManager.iconHeight;
const ix = (icon % 16) * iw;
const iy = Math.floor(icon / 16) * ih;
bitmap.blt(iconBitmap, ix, iy, iw, ih, 0, 0, 24, 24);

// Draw Value
const vw = bitmapWidth - 2;
const vh = bitmapHeight;
sprite.setupValueFont();
bitmap.textColor = ColorManager.tpColor(user);
bitmap.drawText(currentValue, 0, 0, vw, vh, "right");
The first line "const icon =87;
change this to the icon number you want.

Now that you have settings in place, lets add them to our actors!
Database > Classes
in the Notebox add:
Spoiler: Notetags
Code:
<Replace HP Gauge: HPi>
<Replace MP Gauge: MPi>
<Replace TP Gauge: TPi>
StatIconNotetag.png
Do this for every class you wish this display to apply.

Spoiler: Optional
Plugin Manager > VisuMZ_1_SkillsStatesCore > Skill Cost Types >
Delete the original HP, MP, TP settings.
ParameterEnd.png

Go to your new settings(example: HPi)
under Name is Settings > Icon.
Change this to the same or whatever you like to show when displaying skill cost.
Leaving as 0 wont display any icon.

Cost by database and by notetag will still only use <HP Cost: x> and not <HPi Cost: x>
SkillCostNotetag.png

Spoiler: End Result
Complete.png


Now that everything is working, change the HPi, MPi, and TPi back to HP, MP, TP.
Remove the notetags from the classes. all actors will display Icons.
@NaosoX a little bit wrong. I need icons EVERYWHERE in the game instead of words. So that the letter designation does not occur in any menu, or in any mention ( It worked perfectly. Thank you so much, you saved me. For some reason, these letters annoy me)

It was very convenient when the TYPE input field understood the message commands. Without any complicated torments with substitutions, substitutions and scripts

Original thread: https://forums.rpgmakerweb.com/threads/visustella-display-hp-mp-tp-text-as-icons.147392/