Problem with actor/conversants changing by themselves

Announcements, support questions, and discussion for the Dialogue System.
User avatar
HawkX
Posts: 147
Joined: Mon Feb 27, 2017 1:50 pm
Location: Quebec
Contact:

Problem with actor/conversants changing by themselves

Post by HawkX »

Hi again,

This time I'm having a weird bug... Might not be easy to actually explain properly... let me know if you dont understand what I mean ;)

I go into conversations, write a full conversations between 1 actor and 1 conversant.
(A conversation between "YOU" (which means the player) and "Mysterious Girl" (no portrait, name unknown))

However, when playing back the conversation, "one" of the 2 (sometimes the player, sometimes the conversant) changes name/portrait by itself...

I kinda figured out how and why it happens, but after trying for a while I still have no clue how to fix it!

What happens is that I created an empty gameobject to hold my "OnConversationsScript"
This script is the one that the dialoguemanager connects to (transform) when starting a new conversation...
Its also the script that enables me to use

Code: Select all

public void OnConversationStart (Transform gm)
The problem is that the one set as "Actor" in the actual Conversation Tree gets replaced by whatever name that gameobject has when the actual conversation occurs...

Any help on how to fix this one? :)

Thanks a LOT! as always!!
User avatar
Tony Li
Posts: 22062
Joined: Thu Jul 18, 2013 1:27 pm

Re: Problem with actor/conversants changing by themselves

Post by Tony Li »

Hi,

I don't recall how you're starting conversations. If you're using DialogueManager.StartConversation() in a script, it has several overloads:
  • DialogueManager.StartConversation(string title, Transform actor, Transform conversant, int entryID)
  • DialogueManager.StartConversation(string title, Transform actor, Transform conversant)
  • DialogueManager.StartConversation(string title, Transform actor)
  • DialogueManager.StartConversation(string title)
If you use an overload that specifies the actor and/or conversant, that GameObject gets associated as the primary actor and/or conversant. The primary actor and conversant are the ones that receive events such as OnConversationStart, and they're the ones that the Dialogue System checks for Override Dialogue UI components.

If you don't specify a primary actor or conversant, or if your conversation references additional actors, the Dialogue System will use the GameObject that registered itself under that actor name using the Override Actor Name component. Otherwise, if no GameObject has used Override Actor Name, the Dialogue System will find a GameObject whose name matches the actor's name in the database.

The Conversation Trigger component adds a few twists. If you explicitly assign GameObjects to the Actor and Conversant fields, you're all good. Otherwise, it will try to use some logic to identify the GameObjects to use:
  • If the Conversant field is unassigned, it will use the GameObject that holds the Conversation Trigger.
  • If the Actor field is unassigned and the Trigger is set to OnTriggerEnter or OnUse, it will use the GameObject that entered the trigger or sent the OnUse message to the Conversation Trigger.
You can read more details in How GameObjects Are Associated With Conversations.

If you temporarily set the Dialogue Manager's Debug Level to Info, it will log a lot of activity to the Console window. Among this will be a line like:

Code: Select all

Dialogue System: Starting conversation 'title' with actor=ABC and conversant=XYZ
It might be helpful to identify which GameObjects are being used as the primary participants.
User avatar
HawkX
Posts: 147
Joined: Mon Feb 27, 2017 1:50 pm
Location: Quebec
Contact:

Re: Problem with actor/conversants changing by themselves

Post by HawkX »

What about Visual Novels type game with lots of dialogues with lots of participants that dont actually always have physical representation in the game?

So basically I call all my conversations using the following :

Code: Select all

	void StartConversation ()
	{
		if (DialogueManager.MasterDatabase.GetConversation (GV.stringCurrentFightLocation + intFightPhase.ToString()) != null)
		{
			DialogueManager.StartConversation (GV.stringCurrentFightLocation + intFightPhase.ToString(), girlname.transform);
		}
	}
so im replacing the "Actor" by that empty gameobject...

So if I edit all my conversations (good thing I still only have a dozen or so)
and make sure to always leave the Actor EMTPY and not use him in any of the actual dialogues... that would fix it?
User avatar
Tony Li
Posts: 22062
Joined: Thu Jul 18, 2013 1:27 pm

Re: Problem with actor/conversants changing by themselves

Post by Tony Li »

If the scene doesn't have a GameObject with the same name as the character without physical representation, it should work correctly.

