# Abilities that get more effective vs low health enemies?

#### ZackNH

##### Veteran
Is there a way (or a script that allows for it) to make an attack that become more effective vs enemies with low HP?
I have three types in mind:

1. An ability that does more damage.
2. An Execute that can instantly kills an enemy that's below a certain percentage threshold.
3. An abilitiy that has a higher chance to inflict status effects.

#### bgillisp

##### Global Moderators

I've moved this thread to ACE Support. Thank you.

All of these can be done via the damage formula most likely. Use b.hp to call the enemies HP and b.mhp to call their max HP. Fro there you'll have to work out the math so that it does what you want, as no one knows your stats in your game but you.

#### MushroomCake28

##### KAMO Studio
Code:
``b.hp / b.mhp``

This will give you a coefficient that goes from 0 to 1 depending on the enemy's health (0 being when it's KO and 1 being when it's at max hp).

#### Heirukichi

##### Veteran
I agree with what @bgillisp said. Just to make things easier for you I am going to provide a rough skeleton for those formulae. Keep in mind that I will be using D as "Damage Formula". This represents a whole formula, to be more accurate, it represents the whole skill formula. If I were to use it to refer to the basic auto-attack formula it would represent the whole (a.atk*4 - b.def*2). Remember to change it later on. X is the value of the multiplier you want to use, change that one as well, as it has been said, nobody knows those values in your game but you.
Code:
``Math.floor(D * (1 + X * (1 - b.hp/b.mhp)))``
This can be done in a different way, for example setting up a minimum health percentage to trigger the skill. The overall skeleton is the same, but you have to change the part after X in it.
Code:
``X * (threshold - Math.min(threshold, b.hp/b.mhp))``
This is just an example, if you set a proper threshold and then change X accordingly you have what you are looking for.
Code:
``(b.hp/b.mhp < X) ? (b.addState(1); b.mhp * 8) : D``
Code:
``var r = (b.hp/b.mhp < X ? A + B : A); b.addState(ID) if (Math.random() < r); D``
In this formula A represents the normal chance to apply the status effect while B represents the extra chance. ID is your state id.

EDIT: Since this is for MV I changed the formulae into MV ones.

Last edited:

##### Chemical Engineer, Game Developer, Using BlinkBoy'
Code:
``b.hp / b.mhp``

This will give you a coefficient that goes from 0 to 1 depending on the enemy's health (0 being when it's KO and 1 being when it's at max hp).

or just simply b.hp_rate

#### Heirukichi

##### Veteran
Code:
``b.hp / b.mhp``

This will give you a coefficient that goes from 0 to 1 depending on the enemy's health (0 being when it's KO and 1 being when it's at max hp).
This will actually give you either 1 (when b.hp is equal to b.mhp) or 0 (whenever b.hp is less than b.mhp). You have to use either b.hp_rate or call a to_f method on either b.hp or b.mhp.

#### MushroomCake28

##### KAMO Studio
@Engr. Adiktuzmiko Oh lol, I never knew that existed xD.

@Heirukichi Oh, I forgot this is for VX Ace. You're right. In MV though, javascript will consider it a float by default.

#### ZackNH

##### Veteran
[move]ACE Support[/move]

All of these can be done via the damage formula most likely. Use b.hp to call the enemies HP and b.mhp to call their max HP. Fro there you'll have to work out the math so that it does what you want, as no one knows your stats in your game but you.

This is an MV post, not Ace. I should have specified that.

Edit:
To be fair, I didn't think I'd need to given that I posted it under MV.

#### hiddenone

##### Lurker Extraordinaire

Moving to MV Support.

Your 'Primarily Uses' says Ace, so you can understand where the confusion came from.

#### ZackNH

##### Veteran
[mod]Moving to MV Support.[/mod]
Your 'Primarily Uses' says Ace, so you can understand where the confusion came from.

Oh, crap. Sorry, I forgot to change that.

#### bgillisp

##### Global Moderators
And you also posted under game mechanics design originally and how do I questions are not a discussion of a mechanic

#### ZackNH

##### Veteran
And you also posted under game mechanics design originally and how do I questions are not a discussion of a mechanic

Okay, good to know for future reference.

#### Heirukichi

##### Veteran
I changed the formulae skeletons I posted in my previous post into MV ones. I might have still missed something when editing them, but if I did not they should work.

### Latest Profile Posts

My hand hurts from holding the pen for so many hours none stop...
I have to ask, who's on your pfp? The character really reminds me of Edgeworth from Ace Attorney lol. I'm really curious.

I'm trying to port L10nMV.js into XP, may probably (because this is my toy project in hobby) coming to XP, VX, VXA.

L10nMV.js forum post : https://forums.rpgmakerweb.com/inde...r-game-without-modifying-your-project.120813/
Here's a gif of the reflection. Ace has some pretty cool sprite effects.