Set HP based on a variable

Hi! I'm sure this is very basic, but I couldn't figure it out by myself... I need a specific character (hero #1) to have a certain number of HP based on a variable. The "gain" or "lose" HP command won't work for me; I need to be able to set it to an exact number for an event purpose...

I imagine it can be done with a Script Call, but I checked the list and didn't find an example that includes the use of variables.

Thank you very much in advance!
You can do this with event commands.

If I want Reid to end up with 23 HP:
1714495405468.png


And, of course, all references to "23" can simply be replaced by a reference to another variable.

You can also use a Script command:
Code:
$gameActors.actor(1).gainHp(23 - $gameActors.actor(1).hp)
where 1 is the ID of the actor.

And you can reference a variable there by replacing 23 with $gameVariables.value(42) where 42 is the ID of the variable.

But, again, you should be able to do this using the included event commands.
It worked!!! Thank you so much! I finally used the method with the script... thanks for the clarity and speed in your response! 😀

Original thread: https://forums.rpgmakerweb.com/threads/set-hp-based-on-a-variable.168205/