View Single Post
  #2  
Old 09-05-2011, 06:32 PM
DrakilorP2P DrakilorP2P is offline
Registered User
DrakilorP2P's Avatar
Join Date: Apr 2006
Posts: 755
DrakilorP2P is just really niceDrakilorP2P is just really nice
Something like this?
PHP Code:
public function addExperience(temp.amount)
{
  
temp.experienceTable = {
    
0,   //Level 1
    
100//Level 2
    
300//Level 3
    
600//Level 4
    
1000 //Level 5
  
};
  
  
this.clientr.rpg_experience += temp.amount;
  
  
temp.newLevel = -1;
  for (
temp.temp.experienceTable.size() - 1temp.>= 0; --temp.i)
  {
    if (
temp.experienceTable[temp.i] <= this.clientr.rpg_experience)
    {
      
temp.newLevel temp.1;
      break;
    }
  }
  
  
assert(temp.newLevel != -1);
  
  if (
temp.newLevel != this.clientr.rpg_level)
  {
    
this.clientr.rpg_level temp.newLevel;
    
this.trigger("onLevelUp");
  }

Sorry for just posting code; I'm not sure how to describe it in English.
__________________
Testbed user: I figured since I can never find any scripters it was time to take desperate measures...and...TEACH MYSELF 0.0
Reply With Quote