Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #11  
Old 01-14-2014, 10:13 PM
Torankusu Torankusu is offline
Elite Member
Torankusu's Avatar
Join Date: Jun 2001
Posts: 10,065
Torankusu is a jewel in the roughTorankusu is a jewel in the rough
in the item you are clicking on, you need this:

PHP Code:
function onActionRightMouse(){ //or if you want left click, switch Right for Left ;]
  
triggerClient("weapon""<WEAPONNAME>""actionorwhatever"additional params available);

and then in your weapon you will need to check for the trigger...
ex:
PHP Code:
//#CLIENTSIDE
function onActionClientside(actionorwhateverhereadditionalparamspossible..) 

  
//can do conditional or switch statement depending on the actionorwhatever
  //and how many things you want to check here..
  
displayPurchaseMenu(); // or whatever you want to call the function to display your menu

Be careful here, because you need to set up some serverside security as well, such as checking to ensure that the item the client is sending that they want to purchase is the correct item, as well as the price is the correct price that it should be (check a DB or something that stores the price information serverside so that it can not be manipulated). The reason for the additional security is because someone could essentially buy anything they wanted for FREE if all of the purchasing was handled on the clientside (adding items and things should be handled on serverside anyway)

--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
__________________
Quote:
Originally posted by Spark910
Think befreo you type.
Reply With Quote
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 02:19 PM.


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