Calculating Current Damage with Variables

Hi - still rusty, sorry guys.

How do I set a variable to equal my actor's max HP - current HP? I want to be able to calculate how much damage the actor has taken at a certain point in a mini-game in order to award prizes based on this number.

Thanks

As always, a haiku based on my topic

oh, the hits we take

for those that we love and hate

but still we fight on
1) Set one variable to equal the actor's MaxHP.

2) Set another variable to equal the actor's HP.

3) Use the first variable to subtract the second variable, and you will get the difference between current and max HP.

Hope this helps. ^^
1) Set one variable to equal the actor's MaxHP.

2) Set another variable to equal the actor's HP.

3) Use the first variable to subtract the second variable, and you will get the difference between current and max HP.

Hope this helps. ^^
Thanks Susan, how exactly do I do the third step?

Like this? "$game_variables[z] = $game_variables[x] -= $ game_variables[y]"

So rusty 🙁

edit: got it, thanks 🙂
Simpler than that:

$game_variables[x] -= $game_variables[y]

Then check for $game_variables[x]'s value.
You can actually do it with just one global variable (or with no g. variables at all), just do this:

$ game_variables [id] = $ game_actors [id].mhp - $ game_actors [id].hp

Original thread: https://forums.rpgmakerweb.com/threads/calculating-current-damage-with-variables.38148/