MZ Skill to consume all current TP...

Good evening! I looked around (For MP as well as TP) and was suprised to find there wasn't something similar...

I've got a skill that does damage as so: (10 * a.tp).... The more Actor TP, the more damage. That side is perfect.

Now what I'm trying to achieve, is to make this skill cost whatever the current TP pool amount is for the actor.
If the actor has 55 TP, it will cost 55 TP. If they have 2 TP, it costs 2 TP.

Basically, use this skill, all the TP is spent, whatever that amount is between 1 and 100. Actor should have 0 TP afterwards.

I am using Visustella SkillStatesCore plugin, and the out-of-box notetags don't appear to offer this functionality.

I figure I can add this as a custom entry in the plugin, under "Skill Cost Types"... but... my javascript ability is sadly lacking outside of simple web stuff -
I'm positive this can be achieved via the plugin, I just dont know how to put the code together.

Can anyone help?
Perhaps there's an even simpler method I've overlooked?
I am using Visustella SkillStatesCore plugin, and the out-of-box notetags don't appear to offer this functionality.
They definitely do:
Code:
<JS TP Cost>
cost=Math.max(user.tp, 1);
</JS TP Cost>

That's it.
They definitely do:
Code:
<JS TP Cost>
cost=Math.max(user.tp, 1);
</JS TP Cost>

That's it.

I just came back to say I was almost there with:

<JS TP COST>cost += user.tp;</JS TP COST>

Of course, yours prevents usage at 0TP - better than my attempt! Thank-you so much 🙂

...although, the ability now does no damage, because the TP cost is taken pre damage calculation. That's for me to tinnker with and see if I can fix, though! Thanks again!
...although, the ability now does no damage, because the TP cost is taken pre damage calculation.
Stick a variable onto the battler. So do something like:
Code:
<JS TP Cost>
user.currTp=user.tp;
cost=Math.max(user.tp, 1);
</JS TP Cost>

Then you can reference in your damage formula a.currTp for that stored value.
You can always put a common event on the skill (which will be executed after the damage) that sets tp to 0 and setting the skill costs to 1 tp prevents it from being used at 0 tp, tho you could specify it at 10 or so.
Thank you both for your time and replies, very much appreciated, and again, more graceful than what I'd come up with. I wasn't expecting further help as this wasn't the same issue as title post.

I first looked at a common event, but then looked into other plugins I have installed...

I did a <JS Pre-Start Action> tag (From BattleCore Plugin) and set a variable as the user.tp.

I then referenced the variable (v[#]) in the damage formula, and it is working as I wished.

I will be changing it to this, however:

<JS TP Cost> user.currTp=user.tp; cost=Math.max(user.tp, 1); </JS TP Cost>

You've taught me today that the code can be much more than "one bit" - if that makes sense. 🙂
You can always put a common event on the skill (which will be executed after the damage) that sets tp to 0 and setting the skill costs to 1 tp prevents it from being used at 0 tp, tho you could specify it at 10 or so.
You absolutely can do that - I'd personally prefer the notetag cost method because it's a bit slicker.

That way the skill's cost on your screen is actually the amount of TP it removes, rather than you see the cost is 1 and you have to read in the description that it actually drains all of it.

I don't think that by itself would make me quit a game or anything 😛

Original thread: https://forums.rpgmakerweb.com/threads/skill-to-consume-all-current-tp.153398/