SphereCommunity
Combat system math problem - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: General Help (/Forum-General-Help)
+--- Thread: Combat system math problem (/Thread-Combat-system-math-problem)



Combat system math problem - pushim - 06-01-2015 11:28 AM

hello, i have a math question
as achievement increase damage by 10%?

i'm do this
ARGN1 += <weapon.dam>
ARGN1 += <eval <<weapon.dam>*(<anatomy>)*(10/100)*(1/100)>>


if for example
<weapon.dam> = 20
ARGN1 + = 2 (+ 10%)

but in game doesn't work this :/


RE: Combat system math problem - Coruja - 06-01-2015 04:05 PM

<eval> only works with integer numbers (0, 1, 2, ...) and not floats (0.1, 0.001, 0.0001, ...)

10/100 = 0.1 and 1/100 = 0.01, but using these values inside an <eval> it will automatically change these values to int and both values will be 0

so your formula is not working because <eval <<weapon.dam>*(<anatomy>)*0*0>> will always result 0

to use float numbers you must use <floatval> instead <eval>, and dont forget that ARGN1 only works with int numbers so after get the float value you must change it back to int using <feval>

eg:
<feval <floatval 3 * 1.5>> =
<feval 4.500000> =
4

but anyway, I dont know what are you trying to do on this formula, but to get a simple bonus of 0% ~ 10% based on your anatomy skill you must use something like:
Code:
ARGN1 += <WEAPON.DAM>
ARGN1 += <eval ((<WEAPON.DAM> * (<ANATOMY>/100)) / 100)>



RE: Combat system math problem - pushim - 06-02-2015 06:38 AM

So simple that i'm ashamed, and the explanation of eval and float serves me much
THX Coruja!!!!