Page 1 of 1

Can I directly change the conversation of a conversation trigger using the dll version?

Posted: Mon Apr 04, 2016 6:45 pm
by bluebuttongames
As titled,

For reasons I won't go into I need to be able to do this, so for example if player does X I want a conversation trigger to be set to ConvX if they do Y I want the trigger to be set to ConvY. Now I could do this with a load of conversation triggers and various variables, but that is really messy. I have the same trigger I need to reassign to multiple times.

Thanks.

Re: Can I directly change the conversation of a conversation trigger using the dll version?

Posted: Mon Apr 04, 2016 8:05 pm
by Tony Li
Hi,

If I understand you correctly, you want to change the conversation assigned to a Conversation Trigger at runtime. If so, it's pretty easy. I don't know why I've recently developed a habit of always providing two options -- but, well, here are two options. :-)

1. In a script, set the ConversationTrigger's conversation property. It's a string:

Code: Select all

ConversationTrigger convTrig = ??? // Assign this whatever way works best for you.
ConversationTrigger convTrig = FindObjectOfType<PixelCrushers.DialogueSystem.ConversationTrigger>(); //... like this for example.
convTrig.conversation = "ConvX";
2. Or have it always trigger the same conversation (e.g., titled "Entry Conversation") but, in the conversation, use cross-conversation links to conversations ConvX and ConvY based on a Lua variable value. To add a cross-conversation link, inspect a node (such as the START node). In the inspector, click on the "(Link To)" dropdown. Select "(Another Conversation)". You can't link to another conversation's START node; this is a limitation imposed by the Chat Mapper data structure. So you'll have to link to a child node. It might look something like this:

Entry Conversation
  • START:
    Link to: ConvX.Entry
    Link to: ConvY.Entry
ConvX
  • START
    • Entry: NPC: "I hear you did X." {Conditions: Variable["playerDid"]=="X"}
      • PC: "So? I like to X."
ConvY
  • START
    • Entry: NPC: "So, you did Y, eh?" {Conditions: Variable["playerDid"]=="Y"}
      • PC: "Yup, you got me. I did Y."

Re: Can I directly change the conversation of a conversation trigger using the dll version?

Posted: Tue Apr 05, 2016 5:26 pm
by bluebuttongames
Thanks for the help Tony, no idea how I missed this totally obvious solution. Must be tired.

Re: Can I directly change the conversation of a conversation trigger using the dll version?

Posted: Tue Apr 05, 2016 6:32 pm
by Tony Li
Glad to help!