Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Siddd on Thu 23/10/2008 16:37:35

Title: Dialogue help "buying something" (FAIRLY SOLVED)
Post by: Siddd on Thu 23/10/2008 16:37:35
I was wandering how i could "buy" an item off a shop keeper i made which puts the item i buy in my inventory and takes out money from my inventory. Thanks
Title: Re: Dialogue help "buying something"
Post by: .M.M. on Thu 23/10/2008 16:56:35
I´m not sure what do you want, but I will try to help you.
I created a module/ template for this, but it isn´t working now. So, if you want to use dialog for this, you have to
1. create new option in dialog with merchant,
2. add line run-script 1
3. in dialog_request add this:
if (parameter==1) {
player.Say("I must have this thing!");
cShopKeeper.Say("Okay, it costs 50 gold.");
if (Money>=50) { // 50 is price of thing you are buying
  player.AddInventory(iYourNewItem);
  Money-=50;
  cShopKeeper.Say("You bought a realy great item!");
  dYourDialog.SetOptionState(1, eOptionOff);
  }
  else {
  cShopKeeper.Say("You don´t have enough money!");
  }
}
Title: Re: Dialogue help "buying something"
Post by: Siddd on Thu 23/10/2008 17:24:35
Quote from: Mirek on Thu 23/10/2008 16:56:35
I´m not sure what do you want, but I will try to help you.
I created a module/ template for this, but it isn´t working now. So, if you want to use dialog for this, you have to
1. create new option in dialog with merchant,
2. add line run-script 1
3. in dialog_request add this:
if (parameter==1) {
player.Say("I must have this thing!");
cShopKeeper.Say("Okay, it costs 50 gold.");
if (Money>=50) { // 50 is price of thing you are buying
  player.AddInventory(iYourNewItem);
  Money-=50;
  cShopKeeper.Say("You bought a realy great item!");
  dYourDialog.SetOptionState(1, eOptionOff);
  }
  else {
  cShopKeeper.Say("You don´t have enough money!");
  }
}



ok the only bit i dont understand here is the dialogue_request bit. whats that? sorry
Title: Re: Dialogue help "buying something"
Post by: Khris on Thu 23/10/2008 17:36:06
Did you try searching the helpfile for "dialog_request"?
Title: Re: Dialogue help "buying something"
Post by: Siddd on Thu 23/10/2008 17:52:59
ok ok ok now ive done everything but i dont understand the concept of "(Money>=5)" was i suppose to create a GUI so that the money can be taken away?

i was hoping that i could just take something out of my inventory instead of money. For example you can find gold coins on the floor.
Title: Re: Dialogue help "buying something"
Post by: Siddd on Thu 23/10/2008 18:16:16
yay im slowly cracking it but now it comes up " undefined token 'money' " for this line:
  Money-=50;

???
Title: Re: Dialogue help "buying something"
Post by: .M.M. on Thu 23/10/2008 18:19:17
Have you created variable Money? (it must be int variable)
Title: Re: Dialogue help "buying something"
Post by: Siddd on Thu 23/10/2008 18:32:53
ive acheived what needs to be done on this but ive made a new post with yet another damn problem.