MZ ARPG Official Plugins, skills show 0 cost when it is set in TP

If I set a skill to cost 1 TP and 0 MP, it shows fine in the menu, but when I register it as a shortcut, it shows a blue 0, presumably 0 MP, and doesn’t show the TP cost. It does consume TP when used though. Testing done in the sample project.
Spoiler: Images
Skill settings:
1682960485256.png

In the menu:
1682960525883.png

In the shortcuts:
1682960539139.png

Before using:
1682960557261.png

After using:
1682960575558.png
ARPG Official Plugins (need to scroll below Sample Games)
Note: for TP to work at all you need to give the actor the Special Flag: Preserve TP.
Spoiler: Special Flag
1682961116375.png
The plugin only shows MP cost, I think. I managed to get it to show TP cost as well. Open the item shortcut plugin with notepad, find the code below and add the bolded lines (you can change the position by changing the numbers in the parentheses):

drawItem(index) {
const actorId = $gameParty.leader().actorId();
const rect = this.itemRect(index);
const item = $shortcutStatus.shortcut(actorId, index);
if (item) {
const itemData = item.object();
this.drawIcon(itemData.iconIndex, rect.x + 4, rect.y + 4);
if (DataManager.isSkill(itemData)) {
this.changeTextColor(ColorManager.mpCostColor());
this.drawText(itemData.mpCost, rect.x + 12, rect.y + 12, 24, "right");
this.changeTextColor(ColorManager.tpCostColor());
this.drawText(itemData.tpCost, rect.x + 12, rect.y + 12, 24, "left");

this.changeTextColor(ColorManager.normalColor());
} else {
this.drawText($gameParty.numItems(item.object()), rect.x + 12, rect.y + 12, 24, "right");
}


EDIT: This is again just me messing with the plugin. There might be other ways as well.
Thank you so much, you’ve saved my life. I’ll test it later, when I have time.
Edit: It worked nicely but I edited it a bit to show the TP cost only if it existed, and to replace the MP cost:
JavaScript:
if (itemData.tpCost > 0) {
this.changeTextColor(ColorManager.tpCostColor());
this.drawText(itemData.tpCost, rect.x + 12, rect.y + 12, 24, "right");               
this.changeTextColor(ColorManager.normalColor()); }

Edit, edit: Changed it more to show the cost in MP, if it is MP, TP if it is in TP and both if that's the case:
(Also changes the position if either is a two-digit number)

Replace:
JavaScript:
this.changeTextColor(ColorManager.mpCostColor());
this.drawText(itemData.mpCost, rect.x + 12, rect.y + 12, 24, "right");
this.changeTextColor(ColorManager.normalColor());
With:
JavaScript:
if (itemData.mpCost > 0) {
                        if (itemData.mpCost > 9) {
                        this.changeTextColor(ColorManager.mpCostColor());
                        this.drawText(itemData.mpCost, rect.x + 15, rect.y + 12, 24, "right"); 
                        var moveTP = -11; }
                        else {
                             this.changeTextColor(ColorManager.mpCostColor());
                             this.drawText(itemData.mpCost, rect.x + 12, rect.y + 12, 24, "right"); 
                             var moveTP = 0; }
                    if (itemData.tpCost > 0) {
                        if (itemData.tpCost < 9) {
                            this.changeTextColor(ColorManager.tpCostColor());
                            this.drawText(itemData.tpCost, rect.x + 10 + moveTP, rect.y + 12, 24, "left");                  
                            } else {
                        var moveTP = 0;
                        this.changeTextColor(ColorManager.tpCostColor()); 
                        this.drawText(itemData.tpCost, rect.x -1, rect.y + 12, 24, "left"); }                  
                        this.changeTextColor(ColorManager.normalColor()); } 
                        } else {
                    if (itemData.tpCost > 0) {
                    this.changeTextColor(ColorManager.tpCostColor());
                    this.drawText(itemData.tpCost, rect.x + 12, rect.y + 12, 24, "right");                  
                    this.changeTextColor(ColorManager.normalColor()); } }

PS: There has to be a better way to do that than my giant mass of code, but my knowledge of coding is 0,00001.
Thread closed

Original thread: https://forums.rpgmakerweb.com/threads/arpg-official-plugins-skills-show-0-cost-when-it-is-set-in-tp.157127/