Quote:
Originally Posted by edon1337
Code:
for(new i = 1; i <= MAX_LEVEL; i++) {
p_Level[i++]
continue;
}
This?
|
Quote:
Originally Posted by CreativeTR
of course not
example:
HTML Code:
for(new i = 1; i <= MAX_LEVEL; i++) {
if(currentExp >= (currentExp*i) && currentExp <= (currentExp*i) + (currentExp*i)) {
p_Level[i]
break;
}
}
|
Neither of those make any sense. They don't actually do anything.
This function will give you the required XP for the supplied level:
Code:
stock getLevelXP(level)
{
return level > 0 ? getLevelXP(level - 1) + ADD_EXP_PER_KILL * (level - 1) : 0
}
And you can use it like this:
Code:
PlayerLevel = XP > getLevelXP(PlayerLevel + 1) ? PlayerLevel + 1 : PlayerLevel
Note that it won't automatically detect a gain of more than 1 level between subsequent executions. So, you either need to compensate by calling it often enough that that situation never happens or use a loop to count up from
PlayerLevel + 1 until
XP > getLevelXP() returns false.
__________________