![]() |
Quote:
|
Quote:
PHP Code:
|
I started working on a simple shop script, however I have already ran into another problem. I want to trigger a weapon so whenever the player clicks the object it will trigger the simple shop gui I made. How would I go about triggering a weapon from an npc :o?
|
in the item you are clicking on, you need this:
PHP Code:
ex: PHP Code:
--Hopefully someone can chime in with better examples of the above paragraph, as I have not fooled with it recently. ;] Here are a few examples and helpful posts: Skyld's Shop Script That one is somewhat outdated, but still relevant (note, the triggeraction used there has since been replaced -> use triggerClient instead) Also, it might be noted, that Skyld's example stores the items information in a Database (multiple) -- This could now be redone to support SQLite.. Also, some helpful posts for triggering: Serverside / Clientside actions explained http://forums.graalonline.com/forums...84&postcount=6 good trigger examples both ways: http://forums.graalonline.com/forums...17&postcount=4 Trigger DB from Level NPC http://forums.graalonline.com/forums...41&postcount=9 |
@Torankusu
Thank you :D, I'll play around with it and see what I can do for adding security. I''m pretty sure the ActionLeftMouse works on serverside as well, would it be better to make the trigger that triggers the weapon serverside also? |
onActionLeftMouse () or right,
Will work on serverside. You want to send serverside info to the client, so keep the trigger on serverside, and detect it in the weapon npc on clientside. (Note my usage: triggerClient [serverside to clientside] -- causes the event onActionClientside [clientside...]. My terminology might be incorrect, but look at the examples and how they are set up. Also check the other posts by cbk, they are really helpful. |
I just haven't been able to get it to work. Am I doing something wrong?
I put this into the npc PHP Code:
PHP Code:
|
Remove the < and >
|
How would you make it so it knows what row is selected on a gui text list? I tried doing a few things, would this work?
PHP Code:
http://pastebin.com/svjPXSGe |
PHP Code:
|
There are a few things you could change with what you have written up so far..
We'll start from the beginning, excluding the onSelect event...we'll get back to that, but first: PHP Code:
Putting this inside of onCreated() { this.tools = {blah...}; } will work, but I'd recommend an alternative method for defining the tools list (possibly something serverside if this is a shop menu and sending it to the client). Continuing on... PHP Code:
Use PHP Code:
In your code, your list control is this: PHP Code:
It should be: PHP Code:
|
@Fowlplay Thanks, I couldn't find a thing to use, that's just the kind of thing I was looking for :D
@Torankusu Thanks for looking through it, it's more of just a random thing I was working on to get more practice with gui's etc, so I didn't think of adding serverside protection or whatever for the array. As for the rest, thanks I'm gonna take a look at my code and see if I can fix these errors :) |
You can find more events for GUI objects here:
http://wiki.graal.net/index.php/Crea...ent/GuiControl |
I am having trouble with params. I am really not sure how to phrase this question I will try the best I can. Ok so I was making a small shop menu, and I wanted to have the npc trigger the shop menu. In the npc trigger to the shop it would contain the price and other params. I want to be able to use these params in the weapon it triggers and for example make the price.txt = the param price. I also am confused on how the script will know what the trigger is and to make it so it only uses the param of that trigger. For example, if you had more than one triggers going to a weapon script and you wanted to make a gui txt say param 3, how would you be able to tell it to only use param 3 of a certain trigger? I pasted my current script also, as I''m pretty sure I did not phrase any of this right D:
Npc - http://pastebin.com/uiBWRAUL Weapon - http://pastebin.com/W87eGjhX |
Never mind on my last post. I was over thinking something simple.
|
| All times are GMT +2. The time now is 04:01 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.