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

Servidion

Last Soul Keeper
Veteran
Joined
Mar 15, 2015
Messages
233
Reaction score
27
First Language
English
Primarily Uses
RMMV
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!
 
Last edited by a moderator:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,355
Reaction score
7,668
First Language
German
Primarily Uses
RMMV
b.mhp/b.hp
 

Victor Sant

Veteran
Veteran
Joined
Mar 17, 2012
Messages
1,694
Reaction score
1,452
First Language
Portuguese
Primarily Uses
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.
 

Servidion

Last Soul Keeper
Veteran
Joined
Mar 15, 2015
Messages
233
Reaction score
27
First Language
English
Primarily Uses
RMMV
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. :)
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,849
Messages
1,016,977
Members
137,563
Latest member
cexojow
Top