Calculating Current Damage with Variables

Dymdez

Newbie-in-Chief
Veteran
Joined
Feb 4, 2014
Messages
752
Reaction score
154
First Language
English
Primarily Uses
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
 

Susan

Veteran
Veteran
Joined
Sep 1, 2014
Messages
2,748
Reaction score
8,346
First Language
No idea...
Primarily Uses
RMMV
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. ^^
 

Dymdez

Newbie-in-Chief
Veteran
Joined
Feb 4, 2014
Messages
752
Reaction score
154
First Language
English
Primarily Uses
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 :)
 
Last edited by a moderator:

Susan

Veteran
Veteran
Joined
Sep 1, 2014
Messages
2,748
Reaction score
8,346
First Language
No idea...
Primarily Uses
RMMV
Simpler than that:

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

Then check for $game_variables[x]'s value.
 

EatYourBeetS

The Abysswalker
Veteran
Joined
Feb 23, 2015
Messages
96
Reaction score
30
First Language
Italian
Primarily Uses
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
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,867
Messages
1,017,061
Members
137,575
Latest member
akekaphol101
Top