Quick Tip: TP to HP Conversion Skill
In this post I will explain how you can create a skill in RPG Maker MV that consumes a variable amount of TP and restores HP depending on the amount of TP spent. For the skill you will need these 4 of Yanfly’s Plugins: Yanfly Core Engine , Yanfly Battle Engine Core , Yanfly Skill Core and Yanfly Damage Core .
For the skill’s damage type we choose “HP Recover”. We will leave the damage formula blank and use Yanfly’s <damage formula> notetag instead. The reason for this is, if you refer to a.tp in the damage formula, this variable actually holds the value of the current TP after the skill’s costs have been subtracted. To work around this behavior, we have to save the TP value before the costs are subtracted. This can be done by using the <Custom TP Cost> notetag.
<Custom TP Cost>
convertTp = user.tp;
cost = user.tp;
</Custom TP Cost>
value = (user.mhp * 0.03) * convertTp;
The content of the <Custom TP Cost> notetag will determine the TP cost of the skill. In the example above, the TP are saved in the variable “convertTp” before the costs are evaluated. The “cost” variable’s value will be the TP cost for the skill, in this particular case all TP are consumed.
Afterwards in the <damage formula> notetag we can refer back to the variable “convertTp” and use it for our custom formula. In the example above, the healing value is 3% of the user’s max HP for each TP consumed.