SphereCommunity
@Hit, ARGN1 and floatval/feval - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: @Hit, ARGN1 and floatval/feval (/Thread-Hit-ARGN1-and-floatval-feval)



@Hit, ARGN1 and floatval/feval - Murmur - 05-10-2017 03:06 PM

Whats up guys, I was cruising along on my custom @Hit algorithms and I was making major progress until I hit this scenario and I can't figure out the magic formula.

Ok, so in my @Hit I have a long equation that, lets just say for ease, set ARGN1 = 22

That formula has been tested extensively ingame and works great.

Then I wanted to grant a bonus to that ARGN1 algorithm if the weapon in question was a 2hander.

So I simply wanted to take my ARGN1 = 22, and give a 10% bonus if it was a 2hander instead of a 1hander.

So logically I make ARGN1 = 22 * 1.1

Well, in the debugging process I instantly saw that eval was dropping it.

So I instantiated a variable, LOCAL.TWHOHANDBONUS equal to 1.1, and I tried 0.1, and I tried .1

Next I tried <floatval <LOCAL.TWOHANDBONUS>>, <floatval <fval <LOCAL.TWOHANDBONUS>>>

None of which worked, so here I am asking for help, I need to take my ARGN1 value in @Hit and add 10% to it, any ideas?

Thanks as always for the help.
-Murmur

I just thought about maybe doing all the math outside of ARGN1, then calling the result via a variable on the ARGN1 line?

Found the FLOAT.*** information in the WIKI, and I tried to do FLOAT.TWOHANDSBONUS = 1.1

I did ARGN1=22*<FLOAT.TWOHANDSBONUS> and it creates some massive numbers.. So still looking for the solution.


RE: @Hit, ARGN1 and floatval/feval - Murmur - 05-10-2017 04:10 PM

Ok I got the result I wanted using Muldiv:

LOCAL.HitPassToARGN1 = 22
LOCAL.HitPassToARGN1Percent10 = <muldiv <LOCAL.HitPassToARGN1> 10 100>

ARGN1 = <LOCAL.HitPassToARGN1> + <LOCAL.HitPassToARGN1Percent10>

Seems like there is an easier way but maybe not, any suggestions would be helpful. Smile

As always, thanks for the help