Here's an example: Let's say in your conversation that the conversation's Actor is "YOU" and the conversation's conversant is "Mysterious Girl".

If you were to run this exact code:

Code: Select all

DialogueManager.StartConversation (GV.stringCurrentFightLocation + intFightPhase.ToString());
it's equivalent to this:

Code: Select all

DialogueManager.StartConversation (GV.stringCurrentFightLocation + intFightPhase.ToString(), null, null);
which specifies that the actor transform is null and the conversant transform is null. The first null is for the actor, the second is for the conversant.

The Dialogue System always tries to associate a GameObject with each participant. Since the actor transform is null, it will look for a GameObject named "YOU". If it finds one, it will associate that GameObject as the conversation's actor ("YOU"). If it doesn't find a matching GameObject, the conversation's actor won't be associated with a GameObject.

Now take this code:

Code: Select all

DialogueManager.StartConversation (GV.stringCurrentFightLocation + intFightPhase.ToString(), girlname.transform);
which is equivalent to:

Code: Select all

DialogueManager.StartConversation (GV.stringCurrentFightLocation + intFightPhase.ToString(), girlname.transform, null);
That code specifies the girlname GameObject is associated with the conversation's actor ("YOU").

If girlname actually corresponds to "Mysterious Girl", you may want to do this instead:

Code: Select all

DialogueManager.StartConversation (GV.stringCurrentFightLocation + intFightPhase.ToString(), null, girlname.transform);
This specifies that the girlname GameObject is associated with the conversation's conversant ("Mysterious Girl"). The conversation's actor is not associated with a GameObject (unless the Dialogue System happens to find a GameObject named "YOU").
User avatar
HawkX
Posts: 147
Joined: Mon Feb 27, 2017 1:50 pm
Location: Quebec
Contact:

Re: Problem with actor/conversants changing by themselves

Post by HawkX »

Thanks Again so much for not giving up on me!!!

If the game is really profitable, you can rest assured you will receive a generous donation! :)
(I know it sounds super unprofessional, a french guy in a basement making an adult game and hoping to get rich, but it "could" happen!)

ANYWAY!

If i were to have

Code: Select all

DialogueManager.StartConversation (convString, null, null);
That would not allow me to run either of my "OnConversationEnd" or "OnConversationStart" Right?

So i need to have "either" of them be either the actor or conversant...

Problem in this particular situation, is that its "neither" the actor or the conversant...

I'm starting to understand how this all work out "under the hood" now however...

You did not answer this question however :
If I were to edit all my conversations with 4 actors/conversants and make sure to leave the first spot EMTPY (not talking) ... that would work?

In this case, that seems to be the easiest way... I'll try it right now... ;)
User avatar
Tony Li
Posts: 22062
Joined: Thu Jul 18, 2013 1:27 pm

Re: Problem with actor/conversants changing by themselves

Post by Tony Li »

OnConversationStart and OnConversationEnd are also sent to the Dialogue Manager GameObject itself. You can put your script there.
User avatar
HawkX
Posts: 147
Joined: Mon Feb 27, 2017 1:50 pm
Location: Quebec
Contact:

Re: Problem with actor/conversants changing by themselves

Post by HawkX »

THAT is a super good idea!!! I did not know that!! :)

Thanks as always for saving me hours of headache!!
User avatar
HawkX
Posts: 147
Joined: Mon Feb 27, 2017 1:50 pm
Location: Quebec
Contact:

Re: Problem with actor/conversants changing by themselves

Post by HawkX »

SUPER quick yes/no question :)

can I have 2 scripts active at once using "OnConversationStart and OnConversationEnd"?

If i put a more "basic" one on the dialoguemanager and one on my gameobject (that do different things), will both be called or simply one of them? :)
User avatar
Tony Li
Posts: 22062
Joined: Thu Jul 18, 2013 1:27 pm

Re: Problem with actor/conversants changing by themselves

Post by Tony Li »

Hi - sorry for the late reply. They'll both be called.
User avatar
HawkX
Posts: 147
Joined: Mon Feb 27, 2017 1:50 pm
Location: Quebec
Contact:

Re: Problem with actor/conversants changing by themselves

Post by HawkX »

Come on!! its the weekend!! most people (or companies) wouldnt even answer before 2 or 3 days!! You always answer in less than 24 hours!! its amazing!!

With this, all of my "bugs" i had logged are fixed!!! :D ... hopefully all will go well until our demo next friday! :) Thanks a million!
Post Reply