View Single Post
  #14  
Old 01-25-2011, 10:55 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Odd, I thought link worked like that.

This ought to work:

PHP Code:
function onInitialized() {
  
this.trigger("created"); // re-add values on start incase they were removed
}

function 
onCreated() {
  
this.sweapon.clearVars(); // empty variables so strays aren't left over to cause problems
  
  //No Weapon
  // added the below statement;
  // make sure to change the name ("SwordNone") for each sword, it doesn't
  // matter what it is, it just needs to be unique (it would be a good idea to prefix
  // it with Sword to prevent conflicts with other objects)
  
this.sweapon.none = new TStaticVar("SwordNone");
  
this.sweapon.none.sweaponName = NULL;
  
this.sweapon.none.attackSpeed = NULL;
  
this.sweapon.none.damage = NULL;
  
this.sweapon.none.typus = NULL;
  
this.sweapon.none.typus2 = NULL;
  
  
// Sword 1
  
this.sweapon.Sword1 = new TStaticVar("Sword1");
  
this.sweapon.Sword1.sweaponName = "Sword 1";
  
this.sweapon.Sword1.attackSpeed = 0.2;
  
this.sweapon.Sword1.damage = 20;
  
this.sweapon.Sword1.typus = "slash";
  
this.sweapon.Sword1.typus2 = "normal";
  
}

public function 
getSWeapon(sweaponID) {
  echo(
"trigger3 in database npc");
  
// removing link() from here since it now points to an actual object
  
temp.test = this.sweapon.(@ sweaponID);
  echo(
"damage before returning:"@temp.test.damage);
  return 
temp.test;
} 
__________________
Reply With Quote