Quote:
Originally Posted by cbk1994
SUPER LONG QUOTE
|
I tried to do it like you suggested, but it didn't work, so I put in some echoes. It seems like the .link() doesn't survive the return. What could I do to fix that? I guess I just have to get every single value by itself, don't I?
These are the echoes:
HTML Code:
trigger1 in -Inventory
trigger2 in -SWeapons
ID:Sword1
trigger3 in database npc
damage before returning:20
damage after return:
And this is my code (which is basically yours but with different names for variables)
weapon -SWeapons:
PHP Code:
function onSWeaponEquipped(sweaponID) {
echo("trigger2 in -SWeapons");
echo("ID:"@sweaponID);
temp.sweapon = sweapons.getSWeapon(sweaponID);
echo("damage after return:"@temp.sweapon.damage);
clientr.sweapon.sweaponName = sweapon.sweaponName;
clientr.sweapon.attackSpeed = sweapon.attackSpeed;
clientr.sweapon.damage = sweapon.damage;
clientr.sweapon.typus = sweapon.typus;
clientr.sweapon.typus2 = sweapon.typus2;
}
database npc sweapons:
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
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.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");
temp.test = this.sweapon.(@ sweaponID).link();
echo("damage before returning:"@temp.test.damage);
return temp.test;
}