Sorry if this is in wrong section.
What formula would I use for an attack that get's stronger, when you have less hp?
RPG Maker VXAce SupportBasically 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)
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
@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
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
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...
Original thread: https://forums.rpgmakerweb.com/threads/what-formula-would-i-use-for-an-attack-that-gets-stronger-when-you-have-less-hp.19518/