Page 1 of 1

Changing conversant based on variable before conversation starts.

Posted: Thu Jul 07, 2022 2:45 pm
by sanmaow
Hi Tony,

My game has multiple characters the player can select from. Each character is a unique prefab and based on which one the player selected the selected character's index will be stored in a variable. I want each character to have a different set of portraits during dialogue. Currently I am going at this by setting a different actor for each character with different portraits, but I don't know how to get my characterIndex variable before a conversation and set the corresponding actor during runtime.

Re: Changing conversant based on variable before conversation starts.

Posted: Fri Jul 08, 2022 8:52 am
by Tony Li
Hi,

How are you starting conversations?

Let's say you have a GameObject for each conversant. Each of these GameObjects has a Dialogue Actor component whose Actor dropdown points to the correct character.

If you're starting a conversation in C#, you can pass the GameObject to DialogueManager.StartConversation(), such as:

Code: Select all

GameObject conversant = CharacterIndexToConversant(characterIndex); // (Example)
DialogueManager.StartConversation("title", playerTransform, conversant.transform);
If you're starting the conversation from a Dialogue System Trigger, you can make a subclass of DialogueSystemTrigger. Example:

Code: Select all

protected override void DoConversationAction(Transform actor)
{
    conversationConversant = CharacterIndexToConversant(characterIndex).transform;
    base.DoConversaitonAction(actor);
}