Creating or duplicating new conversations dynamically in Textline

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
xuoot
Posts: 19
Joined: Wed Jul 29, 2020 3:01 am

Creating or duplicating new conversations dynamically in Textline

Post by xuoot »

Hi!

Is there a way to create new conversations or duplicate existing ones in the Lobby Textline demo? For example if I wanted the character to start a conversation with me every day at 8 am with the same script that branches differently based on what I answered. But it's a different conversation instance thread every time and they have different conversation IDs (to reference them easily later). Is there a way to do this in code?

Thanks!
User avatar
Tony Li
Posts: 22054
Joined: Thu Jul 18, 2013 1:27 pm

Re: Creating or duplicating new conversations dynamically in Textline

Post by Tony Li »

Hi,

Do you want to do this at runtime, or at design time?

At design time, you can inspect the conversation in the Dialogue Editor, right-click on the canvas, and select Duplicate Conversation. (You could also write a custom editor script to duplicate the conversation, but there isn't a single "duplicate conversation" method; you'd have to write a bit of code to manually duplicate all of the dialogue entries, etc.)

At runtime, it's more complicated. You'd still have to write code to duplicate the conversation, but you'd also have to put it into a dialogue database object and use DialogueManager.AddDatabase() to add the database into the Dialogue System's active runtime environment. More info: How To: Create Dialogue Database At Runtime.

It's probably much simpler to use the same conversation (and thus same conversation ID) with different branches based on variables such as the current date, the player's previous choices, etc.
xuoot
Posts: 19
Joined: Wed Jul 29, 2020 3:01 am

Re: Creating or duplicating new conversations dynamically in Textline

Post by xuoot »

Thanks Tony! I was thinking at run-time. The post you linked is super helpful!

If I re-used a conversation, is there a way to make it restart from the top or from a specific point in the conversation without resetting the other conversations? Thanks!
User avatar
Tony Li
Posts: 22054
Joined: Thu Jul 18, 2013 1:27 pm

Re: Creating or duplicating new conversations dynamically in Textline

Post by Tony Li »

It just occurred to me that you could write a tiny starter conversation for each day, or generate it at runtime using the info in that post. The starter conversation would simply link to your reusable conversation. This way Textline should record each day using the starter conversation's info, keeping them separate from each other.

(Of course, "just occurred to me" also means I haven't actually tested this. But it should work as-is, or at least with a tiny bit of scripting in the worst case.)
xuoot
Posts: 19
Joined: Wed Jul 29, 2020 3:01 am

Re: Creating or duplicating new conversations dynamically in Textline

Post by xuoot »

Thanks Tony! How do you link a conversation to another? For example, if I link Conversation A to Conversation B (reusable), and then I have Conversation C another day linked also to Conversation B (reusable), would these be two separate conversations with different save files or would Conversation B save the progress from Conversation A's choices? Thanks!
User avatar
Tony Li
Posts: 22054
Joined: Thu Jul 18, 2013 1:27 pm

Re: Creating or duplicating new conversations dynamically in Textline

Post by Tony Li »

To link one conversation to another, inspect the last node in the first conversation. From the Inspector's "Links To:" dropdown, select "(Another Conversation)".

Let's say on day 1 you start conversation "A". To do this in Textline, you'll set Variable["Conversation"] = "A". Textline will know to start the conversation titled "A". When it saves, it will save day 1's conversation's state in a variable "DialogueEntryRecords_A", even if A links to other conversations, such as conversation B.

Then on day 2 you start conversation "C" by setting Variable["Conversation"] = "C". Textline will save day 2's conversation state in a variable "DialogueEntryRecords_C", even if C links to B.
Post Reply