View Single Post
  #5  
Old 03-18-2012, 04:59 PM
ffcmike ffcmike is offline
Banned
Join Date: Jul 2004
Location: London
Posts: 2,029
ffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond repute
Send a message via AIM to ffcmike Send a message via MSN to ffcmike
I would place the GUI display and action script within a weapon, have the NPC call a function to that weapon passing itself as a parameter, then store that reference within the GUI object, and refer to it upon the action.

Weapon:

PHP Code:
function onCreated(){
  
SomeWeaponReference = this;
}

public function 
displayBuyHat(temp.owner){
  new 
GUIControl(BuyHat_Buy){
    
this.owner = temp.owner;
  }
}

function 
BuyHat_Buy.onAction(){
  
BuyHat_Buy.owner.buyHatPressed();
  
BuyHat_Buy.destroy();
} 
NPC:

PHP Code:
function onPlayerTouchsMe(){
  
SomeWeaponReference.displayBuyHat(this);
}

public function 
buyHatPressed(){
  
triggeraction(stuff);
} 
Reply With Quote