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;
}