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

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
bluebuttongames
Posts: 91
Joined: Tue Jul 14, 2015 8:22 am

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

Post 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.
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

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

Post 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."
bluebuttongames
Posts: 91
Joined: Tue Jul 14, 2015 8:22 am

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

Post by bluebuttongames »

Thanks for the help Tony, no idea how I missed this totally obvious solution. Must be tired.
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

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

Post by Tony Li »

Glad to help!
Post Reply