Page 1 of 1

Detect conversation 'finishing' versus conversation 'cancelled'?

Posted: Tue Apr 27, 2021 9:40 pm
by Jamez0r
Hi Tony!

I have an NPC that you talk to, who should give you an item if you fully complete his conversation. I have a sensor set up such that if you walk away from the NPC mid-conversation, it will stop/cancel the conversation.

Are there any callbacks that I could use, where I could know that the player fully completed the NPCs conversation, so that I can give the item to the player? With the "Dialogue System Events" component, the "On Conversation Ended" callback gets called even if the conversation is "cancelled".

If there isn't a callback type of way to know if the conversation was fully completed, would there be a way to do this via Lua Script on a conversation-node? I would need to give the item to the player *after* they have pressed the continue button on the final node (aka after the conversation has finished).

Thanks for the help!!

Re: Detect conversation 'finishing' versus conversation 'cancelled'?

Posted: Tue Apr 27, 2021 10:38 pm
by Tony Li
Hi,

You could add a node after the "final" node that doesn't have any Dialogue Text. Set its Sequence to Continue(). Use a Lua function in the Script field to give the item. (You can register your own C# method with Lua and then call this method in the Script field.)

Or you could set a variable in the final node. Add another Dialogue System Trigger set to OnConversationEnd to the NPC. Set this Dialogue System Trigger's Conditions > Lua Conditions to check the variable value. Set Actions > OnExecute() UnityEvent (or some other action) to give the item.

Re: Detect conversation 'finishing' versus conversation 'cancelled'?

Posted: Tue Apr 27, 2021 11:51 pm
by Jamez0r
Thanks Tony! I think the first method will work great :D

Re: Detect conversation 'finishing' versus conversation 'cancelled'?

Posted: Wed Apr 28, 2021 7:21 am
by Tony Li
Great! Glad to help.