Skills costs 1 TP, but want to reset TP to 0 after use

It's probably something simple that I am missing as always...but I am looking to let the actor use a skill for 1 TP, but it will then reset their TP to 0 after it executes. The idea is to convert all TP to Health. I do have it working except it is only dropping their TP by 1(of course). I saw an option where I could gain a specific amount of TP, but not an option to lower it(preferably by a percentage of 100%). Anyone know of a way to achieve this? Thanks in advance.
Try this:

a.gainTp(-100); damage/healing formula here

or:

a.gainTp(-a.tp*100); damage/healing formula here
Try this:

a.gainTp(-100); damage/healing formula here

or:

a.gainTp(-a.tp*100); damage/healing formula here

So, neither of those worked, but I modified what you gave me after I saw what I should/could be putting in there. I have it working 99% of the time. The only issue I have is that it shows 0 during the heal animation, but I am getting restored by exactly what I expect(TP built up). This is using the Battle Test using the Troop section. Could that be it? I included a screenshot of what the skill looks like.
try:
a.tp += amount; rest of formula;

or:
a.tp -= amount; rest of formula;
try:
a.tp += amount; rest of formula;

or:
a.tp -= amount; rest of formula;

a.gainHp(a.tp); a.gainTp(-100); is the current working formula minus the fact that it says I gained 0 health. I tried putting both versions you suggested and they both give me a webkit thing saying amount is not defined. So I swapped amount with 10 and it still gives the same result. My character gets healed, but does not show by how much.

Edit: Ok, so I figured out that the reason 0 is showing is because of the last statement in the formula a.gainTP(-100); returns 0(tp - 100 is zero). If I put '10;' after that statement, that is the value that is shown during the heal. Is there a way to create a temp variable in the formula, assign it to current tp, then put that variable at the end of the formula so it correctly shows how much tp->hp the character gained? I am probably overthinking this by a lot. I thought I could just do a var Gained, variable, but it didn't like that.
It says zero because the last part of the formula is the damage control. I don't have time to test this, and can't say I'm any expert, but try...

var = user.tp; a.gainTP(-100); var
It says zero because the last part of the formula is the damage control. I don't have time to test this, and can't say I'm any expert, but try...

var = user.tp; a.gainTP(-100); var

Nah, no luck with that either. It is looking for an '=' according to the syntax error. This is frustrating because I feel like the answer is going to be so simple.
It says zero because the last part of the formula is the damage control. I don't have time to test this, and can't say I'm any expert, but try...

var = user.tp; a.gainTP(-100); var

Hello!

Do be careful though with capitalisations. It's a.gainTp(x), not a.gainTP(x). If I recall correctly, you can also use a.setTp(0) to empty user's TP.

Alternatively, if you are using Yanfly's Skill Core (Link here: http://yanfly.moe/plugins/en/YEP_SkillCore.js), you can try using this Lunatic Code for your skill:

<After Eval>
user.setTp(0)
</After Eval>

Just set your damage/healing formula to a.tp for the healing part.

I think you can also set your skill TP Gain to 0. If you still gain TP, it might be caused by some plugins, such as Yanfly's Enchanced TP.

Hope that helps!

- Riff
Hello!

Do be careful though with capitalisations. It's a.gainTp(x), not a.gainTP(x). If I recall correctly, you can also use a.setTp(0) to empty user's TP.

Alternatively, if you are using Yanfly's Skill Core (Link here: http://yanfly.moe/plugins/en/YEP_SkillCore.js), you can try using this Lunatic Code for your skill:

<After Eval>
user.setTp(0)
</After Eval>

Just set your damage/healing formula to a.tp for the healing part.

I think you can also set your skill TP Gain to 0. If you still gain TP, it might be caused by some plugins, such as Yanfly's Enchanced TP.

Hope that helps!

- Riff


I do have the Skill Core. I tried doing the After Eval and it didn't work. Tried it with a semi colon as well just in case. The damage/healing formula to a.tp worked at least. Appreciate the help from everyone thus far.
Hello!

Do be careful though with capitalisations. It's a.gainTp(x), not a.gainTP(x). If I recall correctly, you can also use a.setTp(0) to empty user's TP.

Alternatively, if you are using Yanfly's Skill Core (Link here: http://yanfly.moe/plugins/en/YEP_SkillCore.js), you can try using this Lunatic Code for your skill:

<After Eval>
user.setTp(0)
</After Eval>

Just set your damage/healing formula to a.tp for the healing part.

I think you can also set your skill TP Gain to 0. If you still gain TP, it might be caused by some plugins, such as Yanfly's Enchanced TP.

Hope that helps!

- Riff


Never mind, it did work using Yanfly Skill Core. Apparently it doesn't when using Troops, but it worked in the main game. Ugh. Thanks to everyone who helped me out!

Original thread: https://forums.rpgmakerweb.com/threads/skills-costs-1-tp-but-want-to-reset-tp-to-0-after-use.78355/