Make a skill use up its resource

Hello all.

First time using this forum, also first time working with RPGMaker.

I tried searching for an answer to my problem, but had no luck. If there is an answer already out there anyway, I'd appreciate a pointer to it!

My situation is this:

What I have is a system where one skill (Builder) raises TP (I deactivated all other TP gain) and another skill's (Finisher) effectiveness depends on the amount of TP accumulated at the time.
What I want is for the Finisher to use up all current TP/reset TP to 0 when used, so the player can't just chain more and more powerful Finishers. How do I achieve that?

- I use TP here because it seemed a logical step at the time, but I could just as well use MP instead if that helps.

- the Finisher has no TP cost of its own... the player is supposed to be able to use it any time but find it lacking without using the Builder first (Obviously, the simple solution would be to give the finisher an activation cost of 100% TP, but that doesn't seem to be possible?)
several possible solution. you could either set TP to zero in the damage formula or you could use one of the skill cost scripts.
You can give it a cost of 100TP in the skill tab. Just set the skill cost in the usual place and enter 100.
Thank you for the prompt responses!

For now, Neon Blacks Skill Cost Script gave me what I'm looking for (cost[all tp])

That's a lot of script for one thing though and I am curious: how would I set TP to 0 after use in the damage formula? I tried "a.tp*2 + a.atk * 4 - b.def * 2;a.tp=0" but while it did set the TP to 0, it also left me with a damage of 0 (without the a.tp=0 line, the damage against this specific test enemy is 120)
I am curious: how would I set TP to 0 after use in the damage formula? I tried "a.tp*2 + a.atk * 4 - b.def * 2;a.tp=0" but while it did set the TP to 0, it also left me with a damage of 0 (without the a.tp=0 line, the damage against this specific test enemy is 120)
The damage is always the last number processed in the damage formula - and the last number you processed is zero...Try this:

dam=a-tp*2 + a.atk*4 - b.def*2;a.tp=0;damYou need to store the result into a temporary variable because if setting tp to zero before damage calculation, the effect of TP would be lost.And you need that variable accessed last to override the zero from setting TP
The damage is always the last number processed in the damage formula - and the last number you processed is zero...

Try this:

dam=a-tp*2 + a.atk*4 - b.def*2;a.tp=0;damYou need to store the result into a temporary variable because if setting tp to zero before damage calculation, the effect of TP would be lost.And you need that variable accessed last to override the zero from setting TP
Thank you, that works perfectly, and is invaluable info for the future on top!

Thank you very much 🙂

Original thread: https://forums.rpgmakerweb.com/threads/make-a-skill-use-up-its-resource.53029/