Thread: Arrow buying
View Single Post
  #2  
Old 01-31-2011, 09:18 PM
MattKan MattKan is offline
the KattMan
Join Date: Aug 2010
Location: United States
Posts: 1,325
MattKan is a splendid one to beholdMattKan is a splendid one to beholdMattKan is a splendid one to beholdMattKan is a splendid one to beholdMattKan is a splendid one to behold
Send a message via AIM to MattKan
Quote:
Originally Posted by Equinox View Post
I'm not very good at scripting so...
im trying to make a npc in a shop that takes gralats from you when you say Buy arrows. the script is like this:

if (player.chat=Buyarrows);
(playerdarts += 30);
(tokenize 10);
say2 here you go.;

It gives me the arrows but it does not deduct it from my gralats.
Help please?
This should work:

PHP Code:
function onPlayerChats()
{
 if (
player.chat == "Buyarrows")
  {
   
player.darts += 30;
   
player.rupees -= 30;
   
say2("Here you go!");
  }

However, that raises another issue. Players will be able to buy darts even if they have no gralats. So you have to add an if statement to check for that.

New Script:

PHP Code:
function onPlayerChats()
{
 if (
player.chat == "Buyarrows")
  {
   if (
player.rupees >= 30)
    {
     
player.darts += 30;
     
player.rupees -= 30;
     
say2("Here you go!");
    }
   else
    {
     
say2("You do not have enough gralats.");
    }
  }

That ought to stop players from buying arrows when they have no money.

Oh, and that is GS2, not GS1 which you used in your post. GS2 works better, so I suggest you learn that instead. There are some guides for GS2 scripting here: http://wiki.graal.net/index.php/Creation/Dev/GScript
__________________
Quote:
Originally Posted by Satoru Iwata
On the other hand, free-to-play games, if unbalanced, could result in some consumers paying extremely large amounts of money, and we can certainly not expect to build a good relationship with our consumers in this fashion. In order to have a favorable long-term relationship, we would like to offer free-to-play games that are balanced and reasonable.
Quote:
Originally Posted by Unximad
Eurocenter Games remains attached to the values of indies game developer and to the service our playerbase community.

Last edited by Tigairius; 02-01-2011 at 12:36 AM.. Reason: Fixed error.
Reply With Quote