Set Actor or Conversant inside a conversation?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
User avatar
Abelius
Posts: 318
Joined: Fri Jul 21, 2017 12:45 pm

Set Actor or Conversant inside a conversation?

Post by Abelius »

Hi there,

This is weird, I know, but I think it would be nice to have the ability of setting/changing the actor and/or the conversant of an already started conversation. Preferably with a sequence command or a LUA fuction I can run from a dialogue entry.

Note: I mean the actual game object references, not the display names, or anything related to the nodes.

Is this possible already? There are plenty of ways to set them before the conversation has started, but I can't find anything to change them on the fly. That is: I want to 'reset' the participants of the active conversation.

I'm asking this because I have a pool of 16 NPC game objects with a Dialogue Actor component on them. Right now I have logic set in place that before I start a conversation I ask for a free NPC object, it sets up the character visually as it should be, changes the info on the Dialogue Actor component (so the Actor field is always 'NPC'), and then that GO is given to the Start Conversation action in PlayMaker as Conversant (Actor is always the Player gome object).

This is working well, but I'd like to go further and be able to call that logic from inside an already started conversation.

But for that to happen I'll need to be able to change the current Conversant game object reference.

Is there some hidden command I'm missing? Or is that info locked in once the convo starts?
Unity 2019.4.9f1
Dialogue System 2.2.15
User avatar
Tony Li
Posts: 22158
Joined: Thu Jul 18, 2013 1:27 pm

Re: Set Actor or Conversant inside a conversation?

Post by Tony Li »

Hi,

Once a conversation starts, DialogueManager.conversationModel is valid. This has CharacterInfo properties actorInfo and conversantInfo. You can assign a new GameObject like this:

Code: Select all

DialogueManager.conversationModel.actorInfo.transform = SomeNewTransform;
User avatar
Abelius
Posts: 318
Joined: Fri Jul 21, 2017 12:45 pm

Re: Set Actor or Conversant inside a conversation?

Post by Abelius »

Awesome, thanks!
Unity 2019.4.9f1
Dialogue System 2.2.15
User avatar
Tony Li
Posts: 22158
Joined: Thu Jul 18, 2013 1:27 pm

Re: Set Actor or Conversant inside a conversation?

Post by Tony Li »

Glad to help!
Post Reply