Page 1 of 1

Programatically setting DialogueEntry field before the sequence is run

Posted: Thu Nov 12, 2020 5:37 pm
by jlhacode
I'm looking to implement a generic "Thank You" conversation/node where the dialogue node's actor & conversant is set to "(None)".

I can't figure out how to programmatically start a conversation with the Conversation/DialogueEntry having the right Actor. This would need to be done before the sequence for the DialogueEntry is played.

In order, my goal is this:
1. Start conversation
2. Set Actor field on the first Dialogue Entry with an ActorID (not a transform).
3. Enter the node, and have the default sequence on my DialogueManager run.

Re: Programatically setting DialogueEntry field before the sequence is run

Posted: Thu Nov 12, 2020 7:28 pm
by Tony Li
Hi,

Does it need to be set to (None)? At runtime, you can use a different actor for the conversation's primary actor or primary conversant. See: Character GameObject Assignments

The example used in that link is a general-purpose shopkeeper conversation that any number of shopkeeper NPCs can use.

Re: Programatically setting DialogueEntry field before the sequence is run

Posted: Fri Nov 13, 2020 3:59 pm
by jlhacode
Hi Tony,

It can be set to anything that gets the job done. Unfortunately, the "Generic Shopkeeper" example doesn't work for me, because I'd like to start this conversation purely from code instead of a DialogueSystemTrigger. To do so, I think I need to prepare the conversation actor beforehand with an actorID.

I know it's not how it works, but my ideal script would look like this:

Code: Select all

DialogueManager.GetConversation(conversationId).SetActorId(actorId);
StartConversation(conversationId);
or

Code: Select all

StartConversation(conversationId, actorId);

Re: Programatically setting DialogueEntry field before the sequence is run

Posted: Fri Nov 13, 2020 4:34 pm
by Tony Li
You can start it from code just as easily. Pass the GameObject transforms to DialogueManager.StartConversation():

Code: Select all

DialogueManager.StartConversation(conversationTitle, actorTransform, conversantTransform);