I know how to make skills do damage based on the percent of a actor's current HP, but how do I make where one who gets hit by it that only has 1 HP left take 0 damage from it?
A Battle Formula Question
RPG Maker MV SupportYou can set up a condition inside the damage formula in the following format:
(condition) ? (formula if true) : (formula if false)
So for example, if you want the standard damage formula to apply, unless the target has 1 hp or less (when you want it to do 0 damage):
(condition) ? (formula if true) : (formula if false)
So for example, if you want the standard damage formula to apply, unless the target has 1 hp or less (when you want it to do 0 damage):
Code:
(b._hp <= 1) ? 0 : (a.atk * 4 - b.def * 2)
b.hp == 1 ? 0 : (damage formula go here)
@Llareian So this is what I need to do? (In this case, the attack deals 90% of their current HP as damage unless their HP is at 1)
Code:
(b._hp <= 1) ? 0 : (damage= b._hp * 90 / 100)
Unless you're using a plugin, putting "damage=" won't work. The rest of it looks good, though.
Code:
(b._hp <= 1) ? 0 : (b._hp * 90 / 100)
@Llareian Ah, that was from where I was using the original percentage formula I had found.
Edit: Yep that did it. Thanks.
Edit: Yep that did it. Thanks.
Original thread: https://forums.rpgmakerweb.com/threads/a-battle-formula-question.91096/