• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

[SOLVED] Math problem... Adding/Negating percentages

J

Jaydors19

Guest
I'm making this RPG that uses stances just like an MMORPG does.

Stance 1 - Adds +25% health and negates 35% damage
Stance 2 - Adds +25% damage and negates 35% health
Stance 3 - Default (no bonus, no penalty)

Here's what they look like on HUD:
stances.png

Displaying them isn't the problem. I think my method of changing the variables is because if you click on "Stance 1" from teh default Stance 3, it adds health, but if you return back to Stance 3 you're missing 10 max health than what you had before you went to Stance 1. It keeps going down from there.

Here's what I have in my "MOUSE LEFT CLICK" events for those 3 objects:

As you can see below, it decides to add/subtract based on what stance you were in BEFORE you switch to that stance. This way you would get rid of the effect the prior stance was having.


STANCE 1 OBJECT
stance1.png

STANCE 2 OBJECT
stance2.png

STANCE 3 OBJECT

stance3.png

I'm pretty sure my math is correct. I just think my method is incorrect.

Anyone able to spot what I did wrong???









EDIT
I added a global variable that collects the max health and base damage at start of game. It's my "before stance" variable for when you're in stance 3. I simply set max health and base damage to those variables to go back to default before applying new variables for max health and base damage from other stances. This fixed the problem ENTIRELY.

The only annoyance this will cause is that i will have to add or subtract to those extra variables whenever the player equips or unequips gear.
 
Last edited by a moderator:
Top