I'm currently making a 2d immersive Sim style game, and I'm trying to create a system for passive AI chatter. The idea is for NPCs to have dialogue between themselves in the background, and I need to be able to store their conversation states in case they are interrupted and their conversation needs to be resumed later. The issue is that I can't seem to find anything in the documentation, or forums about how to do this when simultaneous conversations are active. DialogueManager.CurrentConversationState is the only way I see to get a conversation state, and that only grabs the most recently active conversationState.
Is there any way I can get a ConversationState by an ID, or identifier? or alternatively is there any way I can grab the dialogueEntryID from a specific conversation so that I can play the conversation at that node?
Saving ConversationState while using simultaneous conversations
Re: Saving ConversationState while using simultaneous conversations
Hi,
When multiple conversations are active, each one will have an ActiveConversationRecord in DialogueManager.instance.activeConversations.
If you stop an NPC's conversation, you can grab its ActiveConversationRecord and record its state. Something like:
Then save conversationID and entryID, and the actor and conversant if you need to. To resume the conversation:
When multiple conversations are active, each one will have an ActiveConversationRecord in DialogueManager.instance.activeConversations.
If you stop an NPC's conversation, you can grab its ActiveConversationRecord and record its state. Something like:
Code: Select all
var record = DialogueManager.instance.activeConversations.Find(r => r.actor == npc || r.conversant == npc);
if (record != null)
{
var currentEntry = record.conversationController.currentState.subtitle.dialogueEntry;
int conversationID = currentEntry.conversationID;
int entryID = currentEntry.id;
}
Code: Select all
var title = DialogueManager.masterDatabase.GetConversation(conversationID).Title;
DialogueManager.StartConversation(title, actor, conversant, entryID);
Re: Saving ConversationState while using simultaneous conversations
Awesome thanks so much, that should get me in the right direction