Greetings,
As you may or may not know, RPG Maker MZ by default multiplies any TP gain entered into the "TP Gain:" box by the number of targets hit by the item or skill.
I am looking to write a simple plugin that modifies the way TP gain works. What I would like to do is modify TP gained per use of a skill or item to always be exactly what it says in the "TP Gain:" box within the database, regardless of the number of targets hit.
I am wondering if anyone can point me in the right direction to find where or what I would need to do to make this change happen. I believe I am on the right track, but I may be grasping at straws a bit.
I think I would need to modify the following function in rmmz_objects.js. I have tried several iterations of modifying this but I'm a bit stumped, as no matter what I change it's always applying the changes for each target hit:
Following is the function that calculates TP gain when a skill or item is used:
Any help with this would be greatly appreciated, I've scoured google for a few hours at this point but haven't been able to find any concrete leads on how exactly to make the change I'm looking for.
Note: Just for clarity's sake, I'm going to turn this into a plugin, I won't be modifying the core files directly.
Thank you in advance and have a wonderful week,
-Niniann
As you may or may not know, RPG Maker MZ by default multiplies any TP gain entered into the "TP Gain:" box by the number of targets hit by the item or skill.
I am looking to write a simple plugin that modifies the way TP gain works. What I would like to do is modify TP gained per use of a skill or item to always be exactly what it says in the "TP Gain:" box within the database, regardless of the number of targets hit.
I am wondering if anyone can point me in the right direction to find where or what I would need to do to make this change happen. I believe I am on the right track, but I may be grasping at straws a bit.
I think I would need to modify the following function in rmmz_objects.js. I have tried several iterations of modifying this but I'm a bit stumped, as no matter what I change it's always applying the changes for each target hit:
Game_Action.prototype.apply = function(target) { const result = target.result(); this.subject().clearResult(); result.clear(); result.used = this.testApply(target); result.missed = result.used && Math.random() >= this.itemHit(target); result.evaded = !result.missed && Math.random() < this.itemEva(target); result.physical = this.isPhysical(); result.drain = this.isDrain(); if (result.isHit()) { if (this.item().damage.type > 0) { result.critical = Math.random() < this.itemCri(target); const value = this.makeDamageValue(target, result.critical); this.executeDamage(target, value); } for (const effect of this.item().effects) { this.applyItemEffect(target, effect); } this.applyItemUserEffect(target); } this.updateLastTarget(target);};Following is the function that calculates TP gain when a skill or item is used:
Game_Action.prototype.applyItemUserEffect = function(/*target*/) { const value = Math.floor(this.item().tpGain * this.subject().tcr); this.subject().gainSilentTp(value);};Any help with this would be greatly appreciated, I've scoured google for a few hours at this point but haven't been able to find any concrete leads on how exactly to make the change I'm looking for.
Note: Just for clarity's sake, I'm going to turn this into a plugin, I won't be modifying the core files directly.
Thank you in advance and have a wonderful week,
-Niniann