My current Procs
DeathCheck()
LevelUp()
if(DeathCheck(M) == true)
usr.exp += M.exp
if(usr.exp == usr.maxexp)
LevelUp()
return
Believe me i know that isn't correct but if that's even possible to do how would i make something like that work correctly. Please explain in lame mans terms I don't understand all the language words really.
Line 1:
if(DeathCheck(M) == true)
When checking to see if a value is true or or false(null), just do if(value). So replace that with
if(DeathCheck(M))
For future reference, if you wanted to check if it was false, you would do:
if(!DeathCheck(M))
Line 2:
At first glance this appears okay, but it all depends on how your DeathCheck() proc looks. Does your DeathCheck() delete the dead monster? If so, M no longer exists, so you've got a runtime error. If not, well then, it's fine. :)
Line 3:
if(usr.exp == usr.maxexp)
Say I have 99 exp with a maxexp of 100, I kill a monster that gives me 2 exp points. I now have 101 experience points, which is NOT equal to my maxexp. I will never level up. Use greater than or equal to (>=) instead)
if(usr.exp >= usr.maxexp)
Line 4:
If you want to call the LevelUp() proc belonging to the usr, just to be safe, you might want to change that to usr.Levelup(). Either that or learn to use arguments.
Line 5:
return
Should be fine. You don't always need to explicitly return stuff unless it would otherwise continue, but it's a good habit to have. I do it myself.