I'm new to Attack formulas. Think you can help?

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 think I see what you're doing wrong, but I'm not an expert and I don't want to give adivice that might be wrong.  What I suggest you do is post your query in this thread http://forums.rpgmakerweb.com/index.php?/topic/1143-how-to-make-the-most-of-custom-formulae-part-1/ which is specifically dedicated to questions like yours, and where there are many knowledgeable people who could answer you with authority.

Edit

ninja'd by Andar - still think the thread I mentioned is worth turning to if you have more queries.
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 Thank you for the help.

I think I see what you're doing wrong, but I'm not an expert and I don't want to give adivice that might be wrong.  What I suggest you do is post your query in this thread http://forums.rpgmakerweb.com/index.php?/topic/1143-how-to-make-the-most-of-custom-formulae-part-1/ which is specifically dedicated to questions like yours, and where there are many knowledgeable people who could answer you with authority.

Edit

ninja'd by Andar - still think the thread I mentioned is worth turning to if you have more queries.
I looked at this tutorial. It didn't really teach me a lot. I looked at it and saw nothing but an endless void of examples and not tutorials
I'm not talking about the tutorial.  After the tutorial there are lots of pages with people asking questions like yours and getting answers.  
I'm not talking about the tutorial.  After the tutorial there are lots of pages with people asking questions like yours and getting answers.  
Oh well if that's the case. Thank you for the assistance 🙂  
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
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
As i was testing around with it i noticed that i couldn't use symbols "<=" would there be any reason or maybe a script that i'm missing?
As i was testing around with it i noticed that i couldn't use symbols "<=" would there be any reason or maybe a script that i'm missing?
No, these should be usable.
Please post your current formula (the one where you couldn't use symbols) and what the errormessage is - most of the cases it's a typo or a missing space.
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
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
You have no idea how stupid i am. I added an Escape state in the effects menu. LOL! sry for waiting your time
🙂

Original thread: https://forums.rpgmakerweb.com/threads/im-new-to-attack-formulas-think-you-can-help.22093/