This issue is for MZ and SRDde’s HUD Maker Ultra. I was wondering how would I check an actor’s HP as a percent. For example, if an actor is at 35% HP I want an image to appear.
Checking HP as a percent (HUD Maker Ultra)
RPG Maker MZ SupportAssuming you have your reference to your battler, battler.hpRate() == .35.
Or you can use the regular way you get the percentage between any pair of numbers. battler.hp/battler.mhp == .35
I input the bottom line into Hud Maker and got an error message saying, "battler is not defined"
yeah, that was under the assumption that you already worked out your battler reference. its dependent on who's hp you want it to be looking at. if its supposed to be a specific party member, the reference would be $gameActors.actor(ACTOR ID), and if its by party position, its $gameParty.members()[PARTY SLOT - 1]
for example, if you wanted it to be the party leader's hp, its
Code:
$gameParty.members()[0].hpRate() == .35 // <- if the party leader is at 35% hp
I got the meter to appear, but it doesn't appear when the member's HP is at 35%. This is the code I used.
Code:
const $gameParty.members()[PARTY SLOT - 1]
return $gameParty.members()[0].hpRate() == .35
I havent used at the plugin, but you shouldn't have to declare a variable or return a value. All you would need to do is set the display condition to "$gameParty.members()[0].hpRate() == .35"
That should show what you wanted if the actor was exactly at 35%. In case you meant 35% or lower, replace == with <=
Also ACTOR ID and PARTY SLOT - 1 weren't to be copied. I didn't say it, but I meant for you to replace those values depending on which you chose and what you wanted. Like the leader is slot 1, so you'd use 0
That should show what you wanted if the actor was exactly at 35%. In case you meant 35% or lower, replace == with <=
Also ACTOR ID and PARTY SLOT - 1 weren't to be copied. I didn't say it, but I meant for you to replace those values depending on which you chose and what you wanted. Like the leader is slot 1, so you'd use 0
I input the code, but still didn't display.
Sorry, this issue is being a pain in the rear.
ok, just tried it myself. return does need to be at the start of that line. I didnt remember the MV version of hudmaker needing the user to have it, so i assumed the same of the MZ one. My bad on that one
Code:
return $gameParty.members()[0].hpRate() <= .35;
It finally worked, thanks for helping me out.
Original thread: https://forums.rpgmakerweb.com/threads/checking-hp-as-a-percent-hud-maker-ultra.169788/