View Single Post
  #4  
Old 01-22-2011, 01:18 AM
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
My suggestion:

One database NPC named, say, Swords, formatted like so:

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

function 
onCreated() {
  
this.sword.clearVars(); // empty variables so strays aren't left over to cause problems
  
  // Super Sword
  
this.sword.supersword.swordName = "Super Sword";
  
this.sword.supersword.attackSpeed = 0.2;
  
this.sword.supersword.damage = 20;
  
  
// ****ty Sword
  
this.sword.****tysword.swordName = "****ty Sword";
  
this.sword.****tysword.attackSpeed = 1.2;
  
this.sword.****tysword.damage = 1;
}

public function 
getSword(swordID) {
  return 
this.sword.(@ swordID).link();
} 
then have a single weapon, named something like -Swords, that controls equipping of swords (have the inventory trigger it when the player equips a new sword)

PHP Code:
function onSwordEquipped(swordID) {
  
temp.sword = Swords.getSword(swordID);
  
  
player.clientr.sword.swordName = sword.swordName;
  
player.clientr.sword.attackSpeed = sword.attackSpeed;
  
// etc..
} 
Then in the clientside of -Swords you can read from the clientr variables.

(anyone ever realize what a weird word "sword" is?)
__________________
Reply With Quote