What formula would I use for an attack that get's stronger, when you have less hp?

Nosidag

Veteran
Veteran
Joined
Sep 29, 2013
Messages
30
Reaction score
3
First Language
English
Primarily Uses
Sorry if this is in wrong section.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,674
First Language
German
Primarily Uses
RMMV
Basically you need to add a faktor to the damage that gets higher with low HP.

If you keep it simple with a linear percentage-based progression, that would be:

(original damage formula) * (a.mhp - a.hp) / a.mhp

(not tested, but should work)
 

CWells

Storyteller/Artist
Veteran
Joined
Apr 22, 2013
Messages
731
Reaction score
40
First Language
English
Primarily Uses
Basically you need to add a faktor to the damage that gets higher with low HP.

If you keep it simple with a linear percentage-based progression, that would be:

(original damage formula) * (a.mhp - a.hp) / a.mhp

(not tested, but should work)
Looks like you got the mhp and hp backwards though. I just did calc test and this way will make the damage smaller with less hp.

1000 is MHP

(1000 - 65) / 1000 =.935

(1000 - 325) / 1000 = .675

No it was backwards >_<

If you want it stronger as health goes down, you'd make the numbers negative.

(-1000 - 65) / -1000 = 1.065

(-1000 - 325) / -1000 = 1.325
 
Last edited by a moderator:

Engr. Adiktuzmiko

Chemical Engineer, Game Developer, Using BlinkBoy'
Veteran
Joined
May 15, 2012
Messages
14,682
Reaction score
3,003
First Language
Tagalog
Primarily Uses
RMVXA
@CWells: Andar is right... why?


because


(let's put the formula first: (a.mhp-a.hp)/a.mhp)


from there: mhp is the maximum HP, while hp is the current HP


65 HP is LESS than 325 HP...


and 0.935 is higher than .675...


so less HP = higher damage


Even a logical analysis of the formula will yield similar results


As a.hp decreases, then a.mhp-a.hp increases, it's the numerator so as it increases, the quotient also increases


Basing from your post, it seems like you actually think that 325 HP is less than 65 HP... or that the (1000-value) is the HP...


@Andar - one of the values will need to be changed to float though, else that will always return 0 for those who have HP because the game will round down the decimals to integers... based from experience and from another thread that was up just a day ago I think
 
Last edited by a moderator:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,674
First Language
German
Primarily Uses
RMMV
@Andar - one of the values will need to be changed to float though, else that will always return 0 for those who have HP because the game will round down the decimals to integers... based from experience and from another thread that was up just a day ago I think
Nope, it should work without that - unless you mess with the sequence.

In the other topic, the formula needed a float because it was checking low value - but that's why the original damage formula comes in front and the division last in my formula above.

The damage formula usually results in several hundred points of damage, and is then multiplied with the HP-difference to a much higher number, before the division brings it back to regular levels. The dropped remainder of that division is no longer important, because there is no mathematical operation after the division.

If you were placing the multiplicator in front and multiply by the base damage after the division, then you would need to convert to float at the beginning, because then the multiplicator would be always below one - but in my case, you already have the much higher damage values as a base.

Now back to the values:

My formula is very simple, it would result in no damage if the player was at full HP - that's probably why CWells thought it was wrong. But to solve that problem, you need to add a base value to the multiplicator - his formula would also go wrong with MHP=HP.

Depending on what that base damage is and how it's implemented, that might require a change to float as well. But for that the OP would have to tell us how much damage his skills are supposed to do...
 

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

Latest Threads

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,860
Messages
1,017,040
Members
137,569
Latest member
Shtelsky
Top