View Single Post
  #13  
Old 01-06-2011, 04:36 PM
AlexanderK AlexanderK is offline
Registered User
AlexanderK's Avatar
Join Date: Mar 2006
Location: Germany
Posts: 79
AlexanderK is on a distinguished road
Send a message via MSN to AlexanderK
Thanks for the help again cbk1994. I managed to get most of my Inventory done, as it is a weapon and I can use triggerserver and triggerclient without problems.
However I still can't access my player. itemfunctions from normal NPCs . Even though I copied your suggestion and only changed a few minor things, I get this error:
Quote:
Script: Function -ItemServerFunctions.showCategories not found at line 10 in script of npcs[13] (in level tilestest.nw at pos (32, 18))
I have no idea what the problem is, as the player has this weapon...

Here is the script of the NPC.
PHP Code:
 //#Clientside
  
function onCreated() 
 {
 
this.setshape(1,32,64);

 }
function 
onPlayerChats() {
  
temp.tokens player.chat.tokenize();
  if (
tokens[0]=="/getcategories"
  (@
"-ItemServerFunctions").showCategories(this);


This is the script of the weapon -ItemServerFunctions
PHP Code:
function onActionServerSide() {

  if(
params[0]=="getCategories") {
    
temp.categories=player.getCategories();
    
triggerClient("gui"this.namecategories);
  }
  
  if(
params[0]=="addItem") {
    
player.addItem(params[1], params[2], params[3], params[4], params[5], params[6]);
  }
  
 }

//#CLIENTSIDE

public function showCategories(npcToUpdate) {
  
this.npcToUpdate npcToUpdate;
  
triggerServer("gui"this.name"getCategories");
}

public function 
addItem(category,itemname,equippable,droppable,usable,quantity) {
  
triggerServer("gui"this.name"addItem"categoryitemnameequippabledroppableusablequantity);
}

function 
onActionClientSide(categories) {
 
this.npcToUpdate.chat="Categories: " categories.size() @ " first category: " categories[0][0];

Man... All these interactions between different objects and sides is so complicated.
Reply With Quote