Simultaneous Conversation Issues
Posted: Fri Jan 06, 2023 6:30 pm
Hey,
I'm working on a project where NPCs can start conversations with other NPCs. I've tested this and it supports multiple NPC to NPC conversations at once without issue. The problems spring up when the player gets involved. I've come across at least two issues and I think I've found workarounds for each.
The first issue is related to ConversationView. When a conversation starts a new ConversationView is created which listens to IDialogUI.SelectedResponseHandler. ConversationView.SelectResponse(SelectedResponseEventArgs e) is called on all active views whether or not it's associated with that conversation. This method stops the related Sequencer which means all other conversations can't be completed. Here is my suggested workaround:
The second issue is related to ConversationModel. When multiple conversations are running at once the Lua Dialog table can become stale. if more than one conversation is active, I receive a Lua exception when an entry used a condition like 'Dialog[2].SimStatus == "WasDisplayed"'. My fix was adding this snippet to EvaluateLinksAtPriority which seems to work.
I realize my use case is unique but I'm not a fan of changing the package code just to fit this project. Let know if I'm missing something or if there's a better approach.
Thanks!
I'm working on a project where NPCs can start conversations with other NPCs. I've tested this and it supports multiple NPC to NPC conversations at once without issue. The problems spring up when the player gets involved. I've come across at least two issues and I think I've found workarounds for each.
The first issue is related to ConversationView. When a conversation starts a new ConversationView is created which listens to IDialogUI.SelectedResponseHandler. ConversationView.SelectResponse(SelectedResponseEventArgs e) is called on all active views whether or not it's associated with that conversation. This method stops the related Sequencer which means all other conversations can't be completed. Here is my suggested workaround:
Code: Select all
public void SelectResponse(SelectedResponseEventArgs e)
{
int id = -1;
if (lastSubtitle != null)
{
id = lastSubtitle.dialogueEntry.conversationID;
}
else if (_subtitle != null)
{
id = _subtitle.dialogueEntry.conversationID;
}
if (e.DestinationEntry.conversationID != id)
{
return;
}
StopResponseMenuSequence();
ui.HideResponses();
if (SelectedResponseHandler != null) SelectedResponseHandler(this, e);
}
The second issue is related to ConversationModel. When multiple conversations are running at once the Lua Dialog table can become stale. if more than one conversation is active, I receive a Lua exception when an entry used a condition like 'Dialog[2].SimStatus == "WasDisplayed"'. My fix was adding this snippet to EvaluateLinksAtPriority which seems to work.
Code: Select all
Lua.Run(string.Format("Dialog = Conversation[{0}].Dialog", new System.Object[] { newConversationID }));
Thanks!