Hello,
I'm trying to set up a few more complicated conversations. I have a conversation with 3 NPCs. It works fine if I want to use that conversation only once and mark the NPC that is in that conversation using Dialogue Actor component. But if I want to have that same conversation running twice at the same time with different NPCs it breaks and 3rd NPC joins both conversations. All I found was: PixelCrushers.DialogueSystem.CharacterInfo.RegisterActorTransform, but it seems to do the same thing as Dialogue Actor.
Is there a way to assign more NPCs do a dialogue than 2? Let Dialogue System look for random matching NPCs only if there are none specifically assigned.
I saw main actor and conversant being stored in ActiveConversationRecord but I couldn't yet find a way to use that information to insert my characters there.
Also, it seems that all canvases for dialogues are instantiated at the start of the game. Majority of my NPCs will have their canvas set with Dialogue Actor - Custom Subtitle Panel. So if it is not actively in a conversation and that canvas is still there instantiated, there might be some performance issues as NPC count in a scene increases. Is there an easy way to make those canvases appear only when that actor is in a conversation and destroy them otherwise?
Thank you
Simultaneous conversations with multiple NPCs and inactive UIs
-
- Posts: 2
- Joined: Fri Jul 23, 2021 8:20 am
Re: Simultaneous conversations with multiple NPCs and inactive UIs
Hi,
Sorry, because of the way the Dialogue System associates GameObjects with additional actors, that's not a supported use case. Can you duplicate the conversation? It might even be an opportunity to make them a little different for variety. If you absolutely must run the same conversation and don't want to maintain two copies, you could duplicate it programmatically at runtime. If you need to do this, let me know and I'll describe how.GodOfMagic wrote: ↑Sun Jul 25, 2021 6:32 pmI have a conversation with 3 NPCs. It works fine if I want to use that conversation only once and mark the NPC that is in that conversation using Dialogue Actor component. But if I want to have that same conversation running twice at the same time with different NPCs it breaks and 3rd NPC joins both conversations.
The Dialogue Actor keeps its custom subtitle panel GameObject inactive except when it's needed, so there's no performance concern.GodOfMagic wrote: ↑Sun Jul 25, 2021 6:32 pmAlso, it seems that all canvases for dialogues are instantiated at the start of the game. Majority of my NPCs will have their canvas set with Dialogue Actor - Custom Subtitle Panel. So if it is not actively in a conversation and that canvas is still there instantiated, there might be some performance issues as NPC count in a scene increases. Is there an easy way to make those canvases appear only when that actor is in a conversation and destroy them otherwise?
-
- Posts: 2
- Joined: Fri Jul 23, 2021 8:20 am
Re: Simultaneous conversations with multiple NPCs and inactive UIs
It says my message is spam for some reason, I'll try editing this
And, it didn't work, here's a picture of it instead:
This seems to do the trick. I'm sure I can find a better place to override speakerInfo or optimise it, but this seems to do the trick for now.
And, it didn't work, here's a picture of it instead:
Code: Select all
if (subtitle.activeConversationRecord != null)
{
var actorName = subtitle.speakerInfo.transform.GetComponent<DialogueActor>().actor;
var tempName = subtitle.activeConversationRecord.actor.GetComponent<DialogueActor>().actor;
if (actorName == tempName)
{
if (subtitle.speakerInfo.transform != subtitle.activeConversationRecord.actor)
subtitle.speakerInfo.transform = subtitle.activeConversationRecord.actor;
}
tempName = subtitle.activeConversationRecord.conversant.GetComponent<DialogueActor>().actor;
if (actorName == tempName)
{
if (subtitle.speakerInfo.transform != subtitle.activeConversationRecord.conversant)
subtitle.speakerInfo.transform = subtitle.activeConversationRecord.conversant;
}
if (subtitle.activeConversationRecord.otherConversants != null)
{
foreach (Transform t in subtitle.activeConversationRecord.otherConversants)
{
tempName = t.GetComponent<DialogueActor>().actor;
if (actorName == tempName)
{
if (subtitle.speakerInfo.transform != t)
subtitle.speakerInfo.transform = t;
}
}
}
}
- Attachments
-
- Capture.PNG (35.48 KiB) Viewed 377 times
Re: Simultaneous conversations with multiple NPCs and inactive UIs
Hi,
If you have further trouble posting, let me know here or via email to tony (at) pixelcrushers.com.
I'll think over some ways to incorporate the same idea into the Dialogue System. In the meantime, I recommend adding a unique comment such as "//[GodOfMagic]" to your script customizations. This way you can search for the comment before updating the Dialogue System. I also recommend using version control if you're not already doing so. The combination will make it easier to track your changes and re-apply them.
If you have further trouble posting, let me know here or via email to tony (at) pixelcrushers.com.
I'll think over some ways to incorporate the same idea into the Dialogue System. In the meantime, I recommend adding a unique comment such as "//[GodOfMagic]" to your script customizations. This way you can search for the comment before updating the Dialogue System. I also recommend using version control if you're not already doing so. The combination will make it easier to track your changes and re-apply them.