Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 03-18-2012, 03:43 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
triggeraction all NPC's in the level?

I'm trying to code a hat system, and I'm having a little bit of trouble. To bring up the shop GUI with all the information on the hat, you have to click the hat image in the level. All of the hat images have the same class joined to them, object_hat. Now, I'm using a triggeraction when the player clicks the buy button, and instead of the player buying just that hat, all the NPC's in the level with the class joined to them get the triggeraction too, and I end up buying 6 or 7 hats.

PHP Code:
function onActionBuyHat() {
  
temp.hat_name params[1];
  
temp.hat_price params[2];
  if (
temp.hat_name in clientr.questhats.tokenize(",")) {
    return;
  } else {
    if (!(
player.rupees => temp.hat_price)) {
      echo(
player.account SPC "doesn't have enough!");
    } else {
      
player.rupees -= temp.hat_price;
      
player.clientr.questhats.add(temp.hat_name);
    }
  }

This is the triggeraction.
PHP Code:
triggeraction(this.x,this.y,"BuyHat","",this.hat_name,this.hat_price); 
I don't want all the NPC's with the class joined to receive the triggeraction.
Am I doing something wrong? Also, I tend to script something and get it working and then clean the script up a bit, so it's a little messy :P
__________________
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 12:13 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.