Any way to get it to display both MP and TP cost? Both in the menu and in battle, it only shows TP.
If A Skill Has MP & TP Costs It Only Displays TP Cost
RPG Maker MZ SupportIs this vanilla MZ or you using some plugins=?
I'm using some plugins but nothing that should affect this. I'm using Visustella Core & Message plugins, Galv Layer & Cam Control, and Community Lighting, plus a custom plugin Arthran made that randomizes the number of hits a skill does if you put code in the note field, but that isn't being used for the skill in question.
Can you try to see if this happens without plugins too?
Is it supposed to work that way? I mean, I'd have to make a whole new game in order to test it out since every map in my game requires at least the layers plugin to work. So I'm just wondering if you know that it's supposed to display both MP and SP or no before I go thru the trouble.
It is, just confirmed so.
I tossed together a plugin for this. Try it out and let me know how it works for you:
JavaScript:
Window_SkillList.prototype.costWidth = function() {
return this.textWidth('000000 ' + TextManager.tpA + TextManager.mpA);
};
Window_SkillList.prototype.drawSkillCost = function(skill, x, y, width) {
const partialSpaceWidth = Math.floor(this.textWidth(' ') / 3);
if (this._actor.skillTpCost(skill) > 0) {
const tpValText = this._actor.skillTpCost(skill);
const tpValWidth = this.textWidth(tpValText);
const tpAWidth = this.textWidth(TextManager.tpA);
var tpWidth = tpValWidth + partialSpaceWidth + tpAWidth;
const tpValX = x + width - tpWidth;
const tpAX = x + width - tpAWidth;
this.changeTextColor(ColorManager.tpCostColor());
this.drawText(tpValText, tpValX, y, tpValWidth);
this.drawText(TextManager.tpA, tpAX, y, tpAWidth);
}
if (this._actor.skillMpCost(skill) > 0) {
const mpValText = this._actor.skillMpCost(skill);
const mpValWidth = this.textWidth(mpValText);
const mpAWidth = this.textWidth(TextManager.mpA);
const mpWidth = mpValWidth + partialSpaceWidth + mpAWidth;
const mpOffset = tpWidth ? tpWidth + this.textWidth(' ') : 0;
const mpValX = x + width - mpWidth - mpOffset;
const mpAX = x + width - mpAWidth - mpOffset;
this.changeTextColor(ColorManager.mpCostColor());
this.drawText(mpValText, mpValX, y, mpValWidth);
this.drawText(TextManager.mpA, mpAX, y, mpAWidth);
}
};
Well, here it is not working in a clean project, so very strange:



@Arthran - Thanks, buddy, I'll test it out! Really appreciate it!
[edit: And it works perfectly! Thanks again, man!]
No problem!
*edit*
I noticed that the game in your screenshots is not at a widescreen aspect ratio. As a result, that game has a little less space for skill names than my test game did, and I didn't consider that possibility when I wrote that code. If you wind up with any issues regarding long skill names getting cut off, you might try this code instead:
JavaScript:
Window_SkillList.prototype.drawItem = function(index) {
const skill = this.itemAt(index);
if (skill) {
const costWidth = this.costWidth(skill);
const rect = this.itemLineRect(index);
this.changePaintOpacity(this.isEnabled(skill));
this.drawItemName(skill, rect.x, rect.y, rect.width - costWidth);
this.drawSkillCost(skill, rect.x, rect.y, rect.width);
this.changePaintOpacity(1);
}
};
Window_SkillList.prototype.costWidth = function(skill) {
let value = 0;
if (this._actor.skillTpCost(skill) > 0) {
value += this.textWidth(this._actor.skillTpCost(skill) + TextManager.tpA);
}
if (this._actor.skillMpCost(skill) > 0) {
if (value > 0) {
value += this.textWidth(' ');
}
value += this.textWidth(this._actor.skillMpCost(skill) + TextManager.mpA);
}
value += this.textWidth(' ');
return value;
};
Window_SkillList.prototype.drawSkillCost = function(skill, x, y, width) {
const partialSpaceWidth = Math.floor(this.textWidth(' ') / 3);
if (this._actor.skillTpCost(skill) > 0) {
const tpValText = this._actor.skillTpCost(skill);
const tpValWidth = this.textWidth(tpValText);
const tpAWidth = this.textWidth(TextManager.tpA);
var tpWidth = tpValWidth + partialSpaceWidth + tpAWidth;
const tpValX = x + width - tpWidth;
const tpAX = x + width - tpAWidth;
this.changeTextColor(ColorManager.tpCostColor());
this.drawText(tpValText, tpValX, y, tpValWidth);
this.drawText(TextManager.tpA, tpAX, y, tpAWidth);
}
if (this._actor.skillMpCost(skill) > 0) {
const mpValText = this._actor.skillMpCost(skill);
const mpValWidth = this.textWidth(mpValText);
const mpAWidth = this.textWidth(TextManager.mpA);
const mpWidth = mpValWidth + partialSpaceWidth + mpAWidth;
const mpOffset = tpWidth ? tpWidth + this.textWidth(' ') : 0;
const mpValX = x + width - mpWidth - mpOffset;
const mpAX = x + width - mpAWidth - mpOffset;
this.changeTextColor(ColorManager.mpCostColor());
this.drawText(mpValText, mpValX, y, mpValWidth);
this.drawText(TextManager.mpA, mpAX, y, mpAWidth);
}
};
This isn't a vital thing, or anything like that. But the original code was reserving space for a 3 digit TP cost + a 3 digit MP cost for each skill, whereas the new code will only reserve exactly how much space it needs to display the cost. I had judged that the original method was fine, because on my test game, it still left plenty of space for a lengthy skill name, so I figured I'd save a bit on performance and just go ahead and reserve space for the maximum possible cost. But after seeing your screenshots, I'm not sure if that's actually a safe trade-off on a lower resolution game, so if your game is at default MZ resolution (or lower), then you might consider switching to this new code instead.
Thanks, I'll use the new code! I tend to have long skill names, but single or double digit costs (I like to stick to low numbers for everything).
Original thread: https://forums.rpgmakerweb.com/threads/if-a-skill-has-mp-tp-costs-it-only-displays-tp-cost.150068/