Hi!
I was wondering if it was possible to create new Conversations within the Lobby example or somehow make it possible to recognize that a player just entered the scene. I want it so that whenever the player returns to talk to someone (ex. Adam), Adam will say some variation of "Oh you're back!" or "Welcome back!" and then resume where he left off in the last conversation. Is there a way to add that extra line in front of any resumed conversation?
I was thinking I could create a variable to store the "Oh you're back!" or "Welcome back!" line and use the variable value in the script. I just wasn't sure how to hook up lines like these to preface a conversation in progress. Thanks!
How to dynamically add new lines to resumed conversation in Lobby example
Re: How to dynamically add new lines to resumed conversation in Lobby example
Hi,
You can manually tell the dialogue UI to play a subtitle. Rough example:
Note: I haven't tested the code above. It may have typos, etc.
If you need more details, let me know.
You can manually tell the dialogue UI to play a subtitle. Rough example:
Code: Select all
// Assumes the conversation has already started:
var subtitle = new Subtitle(
DialogueManager.conversationModel.conversantInfo, // (NPC is speaking)
DialogueManager.conversationModel.actorInfo, // (player is receiving)
FormattedText.Parse("Welcome back!"),
string.Empty, // (use default sequence)
string.Empty, // (no response menu sequence)
null); // (no dialogue entry)
DialogueManager.dialogueUI.ShowSubtitle(subtitle);
If you need more details, let me know.
Re: How to dynamically add new lines to resumed conversation in Lobby example
Thanks Tony! It works when I add a new DialogueEntry to the subtitle object. However, there seems to be issues when I resume the conversation and the game loads from save. I believe the subtitle need a DialogueEntry in order to be properly re-created when the conversation resumes. I wasn't sure how to create that DialogueEntry with the correct ID or correct outgoing links.
Is there a way to either remove this conversation from the saved set of messages (mark it as not saved) or to allow it to be saved with a valid DialogueEntry? Thanks!
Is there a way to either remove this conversation from the saved set of messages (mark it as not saved) or to allow it to be saved with a valid DialogueEntry? Thanks!
Re: How to dynamically add new lines to resumed conversation in Lobby example
Hi,
Create a new dialogue entry for the "Welcome back!" line. You don't have to connect it to anything. It can just sit on the side of your conversation canvas without any incoming or outgoing links.
When you create the Subtitle object, specify this dialogue entry instead of null. You can get it from the database by ID:
You could also get it by Title or Dialogue Text, but you'd have to search the conversation's dialogueEntries list to find it. Example:
Create a new dialogue entry for the "Welcome back!" line. You don't have to connect it to anything. It can just sit on the side of your conversation canvas without any incoming or outgoing links.
When you create the Subtitle object, specify this dialogue entry instead of null. You can get it from the database by ID:
Code: Select all
var dialogueEntry = DialogueManager.masterDatabase.GetDialogueEntry(conversationID, dialogueEntryID);
Code: Select all
var conversation = DialogueManager.masterDatabase.GetConversation("Conversation Title Here");
var dialogueEntry = conversation.dialogueEntries.Find(entry => entry.DialogueText == "Welcome back!");
Re: How to dynamically add new lines to resumed conversation in Lobby example
Thanks so much Tony that worked!