[RMVXA] How can I use Conditional and Percentage in a formula?

Hey everyone, I got a small request. How can I make something like this possible:


A Sniper is using a skill called "One Shot, One Kill". What this does is that if the target's HP is 25% or less, it would instantly kill him. So the formula I've tried - but not working correctly - is this;


 if b.hp == b.mhp / 4; b.add_state(1); else; a.atk * 6 - b.def * 2; end;


So, the attack should result in "a.atk * 6 - b.def * 2" if the instant kill shouldn't work. Only problem is that even if the target HP is 25% or less, the instant kill method doesn't work. It just goes back to the else. I'm no genius lol and this is my first attempt at a formula like this. I've looked at Fomar's custom formula stuff but for some reason, this one isn't working. Any help?
Try this:

Code:
if b.hp <= b.mhp / 4; b.add_state(1); 0; else; a.atk * 6 - b.def * 2; end;
your formula is checking for "equal" (==), not for "equal or less" (<=) 


the way it is, the death state will only work if the actor is exactly at maxhp / 4.
Oooooh, okay. That makes sense. It works now and thank you both for helping, I really appreciate is 😀

Original thread: https://forums.rpgmakerweb.com/threads/rmvxa-how-can-i-use-conditional-and-percentage-in-a-formula.60450/