![]() |
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:
PHP Code:
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 |
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:
PHP Code:
PHP Code:
|
Yeah, that's what I'm doing. Thanks for the help!
|
I'm having some issues. It's not sending the trigger at all now. I don't know what I'm doing wrong. Here's the whole code. It wouldn't let me post it using php tags since incapsula got me D:
http://pastebin.com/p4p4MTFF |
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:
PHP Code:
|
Oh, I see what you mean :P Thanks <3 I'll tweak mah code then
Edit: Whoever it was who gave me a red pepper saying "worst scripter 2012", I'm in the process of something called "learning", and also the negative reputation for Graal pastebin, my browser refused to load it after 10 minutes of trying D: Sorry about that. I would post the old code on pastebin since it's working now, but I don't see the point since I've solved the issue already! |
| All times are GMT +2. The time now is 07:03 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.