Hey! I'm facing a little problem...I'm making a RPG (It's shaping up real nice) and it features a turnbased battle system. There are different types of grenades you can throw. If you throw a firegrenade, it reduces your enemy's defence. I have a variable set to 25, meaning that your current skill allows you to reduce your enemy's defence by 25 % if you throw a fire grenade. However...I don't know how to make a calculation so the game understand that the number 25 is percentage...not 25 points...the enemy's stats will be different depending on which ones you meet...so I want to have a calculation that will always remove 25% (or 30,35,40 etc, depending on how much you level up the skill) from the enemy's current defence stat. Is there anyone here who can teach this moron some math? :D Maybe it is really simple but my mind is fried right now haha
Remember what "percent" means? - a part of 100. One percent is 1/100. Two percents is 1/100 + 1/100 = 2/100. 25 percents is 25/100.
X percents is X/100.
Calculating a fraction of something when knowing percent value:
RESULT = VALUE * PERCENTS_NUMBER / 100
Aha Thanks man! :D
Ahhh..stupid program won't do what I say...maybe I didn't quite understand your expression :D Well...I do understand it but the program won't do it hehe
maybe you have to use floats or convert the result to an integer?
hmm yeah maybe!!! I'll check that out!
I got it working!!! Had to write 100.0 instead of 100 :D
They're aaaall floats down here...
Haha yeah :-D just glad to get it working
:-D