Making an attack that does more damage with less HP you have?

How do i make an attack that does more damage the less HP you have?Like in Chrono Trigger, with Frog Squash, and Pokemon with Flail and Reversal?

And if it's possible, how do I make an attack that only works if you have full HP?
Use a custom damage formula that takes "a.hp" being compared to "a.mhp" as your multiplier of sorts.

For the attack only working if your HP is full, use:

if a.hp == a.mhp? (damage formula here without parenthesis); 0If you want the skill/attack to not be select-able unless the condition is filled, you'll need a custom script for it and make its condition.

(someone correct me if I wrote the formula wrong)
Use the database equation (example a.atk * 4 - a.hp * .10). It takes attack lets say 100 and times it by 4. So it is 400 and uses 1/10 of the users current hp and subtracts it from that value. If he has 1000 hp then it would subtract 100. If he has 2000 hp it would subtract 200. Modify it to your specifications.

For your second question you might want a script I believe and I cant recall which one would be great for it. I am drawing a blank.

Or actually you could use a condition in the troop command set it to have actor = 100% hp or less and have it activate the following skills.
A better formula for increased damage when HP is reduced might be this one:

The first part is the ordinary damage formula, whatever you use.  The next part in parenthesis is the addition which is calculated depending on your actual HP at the time the skill is used.  I'll give the formula, and then show how it works.

a.atk*4 - b.def * 2 + ((a.atk*4 - b.def * 2) * (a.mhp - a.hp)/a.mhp)

[SIZE=10.5pt]So a worked example would be[/SIZE]

[SIZE=10.5pt]ATK = 60, DEF = 40, MHP = 500, HP = 200     Therefore the character has lost 60% of HP, so you want to increase the damage by 60% (if you want a different percentage, we'll come to that at the end) which would mean an increase of 96HP[/SIZE]

[SIZE=10.5pt] [/SIZE]

[SIZE=10.5pt]240 - 80 + ((240 - 80) * (500 - 200)/500)    equals[/SIZE]

[SIZE=10.5pt]160 + (160 * (300/500)  equals[/SIZE]

[SIZE=10.5pt]160 + (160 * 0.6)  equals[/SIZE]

[SIZE=10.5pt]160 + 96  = 256[/SIZE]

[SIZE=10.5pt]If you want it to apply a different percentage then you need to alter the final part of the formula.  So for 1% increase for every 2% HP loss, it would read:[/SIZE]

[SIZE=10.5pt]a.atk *4 - b.def * 2 + ((a.atk*4 - b.def * 2) * (a.mhp - a.hp)/(a.mhp/0.5))[/SIZE]
Alright, thanks guys. I kinda wanted the move so that a certain strategy could be pulled off...

But I have another issue with the thing. I've used the state that prevents you from getting KO'd, but when it wears off, the character is instakilled. Is there a way to make the HP stop at 1 instead of zero? I'd like to know this, because a strategy could be made with the attack that deals more damage with less HP.

Original thread: https://forums.rpgmakerweb.com/threads/making-an-attack-that-does-more-damage-with-less-hp-you-have.35808/