ID:1544120
 
(See the best response by Ter13.)
Code:

mob/var/Strength=5
mob/var/Damage


Problem description:Okay So lets Say I'm trying to add a statistic that has a sorta rpg feel to it. Such as Damage=100% ,How would that work.Lets say you have 5 strength and you hit you're enemy.It would be exactly 5 due to 100% damage however if it were like 105% it would increase the damage output by 5%. But I woulden't really know how to code it..
Could Someone explain a possible way to do it.

I've tryed to make the damage= 1.00 or 100.0 etc..
I don't understand why you would want something like this. However, to increase a value by a percentage, you multiply by the percentage/100. Example: 100%/100 = 1

Therefore, if you wish to increase by 105, you would multiply by 1.05

var/Strength=5
var/Damage=1.8//180%
var/hit=Strength*Damage


Odds are you wont want decimals, so I would suggest using round().


var/Strength=5
var/Damage=1.8//180%
var/hit=round(Strength*Damage+0.5)//round() procedure doesn't round up. Therefore adding 0.5 will compensate for that and allow it to.
Well I want players to be able to lets say upgrade their damage by 5% as like a mmo type of feel. But anyways if I were to do that..woulden't it directly pop up as 1% in an infopanel

mob
stat()
stat(Damage:[Damage]%)

like woulden't it appear as 1% when it would technically be 100%..?

Sorry if I'm not making myself clear
Best response
Store a variable in floating-point:

mob
var
damage = 1.0


In order to get it to show up as a percentage, however:

mob
stat()
stat("Damage:","[damage*100]%")


Storing it as a floating point allows you to multiply without converting the data to a percentage. Meanwhile, in the stat() function, you can multiply the value by 100 in order to receive the human-readable percentage.
Thank you so much guys.You are both fucking geniuses. Really appreciate it ty.
Guess I just diden't think harrd enough.