Page 1 of 1

Conversant and Actor are after changing scenes.

Posted: Wed Jul 10, 2024 3:12 am
by ubo
Hi there,

I'm experiencing a particular case where during a cutscene, a scene change occurs and the scene gameobjects for the actor and conversant are destroyed and respawned. The respawned actors no longer uses their custom text formats from their DialogueActor class.
Propose that within a single conversation, A and B are talking in Scene 1.

They decide to go to Scene 2.

As I unload Scene 1. A and B are destroyed.

When Scene 2 loads, I spawn characters C and D.

C and D have a conversation before A and B are spawned and arrive to join the discussion.

C and D appear to have the correct text formats as per their DialogueActor class.
But for some reason, this is not the case for A and B, their subtitles fail to display their prepended names and color, etc...
I have noticed that the conversation during Scene 2 holds references for Actor and Conversant Transforms, but I don't understand why C and D are behaving correctly.
Any help would be much appreciated, I've struggled with various forms of this throughout but this time I feel like I'm an impasse.

Thank you very much! I've learned a lot using this tool, and writing sequence commands.

Re: Conversant and Actor are after changing scenes.

Posted: Wed Jul 10, 2024 9:01 am
by Tony Li
Hi,

Does Scene 1's conversation end when you go to Scene 2?

Is C and D's conversation a separate conversation? Does it run simultaneously with A and B's conversation?

Would you please break down a timeline of when conversation(s) start and end, who they involve, and when scenes change?

Re: Conversant and Actor are after changing scenes.

Posted: Wed Jul 10, 2024 10:50 pm
by ubo
Hi,

So, it all happens as a single conversation.
  • Conversation 1 Starts
  • In Scene 1, A and B are talking.
  • LoadLevel() Sequencer Command transitions to Scene 2.
  • Characters A, B, C and D are spawned into Scene 2. (No character exists in a scene by default)
  • C and D talk to each other.
  • A and B join the discussion.(And their DialogueActor prepended names don't appear correctly.)
The conversation hasn't reached an END node or a GoTo node at any point in this exchange. Is that my mistake? Should I be starting new conversations at every scene change?

Thanks again for your help.

Re: Conversant and Actor are after changing scenes.

Posted: Thu Jul 11, 2024 3:52 pm
by Tony Li
Hi,

No, you don't need to start a new conversation with every scene change.

However, when a conversation starts, it caches information about each actor. When you destroy scene 1's A and B and instantiate scene 2's A and B, you'll need to tell the active conversation to use the new A and B. You can use DialogueManager.conversationModel.SetParticipants() or DialogueManager.conversationModel.OverrideCharacterInfo() to do this.

For example, you could write a C# method, register it with Lua, and call it in the node after the LoadLevel() node. In this C# method, call:

Code: Select all

var conversation = DialogueManager.masterDatabase.GetConversation(DialogueManager.lastConversationStarted);
var actor = DialogueManager.masterDatabase.GetActor(conversation.ActorID);
var conversant = DialogueManager.masterDatabase.GetActor(conversation.ConversantID);
var actorTransform = CharacterInfo.GetRegisteredActorTransform(actor.Name);
var conversantTransform = CharacterInfo.GetRegisteredActorTransform(conversant.Name);
DialogueManager.conversationModel.SetParticipants(conversation, actorTransform, conversantTransform);
(You could do the same thing with a custom sequencer command.)

Or you could add a script to A and B in the new scene that calls DialogueManager.conversationModel.OverrideCharacterInfo():

Code: Select all

void Start()
{
    if (DialogueManager.isConversationActive)
    {
        var dialogueActor = GetComponent<DialogueActor>();
        var actor = DialogueManager.masterDatabase.GetActor(dialogueActor.actor);
        DialogueManager.conversationModel.OverrideCharacterInfo(actor.id, this.transform);
    }
}

Re: Conversant and Actor are after changing scenes.

Posted: Thu Jul 11, 2024 11:31 pm
by ubo
This sounds exactly like what I was looking for! I kept looking for a SetActor or SetConversant method across the board of some type, but this should be it.

I'll probably write a sequencer command as that's the general workflow I've used so far.

I'll see if I come across any new issues.

Thank you very much!

Re: Conversant and Actor are after changing scenes.

Posted: Fri Jul 12, 2024 8:11 am
by Tony Li
Glad to help! If you run into any questions as you do that, let me know how I can help.