View Single Post
  #2  
Old 03-18-2012, 04:01 PM
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
It sounds like you're using the same name for the button for all of the NPCs. You didn't paste enough code to be sure, but I'd bet you're doing something like

PHP Code:
function BuyHat_Buy.onAction() {
  
triggeraction(this.x,this.y,"BuyHat","",this.hat_name,this.hat_price);  
} 
This function is going to be called on every script in the level. The easiest way to fix it is to specify the NPC when creating the window:

PHP Code:
// in the npc that creates the window
BuyHat_Window.npc = this; 
and then in the event:
PHP Code:
function BuyHat_Buy.onAction() {
  if (
BuyHat_Window.npc == this) {
    
triggeraction(this.x,this.y,"BuyHat","",this.hat_name,this.hat_price);
  }
} 
__________________
Reply With Quote