Effective skills recover TP

How can I cause dealing damage types that enemies are weak to (element rate greater than 100%) from items, skills or anything else to recover the attacker 1 TP?

I couldn't find any free plugins that worked on MZ, so I had to resort to attempting to edit the JavaScript although I have almost no experience with JavaScript. I was able to set a maximum TP and remove all sources of TP gain excluding skills without plugins but I'm unable to do this.

There is a plugin that does what I want but unfortunately doesn't work on MZ (causes an error when I go to status). I've tried using ChatGPT and got

if (elementRate > 1) {
target.gainTp)1_;
}

which goes in rmmz_objects under Game_Action.prototype.makeDamageValue but that also didn't work.

I'm new to RPG maker so I'd really appreciate any help.
What you posted from ChatGPT is typical for it in so far as that isn't even valid javascript and hasn't even a theoretical chance of working. (it's missing at minimum one ( besides other problems)

I would suggest going with some of the Visustella plugins and a javascript notetag on the skills and items you want that effect.
I've tried using ChatGPT
Never a good idea. ChatGPT can't accurately do grade-level math, I don't know why you'd trust it to know how to write code 😛 What you posted from it is nonsense.

Regardless, there are a number of free plugins for MZ that can do this.

My Eval Tags, linked in my signature, will work; as will VisuStella's Battle Core if you want to start using their suite.

Using Eval Tags, you'd give the actor the notetag:
Code:
<Action Damaged Eval>
if (target.elementRate(skill.damage.elementId) > 1)
    user.gainTp(1);
</Action Damaged Eval>
I've tried using ChatGPT and got

if (elementRate > 1) {
target.gainTp)1_;
}
Ignoring the ")1_" typo, that presumes that theres a target and an elementRate variable available somehow in the function you put it in. I wont have access to the files for a few days so I cant check myself, but IIRC that function wouldn't have access to an elementRate. You could use this.calcElementRate(target) instead of elementRate

which goes in rmmz_objects under Game_Action.prototype.makeDamageValue but that also didn't work.
You shouldn't make changes directly to the core js files. You should put your modified functions into a separate js file and reintroduce it to your project as a plugin.

Edit: noticed you wanted the user to gain that tp. Not the target. That gainTp() should be ran on this.subject(), not target
What you posted from ChatGPT is typical for it in so far as that isn't even valid javascript and hasn't even a theoretical chance of working. (it's missing at minimum one ( besides other problems)

I would suggest going with some of the Visustella plugins and a javascript notetag on the skills and items you want that effect.
Thank you for the response.

Ignoring the ")1_" typo, that presumes that theres a target and an elementRate variable available somehow in the function you put it in. I wont have access to the files for a few days so I cant check myself, but IIRC that function wouldn't have access to an elementRate. You could use this.calcElementRate(target) instead of elementRate


You shouldn't make changes directly to the core js files. You should put your modified functions into a separate js file and reintroduce it to your project as a plugin.

Edit: noticed you wanted the user to gain that tp. Not the target. That gainTp() should be ran on this.
Thanks. I'll try this.

Never a good idea. ChatGPT can't accurately do grade-level math, I don't know why you'd trust it to know how to write code 😛 What you posted from it is nonsense.

Regardless, there are a number of free plugins for MZ that can do this.

My Eval Tags, linked in my signature, will work; as will VisuStella's Battle Core if you want to start using their suite.

Using Eval Tags, you'd give the actor the notetag:
Code:
<Action Damaged Eval>
if (target.elementRate(skill.damage.elementId) > 1)
    user.gainTp(1);
</Action Damaged Eval>
I have nearly no JavaScript experience, just thought I'd give ChatGPT a try and hope it does something good.

Anyway, I've searched for VisuStella's Battle Core, and it looks very useful. Thanks a lot for the recommendation 🙂.

Original thread: https://forums.rpgmakerweb.com/threads/effective-skills-recover-tp.169924/