I need help making a shop system

Started by , Tue 19/04/2005 01:04:25

Previous topic - Next topic

Foolish Koala

      Hi I'm using my brothers account to ask about problem that I need help with.
In my game "Jake's Quest" I'm having it so you can buy stuff that you need for the game. I'm using the points as money and I need it so if you talk to say the news stand guy and ask "How much for the green book" he says "10 bucks" then a dialog option comes up and you  have the chioces of "I'll take  it" and "no thanks" then if you choose "I'll take it" He says "here you go". Adds book to inventory and minuses 10 bucks. I need it so if you don't have enough money than he can't buy it. then the option to buy it gone afterward.

I could really use the help.

stuh505

You won't need to do any AGS scripting for this...you can manage all of this with "dialog" script. 

It's really quite simple, but the manual does a pretty good job of explaining it.

You should look up Dialogs in the manual and follow the instructions and it should all work out.

For a list of special commands you can put in your dialog script, check in the manual under "goto-dialog" in the index, then scroll down on the page and you'll find a list of all the other script commands.

You can use the give-score command with a negative value to subtract from the score if you're uisng that as money

there's also a give inventory item ocmmand

Foolish Koala

I know I've done most of that.
But thanks anyway.

1. I need to know how to make him say something and not allow him to get the item if he does not have the money.Like the conditional needed.

2.How to make a background object be removed through dialog script.

stuh505

Ah, sorry.

To do conditional (if/else) checks, or remove items from the screen will require using AGS script.

You'll need to write a function and then use the dialog function "run-script X" to call it:


function dialog_request (int xvalue) {
    // your code here
  }

To check if they have enough money, it's simply:

if (game.score > 100)
{
  //code here
}


To remove an object from the screen,

use ObjectOff(int x);

or

object
  • .Visible = false;

    depending on your version

Foolish Koala

    Thanks alot!
You really helped!
             ;D

SMF spam blocked by CleanTalk