Page 1 of 1

Script after dialog ends?

Posted: Thu Feb 25, 2021 7:07 am
by nicmar
I have a lua script that will be run on the end of the dialogue. First I had it on the last node, it ran fine, but it got executed before the dialog line was completed.

Then I tried to add an empty node with the script. It runs, but it seems like it doesn't invoke
DialogueManager.instance.conversationEnded and the conversation ends up in a state where the player is unable to do things as it's waiting for the conversation to end.

Is this something you have any tips for? :)

Re: Script after dialog ends?

Posted: Thu Feb 25, 2021 8:16 am
by Tony Li
Hi,

Even if you add it to an empty node at the end, the Script will run before DialogueManager.instance.conversationEnded.

If you want it to run after/during DialogueManager.instance.conversationEnded, add a Dialogue System Trigger to a GameObject. If you only want it to run when a specific NPC's conversation ends, add it to the NPC. If you want it to run after every conversation, add it to the Dialogue Manager. Set the trigger to OnConversationEnd. Select Add Action > Run Lua Code. Then put your script in the Lua Code field.

Re: Script after dialog ends?

Posted: Tue Mar 02, 2021 3:04 am
by nicmar
Hmm.. thanks, but i'm not sure that would work. I want to run it only for a specific conversation, not for every conversation that ends with this npc.

It's a script that makes the NPC move to a specific location for the intro of the game after a dialogue.

Any suggestions? :)

Re: Script after dialog ends?

Posted: Tue Mar 02, 2021 8:30 am
by Tony Li
Assuming the NPC is used as the Conversation Conversant, can you add another Dialogue System Trigger? Set it to OnConversationEnd. Then select Add Action > Run Lua Code if you want to run Lua code, or Add Action > Play Sequence to play a sequence, etc.