please tell me what this line of Jass means.

General talk about editing, cheating, and deprotecting maps.

Moderator: Cheaters

afis
Junior Member
Posts: 26
Joined: June 22nd, 2009, 3:47 pm

please tell me what this line of Jass means.

Post by afis »

can anyone tell me what

Code: Select all

m=R2I((.01*Pow(I2R(l),2))+(1.5*l)+50)
does. It is part of a formula to determine the cumulative stat cap of a level and when I tried to look it up the best explanation I found was 0.01*x^2+1.5*x+50 where x=level. however I still don't know that I2R means, and the final result does not match the actual stat caps.
actual caps: 66 at lvl 10, 135 at lvl 50, 500 at lvl 150.

in case the interpretation of that line is correct but I missed something else I also posted a larger excerpt of the code:
Spoiler:

Code: Select all

function el takes nothing returns nothing
local unit u=GetTriggerUnit()
local player p=GetOwningPlayer(u)
local integer s=GetHeroStr(u,false)+GetHeroAgi(u,false)+GetHeroInt(u,false)
local integer l=GetHeroLevel(u)
local integer m=R2I((.01*Pow(I2R(l),2))+(1.5*l)+50)
local integer i='t'*60+GetPlayerId(GetOwningPlayer(u))
call UnitRemoveAbility(u,'Ansp')
if(s<m)then
call SetHeroStr(u,GetHeroStr(u,false)+1,true)
set ZE[i]=ZE[i]+1
else
call DisplayTextToForce(uF(p),("|cffff0000Sorry, your hero may only have "+I2S(m)+" total stats at level "+I2S(l)+"."))
endif
set u=null
set p=null
endfunction
User avatar
UndeadxAssassin
Grammar King
Posts: 2116
Joined: June 22nd, 2008, 10:11 pm
Title: Worst human for 4eva
Location: Mostly USEast

Re: please tell me what this line of Jass means.

Post by UndeadxAssassin »

I2R = Integer to Real. Turns a number that's an integer to a real number.
(20:53:52) Bartimaeus: Thank you, Jen.
(20:53:56) Bartimaeus: Truly, you are wise.
(23:44:12) Bartimaeus: I was in pubic school until middle school...
Learn how to extract and read RAW Codes here!

Need help? Click here and ask your question!
naturesfury
Forum Spammer
Posts: 610
Joined: March 30th, 2009, 9:02 pm

Re: please tell me what this line of Jass means.

Post by naturesfury »

m=R2I((.01*Pow(I2R(l),2))+(1.5*l)+50)
where l is equal to the hero lvl of u which is the triggering unit
so u take l and make it a real (which means it is a decimal)
and raise that number to the 2nd power
multiply the result by .01
add 1.5 times l
add 50
and makes m equal to that

so if the lvl of the hero was 10
it would be 10^2 * .01 + 1.5 * 10 + 50 = 100 *.01 + 15 +50 = 1 + 15 + 50 = 66
if the hero lvl is 50
it would be 50^2 * .01 + 1.5 * 50 + 50 = 2500 * .01 + 75 + 50 = 25 + 75 + 50 = 150
if hero lvl is 150
it would be 150^2 * .01 + 1.5 * 150 + 50 = 225 + 225 +50 = 500

but hmmmmmm u say its 135 at lvl 50? o.o weird
mebe u saw it wrong?