Hi,
I'm running into a bit of a trouble with how DS assigns gameobjects to conversant.
I have a situation like this:
I'm using Adventure Creator and Dialogue System. I have two players in the game, let's call them Larry & Barry, so two IsPlayer tagged NPC-s in DS DB and Two runtime created PC's in AC.
I'm using DS actions in AC cutscenes to launch the conversations. And what happens is whoever my AC player is at the moment becomes target for first player to talk in DS conversation, and he will speak lines of both players. So for example:
Larry: Hi, I'm Larry!
Barry: and I'm Barry!
And my current player is Barry he will speak both lines.
I can fix some of these, by assigning conversant in AC cut-scene action that launches conversation. But that's problematic when characters are spawned at runtime.
So I'm a bit confused on how to approach this. Is there a way to disable context sensitive character assignment by default, and enable it in specific cases? For the most part I need lines to be spoken by same characters that are assigned in DS dialogue nodes.
Thanks.
Problem with different character assigned as conversant.
-
- Posts: 112
- Joined: Tue Jan 19, 2016 11:37 pm
Re: Problem with different character assigned as conversant.
Hi,
In your dialogue database, can you create IsPlayer=false versions of Barry and Larry, and assign them to those nodes? For nodes that are player responses, create and assign a general-purpose Player actor with IsPlayer=true. I'm at Unite right now and unable to test this, but I think it should work. If it doesn't, I'll put together the steps for a solution as soon as I get back.
In your dialogue database, can you create IsPlayer=false versions of Barry and Larry, and assign them to those nodes? For nodes that are player responses, create and assign a general-purpose Player actor with IsPlayer=true. I'm at Unite right now and unable to test this, but I think it should work. If it doesn't, I'll put together the steps for a solution as soon as I get back.
-
- Posts: 112
- Joined: Tue Jan 19, 2016 11:37 pm
Re: Problem with different character assigned as conversant.
Thanks ! I'll try that.
No rush, enjoy the Unite! ^^
No rush, enjoy the Unite! ^^
Re: Problem with different character assigned as conversant.
Okay, I'm back!
Sorry about the delay in replying.
Here's how I set it up. In the dialogue database's Actors section, I created three actors:
In nodes assigned to Player, Menu Text and Dialogue Text can use the tag "[var=Actor]" to incorporate the current player's name. For example:
(I'm using outline form above to keep this reply short, but if you'd like to see a screenshot of the nodes in the node editor just let me know.)
In my test scene, when Barry is the current player, Larry is represented by an NPC named "LarryNPC". Since I don't want his name to show up as "LarryNPC" in conversations, I added an Override Actor Name component to LarryNPC and set the override name to "Larry".

Here's how I set it up. In the dialogue database's Actors section, I created three actors:
- Player: IsPlayer=true. Used for response menu nodes.
- Barry: IsPlayer=false. Used for nodes that should always be spoken by Barry.
- Larry: IsPlayer=false. Used for nodes that should always be spoken by Larry.
In nodes assigned to Player, Menu Text and Dialogue Text can use the tag "[var=Actor]" to incorporate the current player's name. For example:
- Player: "Hi! I'm [var=Actor]."
- Player: "Hi! I'm [var=Actor]."
- Barry: "And I'm Barry!" { Conditions: Variable["Actor"]=="Larry" }
- Larry: "And I'm Larry!" { Conditions: Variable["Actor"]=="Barry" }
(I'm using outline form above to keep this reply short, but if you'd like to see a screenshot of the nodes in the node editor just let me know.)
In my test scene, when Barry is the current player, Larry is represented by an NPC named "LarryNPC". Since I don't want his name to show up as "LarryNPC" in conversations, I added an Override Actor Name component to LarryNPC and set the override name to "Larry".
-
- Posts: 112
- Joined: Tue Jan 19, 2016 11:37 pm
Re: Problem with different character assigned as conversant.
Thank you! I missed the notification, so I did not reply before.
This works great, I just need one more edit I think to make this work for me.
Is there a way to access conversations Actor field from inside OnConversationLine()? Like when you start the conversation through trigger or AC, you can specify actor and conversant, is there a way to access this field?
Or maybe there is better solution. Basically what I have is I have a custom speech bubble Subtitle UI that positions itself over current speaker. I'm using subtitle.speakerInfo.transform to find the speaker, this worked nicely with both NPC being Larry and Barry as I always had gameobjects in the scene with names Larry and Barry, and DS matched conversant actor to them.
But with player this is not the case, as there is no Player gameobject in the scene. So I was thinking of replacing player first with Actor Field transform in cases I set specific NPC (Larry or Barry) to be Actor and thus speaking for them, or if it was blank I would use AC's current Player.
So I'd have code like this in void OnConversationLine(Subtitle subtitle)
This works great, I just need one more edit I think to make this work for me.
Is there a way to access conversations Actor field from inside OnConversationLine()? Like when you start the conversation through trigger or AC, you can specify actor and conversant, is there a way to access this field?
Or maybe there is better solution. Basically what I have is I have a custom speech bubble Subtitle UI that positions itself over current speaker. I'm using subtitle.speakerInfo.transform to find the speaker, this worked nicely with both NPC being Larry and Barry as I always had gameobjects in the scene with names Larry and Barry, and DS matched conversant actor to them.
But with player this is not the case, as there is no Player gameobject in the scene. So I was thinking of replacing player first with Actor Field transform in cases I set specific NPC (Larry or Barry) to be Actor and thus speaking for them, or if it was blank I would use AC's current Player.
So I'd have code like this in void OnConversationLine(Subtitle subtitle)
Code: Select all
if (subtitle.speakerInfo.Name.Equals("Player"))
{
if (ActorField.transform != null)
Conversant = ActorField.transform;
else
Conversant = AC.KickStarter.player.transform;
}
else
Conversant = subtitle.speakerInfo.transform;
Re: Problem with different character assigned as conversant.
Hi,
You can check speakerInfo.nameInDatabase to get the name of the speaker as defined in your dialogue database. Does that help?
If you want to get the entire Actor record, you can use this code:
You can check speakerInfo.nameInDatabase to get the name of the speaker as defined in your dialogue database. Does that help?
If you want to get the entire Actor record, you can use this code:
Code: Select all
var actor = DialogueManager.MasterDatabase.GetActor(subtitle.speakerInfo.id);
-
- Posts: 112
- Joined: Tue Jan 19, 2016 11:37 pm
Re: Problem with different character assigned as conversant.
Hi, no I meant to get the actor assigned to conversation.

This field.

This field.
Re: Problem with different character assigned as conversant.
Hi,
It will try to match the actor transform's GameObject name to an actor in the dialogue database. For example, if the character who triggers the conversation is Barry (and if the GameObject is named "Barry"), it will match it to the actor named Barry in the dialogue database. speakerInfo.nameInDatabase will be "Barry", and speakerInfo.id will be the ID of the actor named Barry. If the actor GameObject isn't named Barry -- for example, if it's named something like Barry_PC(Clone) -- add an Override Actor Name component to it, and set the Override Name to Barry.
It will try to match the actor transform's GameObject name to an actor in the dialogue database. For example, if the character who triggers the conversation is Barry (and if the GameObject is named "Barry"), it will match it to the actor named Barry in the dialogue database. speakerInfo.nameInDatabase will be "Barry", and speakerInfo.id will be the ID of the actor named Barry. If the actor GameObject isn't named Barry -- for example, if it's named something like Barry_PC(Clone) -- add an Override Actor Name component to it, and set the Override Name to Barry.