Hi,
Tetralogia wrote: ↑Tue Jan 29, 2019 10:09 am- Is there a way to put a conversation on hold, leaving it at any moment to start another conversation, and returning to it later (without changing scene) ?
If it's a TextlineDialogueUI conversation, first make sure
Use Conversation Variable is ticked. This allows it to record the states of more than one conversation.
To put a conversation on hold, call the TextlineDialogueUI's OnRecordPersistentData() method. This saves the current state of the conversation. Example:
Code: Select all
FindObjectOfType<TextlineDialogueUI>().OnRecordPersistentData();
DialogueManager.StopConversation();
To resume a conversation using TextlineDialogueUI, set the dialogue variable "Conversation" and call OnApplyPersistentData(). Example:
Code: Select all
DialogueLua.SetVariable("Conversation", "Your Conversation Title");
FindObjectOfType<TextlineDialogueUI>().OnApplyPersistentData();
Without TextlineDialogueUI, normally you'd record the position of the conversation before stopping, and then restart the conversation at that point. Example:
Code: Select all
int lastEntryID = DialogueManager.currentConversationState.subtitle.dialogueEntry.id;
DialogueManager.StopConversation();
...
DialogueManager.StartConversation(DialogueManager.lastConversationStarted, player, npc, lastEntryID);
However, this doesn't keep a history like TextlineDialogueUI does.
There is also a Conversation State Saver component, but it only saves the state of the currently-active conversation. If you save the game while a conversation is active, and then reload the saved game, it will resume the conversation at that point. But if you save the game while no conversation is active, it will not resume any conversation.
Tetralogia wrote: ↑Tue Jan 29, 2019 10:09 am- Can I have some messages that are already displayed when I start the conversations, indicating the characters already chatted before ?
I can think of two ways to do this.
1. Add dialogue entry nodes to the beginning of the conversation, and set their
Sequence fields to None(). When you start a conversation, it will blast through these nodes until it gets to a node with a different Sequence. However, if you've configured Pre Delay Settings, each of these nodes will delay for the specified duration.
2. Or, preconfigure the "history" of the conversation. This requires getting under the hood a bit more than #1, but it also bypasses the caveats of #1. Say you have a conversation named "Bob". TextlineDialogueUI stores the history of this conversation in a dialogue variable named DialogueEntryRecords_Bob, in this format:
The first # is the number of dialogue entries in the history.
Each pair of #'s after that indicates a conversation ID and an entry ID. For example:
means the history has 3 entries: [1:1], [1:3], and [1:7]. The first entry is conversation ID 1, entry ID 1. The second entry is conversation ID 1, entry ID 3. And the third entry is conversation ID 1, entry ID 7.
Of course, if none of these fit exactly what you want to do, you're also free to write your own dialogue UI. The Dialogue System doesn't hold you to any of the built-in UI implementations.