View Single Post
  #3  
Old 09-14-2010, 01:57 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
When you're developing an EXP system you should have all those functions in a player-joined class. Here have some bare-bones for one.

class: playerfunctions
PHP Code:
public function getEXP() {
  return 
clientr.stat.exp;
}

public function 
getLevel() {
  return 
clientr.stat.level;
}

public function 
addEXP(amount) {
  
clientr.stat.exp += amount;
  
checkEXP();
}

public function 
setEXP(amount) {
  
clientr.stat.exp amount;
}

public function 
checkEXP() {
  if (
getEXP() > EXPRequired()) {
    
levelUP();
  }
}

public function 
getEXPRequired() {
  
// Add a custom formula here.
  
return 10000;
}

public function 
levelUP() {
  
setEXP(0);
  
clientr.stat.level++;
  
clientr.stat.expneeded getEXPRequired();

then in your Control-NPC:

PHP Code:
function onActionPlayerOnline() {
  
player.join("playerfunctions");

then in other scripts when you know the attacker or what not

PHP Code:
function onBaddyKilled(killedby) {
  
findplayer(killedby).addEXP(100);

__________________
Quote:
Reply With Quote