Dialogue help "buying something" (FAIRLY SOLVED)

Started by Siddd, Thu 23/10/2008 16:37:35

Previous topic - Next topic

Siddd

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

.M.M.

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:
Code: ags

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!");
  }
}

Siddd

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:
Code: ags

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

Khris

Did you try searching the helpfile for "dialog_request"?

Siddd

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.

Siddd

yay im slowly cracking it but now it comes up " undefined token 'money' " for this line:
  Money-=50;

???

.M.M.

Have you created variable Money? (it must be int variable)

Siddd

ive acheived what needs to be done on this but ive made a new post with yet another damn problem.

SMF spam blocked by CleanTalk