(Conditional Branch) check if an actor's HP is full (percentage)?

- Example:
1585496939236.png

-
I know this code: $gameActors.actor(n)._hp = x
however I can only replace the x with specific numbers, I want to check for percentages, but I have no idea how.

Is there a way to use only script calls for this? Without storing numbers in variables, adding invisible states and the like?
Calculating percentage is simple:

(a / b) * 100

so replace a with $gameActors.actor(n).hp
then replace b with $gameActors.actor(n).mhp

multiply it by 100 and you get result in percentage.

Oh, to get more precise result, use Math.floor() function

example:
var x = Math.floor((a/b)*100);
hpRate() returns a float of the current HP percentage.

So for your script, use $gameActors.actor(n).hpRate() == 1
You can also use
Code:
$gameActors.actor(n).hp === $gameActors.actor(n).mhp

Edit: oh didn't see it had to be a percentage check, my bad.
@ramza That does the trick!

@Astfgl66 that also works! Just want to check if the HP bar is full.

Thanks everyone! 😢
If I want to make Hp actor is zero, how?
$gameActors.actor(id).gainHp(-$gameActors.actor(id).mhp);

This will set actor's HP to 0
Thanks

Original thread: https://forums.rpgmakerweb.com/threads/conditional-branch-check-if-an-actors-hp-is-full-percentage.119588/