View Single Post
  #8  
Old 09-16-2010, 12:47 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Basic client -> server interaction for a level NPC.

PHP Code:
function onCreated() {
  
// Gives the triggeraction something to hit on the server-side
  
this.setshape(1, 32, 32);
}

function 
onActionExample(npcid) {
  if (
params[0] == npcid) {
    
this.chat = "Trigger received from" SPC player.account @ "!";
  }
}

//#CLIENTSIDE

function onPlayerChats() {
  if (
player.chat == "example") triggerExample();
}

function 
triggerExample() {
  
triggeraction(this.x + 1, this.y + 1, "Example", this.id);
} 
I've never had a reason to send a message back to the level NPC specifically though, your code can probably re-factored or sent directly to the Weapon NPC via triggerclient that needs the information from the server.
__________________
Quote:
Reply With Quote