(Answered) How to make skill that deals a lower % of damage based on higher target health?

I'm not mathematician (not even that great at it!), so I'm having a mind fart.


Trying to make a skill that deals less damage the lower the enemy's current health is comparative to their lax health.


Let's just say my damage formula totals 1000 damage. I THEN want that damage to be reduced by the % of health lost by the target.


Basically if the enemy is at 100% health the skill will still deal it's full 1000 damage, but if the target is at 25% health, then the skill will only deal 250 damage. Can't quite figure out how to get the multiplier for that.


((100+((a.level/4)*(a.atk/10)))*1.1)*(?)


Bold part is the part I'm having trouble with. That needs to be % of target's health.


*edit* The answer, by Victor Sant, is to use  "b.hpRate()" OR "b.hp/b.mhp".


So for my formula it would be:


((100+((a.level/4)*(a.atk/10)))*1.1)*b.hpRate()


OR


((100+((a.level/4)*(a.atk/10)))*1.1)*(b.hp/b.mhp)


Thanks again, Victor!
b.mhp/b.hp
b.hpRate()
b.hpRate()

Thank you very much, Victor! That simplifies things a great deal. 😀

b.mhp/b.hp

Wouldn't this make the skill deal MORE damage as their HP decreases?


1000MHP / 750HP = 1.333x Multiplier.


1000MHP / 250HP = 4x Multiplier
Wouldn't this make the skill deal MORE damage as their HP decreases?


1000MHP / 750HP = 1.333x Multiplier.


1000MHP / 250HP = 4x Multiplier

Actually the correct woud be 'b.hp/b.mhp', and this is exactly what the 'hpRate()' do.
I knew it was something simple. Haven't used my brain for much math in the last 10 years. This would be a face-palm moment. Thanks again, Victor. 🙂

Original thread: https://forums.rpgmakerweb.com/threads/answered-how-to-make-skill-that-deals-a-lower-of-damage-based-on-higher-target-health.60088/