Useing a function to update player level
Posted: Wed Jan 25, 2017 6:20 am
So im working on a hey RPG and I brought a function to figure my level from my experience points but I don't know how to make it so that it updates My Level globally if that makes any sense
See if I enter 25 for experience and one for level run the function it will say congratulations level 2 but if after the function I put print level it'll come back one
Code: Select all
--sets the level based on exp
function levelCheck(exp,level)
repeat
c=math.sqrt(exp)-(level*4)
if ( c>=1 ) then
level=level+1
print("Congradulations level "..level)
end
until ( c<1)
return level
end