Skill which removes all of users TP

So i basically want to make a skill which does more damage the more tp you got ( which i have succeded in ^^) but i also want the move to set your tp to 0 so you can't just spam it, anyone know how i can do this? With common events the only thing i could wind was changing HP and MP, but not TP.

Grateful for all help.
This script'll do that.
Or this one
In the formula box, you should be able to calculate your damage into a variable, then reduce your tp, then output the variable. Something like this:

Code:
dmg = <damage calculation here>; a.tp = 0; dmg
In the formula box, you should be able to calculate your damage into a variable, then reduce your tp, then output the variable. Something like this:

dmg = <damage calculation here>; a.tp = 0; dmg
Your way is the one i was thinking about, but i must have done something wrong as when the skill is used the game crashes with the error message

Script 'Game_Battler' line 352: SyntaxError occured

unexpected sSTAR, expecting $end

a.tp * a.atk * 0.1 - b.def *1.5; a.tp = 0;

any idea what i did wrong?
Yes, you didn't do what I said to do 🙂


You MUST put the damage calculation into a variable, then change your tp, then return the damage variable.


Using your formula, this, exactly would be what you'd enter:

dmg = a.tp * a.atk * 0.1 - b.def * 1.5; a.tp = 0; dmgThe method expects the formula to return the damage amount, and if you put a.tp = 0 last, it will not.
Try that, and if it doesn't work, post back with the new error message and copy/paste the formula from your skill.
Yes, you didn't do what I said to do 🙂

You MUST put the damage calculation into a variable, then change your tp, then return the damage variable.

Using your formula, this, exactly would be what you'd enter:

dmg = a.tp * a.atk * 0.1 - b.def * 1.5; a.tp = 0; dmgThe method expects the formula to return the damage amount, and if you put a.tp = 0 last, it will not.Try that, and if it doesn't work, post back with the new error message and copy/paste the formula from your skill.
Thanks, it works now, and just as i wanted it to, very grateful. Another question since you seem alot better than me when it comes to using custom formulas.

a.atk * 5*(101.to_f-(a.mhp.to_f/a.hp.to_f)*100.to_f) - b.def * 2.5

it's an attack which is supposed to do more damage the less life you got, i made a skill like this but backwards ( more damage the greater ones hp) in the past but i can't remember exactly on which terms i am to use  .to_f since right now the skill only does null damage anytime i use the skill.
I think it should be a.hp/a.mhp

because a.mhp/a.hp would always return greater than 1 when you don't have full hp... so 101 - that value*100 will most probably be less than 0 unless you have full HP... so you will have a negative total damage, leading to the null attack...

btw, you don't really need to put all those .to_f there
I'm not sure if it's really what you want, but try something like this.

a.atk * 5 * (101 - a.hp_rate * 100) - b.def * 2.5a.hp_rate is the same as saying (a.hp.to_f/a.mhp). So that calculation is already done for you in Game_BattlerBase.
As a note, to convert a constant to a float, you just need to put .0 at the end, rather than adding .to_f (so 10.0 instead of 10.to_f)


And in a calculation, you don't have to convert EVERY operand to a float - as long as you have one at the appropriate time, the whole thing will stay as a float.


In this case, a.hp_rate is already a float, so you don't actually have to do ANY conversions.
I think it should be a.hp/a.mhp

because a.mhp/a.hp would always return greater than 1 when you don't have full hp... so 101 - that value*100 will most probably be less than 0 unless you have full HP... so you will have a negative total damage, leading to the null attack...

btw, you don't really need to put all those .to_f there

I'm not sure if it's really what you want, but try something like this.

a.atk * 5 * (101 - a.hp_rate * 100) - b.def * 2.5a.hp_rate is the same as saying (a.hp.to_f/a.mhp). So that calculation is already done for you in Game_BattlerBase.As a note, to convert a constant to a float, you just need to put .0 at the end, rather than adding .to_f (so 10.0 instead of 10.to_f)

And in a calculation, you don't have to convert EVERY operand to a float - as long as you have one at the appropriate time, the whole thing will stay as a float.

In this case, a.hp_rate is already a float, so you don't actually have to do ANY conversions.
Well, seems like i shouldn't try to do math this late when i am already tired...

thanks for the help both of you, i am off to bed i think ^^. Just one final thing for Shaz, i didn't know that there existed such fancy things as hp_rate, know any place with a list of things like that? could come in handy in the future 🙂
You've just got to look through the scripts. It's daunting, especially if you're new to it. I learned to program over 20 years ago, and I still struggle with some of the Ace scripts. And I only know about hp_rate because I saw someone else mention it in response to a forum post 😉


In battle, you will be interested in the Game_Battler class and the Game_BattlerBase class. hp_rate is a method in Game_BattlerBase, which means you can call it by doing a.hp_rate or b.hp_rate - you can do the same with all of the other methods there, though not all of them will be useful to you in creating a formula.


I won't close this yet, because you didn't actually indicate whether you tried it and whether it worked.
You've just got to look through the scripts. It's daunting, especially if you're new to it. I learned to program over 20 years ago, and I still struggle with some of the Ace scripts. And I only know about hp_rate because I saw someone else mention it in response to a forum post 😉

In battle, you will be interested in the Game_Battler class and the Game_BattlerBase class. hp_rate is a method in Game_BattlerBase, which means you can call it by doing a.hp_rate or b.hp_rate - you can do the same with all of the other methods there, though not all of them will be useful to you in creating a formula.

I won't close this yet, because you didn't actually indicate whether you tried it and whether it worked.
if you mean the formula you gave me for the second attack, then it worked like a charm, thanks for all the help 🙂
Awesome 🙂


This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/skill-which-removes-all-of-users-tp.16248/