Script after dialog ends?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
nicmar
Posts: 133
Joined: Wed Aug 21, 2019 2:39 am

Script after dialog ends?

Post 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? :)
Working on SpaceChef - A wacky open world space western, featuring a chef with nothing to loose, after he loses everything.. ;) Follow our work on @BlueGooGames.
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Script after dialog ends?

Post 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.
nicmar
Posts: 133
Joined: Wed Aug 21, 2019 2:39 am

Re: Script after dialog ends?

Post 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? :)
Working on SpaceChef - A wacky open world space western, featuring a chef with nothing to loose, after he loses everything.. ;) Follow our work on @BlueGooGames.
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Script after dialog ends?

Post 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.
Post Reply