Attack does more damage based on actor's TP?

So, I want a specific attack that when used, it does damage based on the amount of TP the actor has, then sets it to 0, how can I achive this?
you want the damage amount to BE the amount of tp they have?  Or to be a formula based on the amount of tp?  And then the tp is set to 0?


If you just want the damage to be equal to tp, it would be this:

Code:
dmg = a.tp; a.setTp(0); dmg;
you want the damage amount to BE the amount of tp they have?  Or to be a formula based on the amount of tp?  And then the tp is set to 0?


If you just want the damage to be equal to tp, it would be this:

Code:
dmg = a.tp; a.setTp(0); dmg;

I want the damage to be a formula based on the amount of TP. Such as multiplying the original formula I have with the amount of TP the actor has divided by 25.


My original formula is this:


25 + a.atk * 7 - b.def * 2.6


Edit: I tried to add the formula to my original formula in game, the attack did set the TP to 0 but did no damage to the enemy.
Code:
a.tp / 100 * ( 25 + a.atk * 7 - b.def * 2.6 )
a.tp / 100 * ( 25 + a.atk * 7 - b.def * 2.6 )

That kinda worked, but how do I reset the TP to 0 after the attack?
Okay, I figured it out.


Here's the formula I used:

Code:
dmg = a.tp / 25 * ( 25 + a.atk * 7 - b.def * 2.6 ); a.setTp(0); dmg

Original thread: https://forums.rpgmakerweb.com/threads/attack-does-more-damage-based-on-actors-tp.59468/