HP reading for specific actor.

Hey peeps,

I have been playing around with a few concepts from my upcoming project. In regards to this, I have been playing with a mechanic that changes interactions based on which character is set to party leader (Done by making use of conditional branches, calling the "$gameParty.leader()._actorId === #" script, a few additional bits of Java and many headaches.)

To further this I want there to be changes to specific parts of the map depending on the current HP of the party leader. I'll give an example below, but I want to know how to set the current HP of a specific party member to be read as a variable. Or if there is another way to make this happen? (Like using a script like I did for switching leader.)

Example of use.
Bob has a max hp of 10. While walking along bob stubs his toe on a rock (-1 HP) then walks into a tree (-2 HP) then gets called a wimp by a pixie (-2 hp.... because psychic damage).

Bob now has 5 HP (50%) so dashing has been disabled until he heals.

Bob then walks into a door... (bob has an acrobatics of -7) resulting in a further -3HP, leaving him a 2 (critical health).

At 2 HP the screen has a red vignette, to signal that he is mortally wounded.

Bob finds a piece of chicken in a dungeon and eats it. (Heal to Max) Now, with 10HP everything is normal. (bar possible food poisoning from dungeon chicken).

This isn't the exact use for this... Obviously. But the principles carry over, the only difference being my game has multiple party members. But I only need the variable to read the current leader. (possibly by setting multiple variables.)

Anywho, thanks for your help once more friends.

Much love,

Mushy <3
this is one of the points where eventing is a lot better than scripting.

Don't use a script command, use control variable to get the HP of the party leader - that is a preprogrammed function inside the game data section of the control variable command.

just remember that control variable has no autoupdate, you'll have to use that command repeatedly whenever you need the number
That makes a lot of sense, then possibly have it be an auto run script run on a loop?
You can't use an autorun event for this. That is because while an autorun event is in action, the player can do nothing, can't walk, can't have dialogue etc.

Each of those happenings, the tree, the rock, the pixie, will subtract the appropriate amount of HP for that occurance, and then call up a Common Event. That common event calls up the variable, and does a conditional check. If it is now less than 5, it disables dashing. At HP of 2 the red vignette is activated. The piece of chicken restores the HP and calls up a common event which re-enables dashing.
Don't use a script command, use control variable to get the HP of the party leader - that is a preprogrammed function inside the game data section of the control variable command.

I thought this was pretty cool - but I'm having trouble finding where that would be. I can get Party Member #1's actorID, but that's it. Which means you'd still need a script call to get the HP of that party member. Please let me know if I'm missing the obvious, because that would be a great feature!

The script call for the leader's hp would be $gameParty.leader()._hp
For any party member, it's $gameParty.members()[positionId]._hp
Note that positionId in the above call starts at 0 for the leader and goes up from there.

More generally, the script call is "actor._hp", where "actor" is replaced by any script call that gives you an actor object.
(And please note that Java and JavaScript are two different languages. MV uses JavaScript. This will help you if you're ever looking for info about JavaScript online.)
I thought this was pretty cool - but I'm having trouble finding where that would be. I can get Party Member #1's actorID, but that's it.
sorry, I mixed up two things - in the title the OP was asking how to get the HP of a specific actor, and in the post he specified party leader.
The first is possible with control variables, the second not.
Thanks for all your replies. I figured it out by controlling variables and setting a lot of "if else" conditions on a common event.

Original thread: https://forums.rpgmakerweb.com/threads/hp-reading-for-specific-actor.90414/