"Execution" SKill

Hello again,

I'm trying to make a skill that just KOs an enemy when they're below a certain HP percentage

I put this in the damage formula bar

if (b.hp<(b.mhp*0.2)){b.hp=0;}else{a.atk + a.agi * 2 - b.def}​

And it neither KOs at <20% nor applies the normal damage formula.

Help. Please and thank you
you cannot set HP to 0 in formula I think, but here are lunatic codes
to set the skill to kill the enemy.

you just need to find it as it does exist somewhere.
b.hp even though it doesnt look like it is a function call. you cant set it to a value. you'd have to use b._hp or the setHp() function when modifying it.

And it neither KOs at <20% nor applies the normal damage formula.
if its doing neither, then its most likely generating an error. if you press f12 to open the console youll be told them as they happen.

try this
Code:
b.hpRate() <= .20 ? b.die(): a.atk + a.agi * 2 - b.def
T
b.hp even though it doesnt look like it is a function call. you cant set it to a value. you'd have to use b._hp or the setHp() function when modifying it.


if its doing neither, then its most likely generating an error. if you press f12 to open the console youll be told them as they happen.

try this
Code:
b.hpRate() <= .20 ? b.die(): a.atk + a.agi * 2 - b.def
thank you again, friend.

b.hpRate() <= .20 ? b.die(): a.atk + a.agi * 2 - b.def works like a charm

This case is resolved
This case is resolved
just a bit of an early warning. if for any reason it doesnt work on something, try b.setHp(0). there may be cases where b.die() doesnt work, but i havent tested it myself.

though imo ideally youd do this with a Yanfly action sequence to avoid damage popups and remove the if statement from the damage formula.
just a bit of an early warning. if for any reason it doesnt work on something, try b.setHp(0). there may be cases where b.die() doesnt work, but i havent tested it myself.

though imo ideally youd do this with a Yanfly action sequence to avoid damage popups and remove the if statement from the damage formula.
Oh do I have a story for you

I did try b.setHp (0) and it was a fluke

b.die() does what I need it to do

Original thread: https://forums.rpgmakerweb.com/threads/execution-skill.174491/