Hello!
Thanks for help! I have a problem when using Dialogue System: how can I change conversations dynamically with C# scripts?
For example,I have a conversation with the title "TestConversation1/Start" and it is the default conversation, and I still have another conversation "NewConversation/Start". Sometimes I want to use the first conversation, and sometime I want change the current conversation to the second one. I've search the APIs but I find no such ways.
What I want is this: I have a button, when I clicked the button, the conversation start. But sometimes I need the first conversation start, sometimes the second one. How can I control it dynamically with C# scripts?Is the keywords the "Title" or the "ID"?
Hope for your answer,thanks!
How to change conversations dynamically with C# scripts?
-
- Posts: 6
- Joined: Mon Jul 06, 2020 11:15 am
Re: How to change conversations dynamically with C# scripts?
Hi,
In C#, you can use DialogueManager.StartConversation():
If you're using Dialogue System Triggers, you can add two Dialogue System Triggers to the GameObject.
In C#, you can use DialogueManager.StartConversation():
Code: Select all
using PixelCrushers.DialogueSystem;
...
if (//some condition//)
{
DialogueManager.StartConversation("TestConversation1/Start", actorTransform, conversantTransform);
}
else
{
DialogueManager.StartConversation("NewConversation/Start", actorTransform, conversantTransform);
}
- Configure the first one to start TestConversation1/Start. Set the Conditions, for example to require that a Dialogue System variable is a specific value (e.g., Variable["PlayTest1"] == true).
- Configure the second Dialogue System Trigger to start NewConversation/Start. Set the Conditions differently, for example to require that the variable is a different value (e.g., Variable["PlayTest1"] == false).
-
- Posts: 6
- Joined: Mon Jul 06, 2020 11:15 am
Re: How to change conversations dynamically with C# scripts?
Thank you very much! That will be help!
Re: How to change conversations dynamically with C# scripts?
Happy to help!