# How to reduce the life of the actor by means of percentage?

#### TheBreaker24998

##### Veteran
Hello everyone, I am doing an event where for example:

If the life of the actor is equal to 70%, something happens.

I tried to do it through variables and conditional derivations that the program offers me, but the life of the actor can only be decreased by means of points, not by percentages, such as:

if the actor's life equals 300, something happens

But I need it to be by percentage.

Is there a way to do it?

Thank you!

Something I forgot to mention:
The actor does not have a defined HP, since he must level up, therefore, if he levels up, his HP changes in value, therefore it is not known how much HP he will have when he executes that mission, that is why I need by means of percentage

Last edited:

#### Eliaquim

##### Hakuen Studio
Hi!
You can discover it with a simple "rule of 3".

100% = 300
70% = x

Then you cross multiply the numbers.

x = (300*70) / 100
x = 210.
70% of the actor's hp is 210 points.

#### TheBreaker24998

##### Veteran
[QUOTE = "Eliaquim, publicación: 1119715, miembro: 123037"]
¡Hola!
Puedes descubrirlo con una simple "regla de 3".

100% = 300
70% = x

Luego cruzas, multiplicas los números.

x = (300 * 70) / 100
x = 210.
El 70% del CV del actor son 210 puntos.
[/ CITAR]
I understand what you want to tell me, and it's fine, but there is a problem, it's something I forgot to mention, the actor can have any amount of HP, since the actor must level up, so if for example if the actor in the level 1 It has 300 hp, at level 2 it will increase its HP, it will be different from 300, it is a mission that will be in the middle of the game, it is a video game in which you must level up and have combat with enemies, therefore, that percentage is unknown, it is not known if the actor will have 300 hp or 400 or 500 when he performs that event, therefore what you tell me would not work

#### Aerosys

##### Veteran
I think you can get the MaxHP by using a Variable Operation. Otherwise you can call a script snippet

const mhp = \$gameParty.actors.get(1).mhp;
\$gameVariables.setValue(1, mhp);

Havent checked this snippet as Im not at home. You may want to use others numbers than 1 from this example.

#### CHKNRAVE

##### Surprisingly not sponsored by Yanfly.
If it's damage given by a skill, it's as easy as `(b.mhp*30)/100` in the damage formula for 30% HP lost.
If the damage in formula is already occupied, try this: `a.gainHp(0-(a.mhp*30)/100)); FORMULA` and replace `FORMULA `with the damage formula you already have. This will remove 30% HP from the user of the skill, no matter who is targeted.

Through eventing:
First, set up a temporary variable. Any variable slot will do.
Set its value to the max HP of the actor that's going to lose HP.
Multiply that variable by 30.
Divide that variable by 100.
Select "Change actor HP", and decrease the HP of the actor you picked by the number contained by the variable.

#### Zerothedarklord

##### Veteran
[QUOTE = "Eliaquim, publicación: 1119715, miembro: 123037"]
¡Hola!
Puedes descubrirlo con una simple "regla de 3".

100% = 300
70% = x

Luego cruzas, multiplicas los números.

x = (300 * 70) / 100
x = 210.
El 70% del CV del actor son 210 puntos.
[/ CITAR]
I understand what you want to tell me, and it's fine, but there is a problem, it's something I forgot to mention, the actor can have any amount of HP, since the actor must level up, so if for example if the actor in the level 1 It has 300 hp, at level 2 it will increase its HP, it will be different from 300, it is a mission that will be in the middle of the game, it is a video game in which you must level up and have combat with enemies, therefore, that percentage is unknown, it is not known if the actor will have 300 hp or 400 or 500 when he performs that event, therefore what you tell me would not work

Create a parallel common event, with the trigger being any switch you enable at the start of the game that is meant to always be on.
In the common event, do Control Variable, designate a variable (in this example, variable 1), choose Set, then choose Game Data, Actor, select the actor, then hit Max HP.
By doing this, you will now have the game constantly refreshing the value of the variable you designated for the actor's max HP, in this case, variable 1.

Now you can do what Eliaquim said, because you now have the value of the character's Max HP constantly refreshing to ensure it's accuracy, regardless of level.

Last edited:

#### Eliaquim

##### Hakuen Studio
Ah, ok I get it.
But you can do all of this with variables.

### Latest Profile Posts

Hello! I found a post of lightning strike pictures you posted. You said you made them, am I allowed to use them in my commercial project. Would be really cool!^^

Have a nice day!
It's almost 3 month and this piece of drawing is still not finished yet.

Really busy with other stuffs like commission and coping with personal problem.
Stella & Elyune, maybe used for promotional art if my game project finished one day.
DRAWING PROCESS
My ex put my heart upon a self he said don't give me no lines and keep my hands to myself :,(
An Old... old Harold | RPG Maker News #71