Hello. my name is Rek3dge and i'm new to Attack formulas in skills. I would like some help with crafting one but when searching for tutorials i didn't find one that i really understood. I attempted to craft one but it didn't work according to plan. So here it is
if ( b.mph / 100 ) * 7.5; 20000; else; 0; endSo basically what i'm trying to do is "If the enemy is below 7.5% HP then kill it. Else do nothing" but when i tested the game it said. "Slime A took no damage" and dies anyway. i don't know why but that's why i need the forums help
1) mph is not the variable for current HP, you'll need b.hp
2) always multiply before dividing, because all numbers are integers, and partials are dropped when storing - for example, 90/100 is zero, so 90/100 * 7.5 is still zero with integers.
90*7.5 is 675, so 90*7,5/100 is 6 with integers
3) you have no condition on the if, you still need to compare it to the maximum hp (which would be mhp. not mph)
I'm not talking about the tutorial. After the tutorial there are lots of pages with people asking questions like yours and getting answers.
if ( b.hp / b.mhp.to_f) <= 0.075 ; b.mhp; else; 0; end
or if you want a "sure kill" (since the one above is still affected by variance and other damage factors)
if ( b.hp / b.mhp.to_f) <= 0.075 ; b.hp=0; end;0
though it will still say: Took no damage since the damage is actually 0... but you can always use Yanfly's anti-fail script to avoid that
b.hp_rate <= 0.075 ? 99999 : 0
should work too.
well yes... hp_rate... I forgot about that... it should work, unless the target has insane amount of reduction or is immune to that element... plus it shows 99999 damage... which is why I prefer the hp manipulation thingy... XD
Never mind that wasn't the error. (i don't think) it's just killing the enemy and saying "Slime A took no damage"
if ( b.hp / b.mhp.to_f) <= 0.075 ; b.mhp; else; 0; end
if that formula is killing the enemy, it should have been showing correct damage...
try to do this
if b.hp_rate <= 0.075 ; return b.mhp; else; return 0; end