Conversation conditions

Started by eshiel, Tue 12/01/2016 02:24:43

Previous topic - Next topic

eshiel

yup, that was it, thanks so much!

edit: alright, I don't want to doublepost, so I'll add this question in here:

So I'm trying to set up a little back and forth between two characters that uses the player character as the messenger, so to speak.
Ideally, it'd go like this:


Character A: If you see Character B, tell them I want to talk to them.

Character B: [if you haven't talked to Character A] oh hi
Character B: [if you HAVE talked to Char A] Did I do something wrong?

Character A: [If you talked to Character B]: Why would they think that?

two catches: I'm trying to run the player character as silent, which I've been doing so far by writing dialogue with blank option 1 (so they're just talked at), as I don't need choices/dialogue trees. But HasOptionBeenChosen would require me to have an option in that case, so..
the second catch - in an even more IDEAL situation I would like Character A to have a make player character option become available, but AFTER that A/B exchange. (And piggybacking onto that, because I've been checking the manual but haven't been able to find it-- would it be possible to set that up as a dialogue choice, like "Become Character A?" in order to trigger the switch?)

Thanks,
-e

Snarky

(Please don't put new, unrelated questions into existing threads. It makes it harder for others to search and browse.)

This can be easily achieved by putting script commands into the dialogs. Check the manual (under the tutorial for conversations).

So if the conversation with B depends on whether you've talked to A, create a bool as a global variable (a flag), e.g. hasTalkedToA, add a command to the conversation with A to set it to true, and in the conversation with B, check its value and do the appropriate thing.

If you want a new conversation option with A to become available after a certain dialog exchange with B, create it as an option that is initially off, and use the command Dialog.SetOptionState() (check the manual) when you talk to B to turn it on.

If you want something to happen when you choose a particular dialog option, you can normally just add it as a command inside the dialog script. However, I'm not sure what the effect will be of switching player character in the middle of a dialog script. I think it will work, but if it doesn't, you may have to use another flag to make it happen right after the conversation is over: http://www.adventuregamestudio.co.uk/forums/index.php?topic=51017.msg636496866#msg636496866

monkey0506

If I understand you correctly, the player character themselves doesn't participate in this dialogue, just the other two characters are speaking to the player at this point, yes?

You don't have to use the built-in dialog system if the player isn't going to speak... but regardless... You can create a pair of global variables to handle this. You can make them bool variables that default to false, and name them something like spokeToA and spokeToB.

As far as setting the player character, that's a simple matter of calling the SetAsPlayer function at the appropriate time. Here's an example using dialog scripts.

Code: ags
// character A dialog
@1
  if ((spokeToA) && (spokeToB))
  {
CharacterA: Why would they think that?
option-on 2 // Become Character A?
option-on 3 // Leave.
option-off 1 // (blank option)
    return RUN_DIALOG_RETURN;
  }
  else
  {
CharacterA: If you see Character B, tell them I want to talk to them.
    spokeToA = true;
  }
stop
@2
  cCharacterA.SetAsPlayer();
stop
@3
stop


Code: ags
// character B dialog
@1
  if (spokeToA)
  {
CharacterB: Did I do something wrong?
    spokeToB = true;
  }
  else
  {
CharacterB: Oh, hi.
  }
stop


Relevant entries in the manual: Other features -> Global variables, Tutorial -> Setting up the game -> Conversations, and Scripting -> Character functions and properties -> SetAsPlayer

Edit: Snarky beat me to the post. Hope this helps though.

eshiel

thank you so much! i have it working now :)

the manual is a little dense/hard for me to process so I thank you for the links/code example.

SMF spam blocked by CleanTalk