Dialogue question: "I've got nothing else to say to them right now" [SOLVED]

Started by shaun9991, Tue 22/03/2022 12:53:56

Previous topic - Next topic

shaun9991

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
Support Cloak and Dagger Games on Patreon: https://www.patreon.com/user?u=460039

Khris

You can probably do something like
Code: ags
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
  if (dMerchant.GetChoiceCount() > 1) dMerchant.Start();
  else player.Say("I've got nothing else to say to them right now");

shaun9991

Thanks so much Khris - that looks incredible. I'll try it out tonight. :)
Support Cloak and Dagger Games on Patreon: https://www.patreon.com/user?u=460039

shaun9991

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?


Many thanks,
Shaun
Support Cloak and Dagger Games on Patreon: https://www.patreon.com/user?u=460039

eri0o

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)

shaun9991

Support Cloak and Dagger Games on Patreon: https://www.patreon.com/user?u=460039

Khris

The inconsistent numbering can really be a pain sometimes :-\
I fixed the code in my post above.

SMF spam blocked by CleanTalk