Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: shaun9991 on Tue 22/03/2022 12:53:56

Title: Dialogue question: "I've got nothing else to say to them right now" [SOLVED]
Post by: shaun9991 on Tue 22/03/2022 12:53:56
Hi all,

Forgive me if this is a silly question - I'm probably missing something obvious - but I haven't been able to work out an easy solution.

Is there an easy way of clicking on an character... and IF all dialogue options available at that time (except one e.g. the "Goodbye" option) have previously been exhausted, the player character can simply state something like "I've got nothing else to say to them right now". At the moment in my game, once all dialog options are exhausted the "Goodbye" option remains... so interacting with a character again (when dialog is exhausted) just results in a "Hello"..."Hello"..."Goodbye"..."Bye" sort of sequence.

Any suggestions much appreciated! Thanks :)
Shaun
Title: Re: Dialogue question: "I've got nothing else to say to them right now"
Post by: Khris on Tue 22/03/2022 15:00:50
You can probably do something like
Code (ags) Select
int GetChoiceCount(this Dialog*) {
  int choices = 0;
  for (int i = 1; i <= this.OptionCount; i++) if (this.GetOptionState(i) == eOptionOn) choices++;
  return choices;
}


Now you can do something like:
Code (ags) Select
  if (dMerchant.GetChoiceCount() > 1) dMerchant.Start();
  else player.Say("I've got nothing else to say to them right now");
Title: Re: Dialogue question: "I've got nothing else to say to them right now"
Post by: shaun9991 on Tue 22/03/2022 15:13:02
Thanks so much Khris - that looks incredible. I'll try it out tonight. :)
Title: Re: Dialogue question: "I've got nothing else to say to them right now"
Post by: shaun9991 on Tue 22/03/2022 18:14:28
It pops up with this error when I click on a character. I'm guessing I need to tweak something, but not quite sure what?
(https://i2.paste.pics/6c3d0b4b47c63688beaf1a29eb5c050b.png)

Many thanks,
Shaun
Title: Re: Dialogue question: "I've got nothing else to say to them right now"
Post by: eri0o on Tue 22/03/2022 18:45:09
I think choices starts at 1 not 0. Edit: dialog choices not your variable that has confusingly the same name.

Edit: use this.GetOptionState (i+1)
Title: Re: Dialogue question: "I've got nothing else to say to them right now"
Post by: shaun9991 on Tue 22/03/2022 19:30:06
Thanks eri0o!! It works perfectly now :)
Title: Re: Dialogue question: "I've got nothing else to say to them right now"
Post by: Khris on Tue 22/03/2022 20:12:27
The inconsistent numbering can really be a pain sometimes :-\
I fixed the code in my post above.