How to have a constantly updating variable that is equal to the Player's Current HP?

I've already seen and tried the parallel process in the initial scene (I also have an autorun playing at the same time due to a cut-scene) from the following threads:

and

But when I try to call the variable through an If Conditional to check if it's less than or equal to 1. The event won't start. The event tile is on a tile that can't be moved onto, so I've set it to action button. Yes, the priority is set to "Same as characters" so that it actually works when interacted with by the player.

But the variable checking event simply doesn't work. It has to check if the variable is set to 1 or lower, or else the event doesn't start. Since it isn't starting, it seems like the variable isn't being set in the first place (or isn't being updated.) On the parallel process I've set the #0001 Variable to whatever the player's HP is; and I need this variable to constantly be updating even when the player changes maps so that I can check how much the player's HP is to trigger an event like this.

1680541429342.png
1680541476600.png

There's no conditional branch to check the player's current HP directly, has to be set to a variable and checked.

1680541566870.png


That's one reason why I wanted to figure out a way to stop Game Overs in a previous thread I posted: https://forums.rpgmakerweb.com/inde...eaches-0-dead-state-from-damage-tiles.156376/
You can check an actor's HP as a direct condition using the script option. What is the parallel event meant to do?
Apparently I've asked about this before: https://forums.rpgmakerweb.com/index.php?threads/checking-hp-globally-at-all-times.32593/

But since that's not for MZ, how do I go about doing that again with script syntax? Since I know nothing about what global data is stored, such as actor HP in RPG Maker MZ.

I'm dumb, all I have to do is put...

JavaScript:
$gameParty.leader().hp <= 1

...into the script box on the last tab of the conditional dialogue box.
all I have to do is put...

JavaScript:
$gameParty.leader().hp <= 1

...into the script box on the last tab of the conditional dialogue box.
Yup. In MV this process is automated when using YEP_AdvancedSwVar

You can simply put "eval: $gameParty.leader().hp" in the name of a variable, and that variable is always returning the HP of the leader.

It works for switches too. Put "eval: $gameParty.leader().hp <= 1" in the name of a switch, and that switch will always be on if the leaders HP is 1 or below, and off otherwise.

I don't know which MV plugins do or do not work with MZ, if any, but if you happen to have the yanfly plugins, you could always try. If it doesn't work, then I'm sure there is a plugin like this for MZ too. It shouldn't be too hard to make and I couldn't be the only one who loves this feature. First place I would look, is the VisuStella plugins.
Yup. In MV this process is automated when using YEP_AdvancedSwVar

You can simply put "eval: $gameParty.leader().hp" in the name of a variable, and that variable is always returning the HP of the leader.

It works for switches too. Put "eval: $gameParty.leader().hp <= 1" in the name of a switch, and that switch will always be on if the leaders HP is 1 or below, and off otherwise.

I don't know which MV plugins do or do not work with MZ, if any, but if you happen to have the yanfly plugins, you could always try. If it doesn't work, then I'm sure there is a plugin like this for MZ too. It shouldn't be too hard to make and I couldn't be the only one who loves this feature. First place I would look, is the VisuStella plugins.

I am currently using VisualStella Engine Core, so it might be providing that functionality in MZ, or it might be a default feature of MZ, I don't know. All I know is, it works:

1680549787135.png
Yes, that is default. But that is not constantly updating, as you asked in the title. To update it constantly, you do need a plugin. For MV that would be yanfly's plugin.

If VisuStella can do the same thing, and I think it can, you will need an addon plugin. It will most likely not be part of the engine core.

I don't use VisuStella myself, so I cant say for sure, but I think one of the add-ons should be able to do this, since they were meant to replace the yanfly plugins.

Anyhow, seems like it being a constantly updated variable is no longer the solution you're looking for. If this condition is the solution for you, then you don't need the plugin at all. 😛

Original thread: https://forums.rpgmakerweb.com/threads/how-to-have-a-constantly-updating-variable-that-is-equal-to-the-players-current-hp.156377/