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.
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.
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.
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.
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.