Unlock Dialogue Options in Runtime

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
GREI
Posts: 20
Joined: Fri Oct 14, 2022 2:38 pm

Unlock Dialogue Options in Runtime

Post by GREI »

Hi Tony,
I want to have a system where some dialogue options remain hidden(or locked) unless the player has done something in the game.

e.g. Only when player clicks on a book in a scene, then a dialogue option unlocks and reads "read the book's content".
the response panel would remain open the whole time, with reponse options changing from [1]...
[2]...
to
[1]...
[2]...
[3]...

What is the most effecient way to go about that?

Right now I have set up the book as a button to change the Lua boolean "canReadBook" to true.
However, the dialogue response panel would not respond to the Lua boolean change.
It seems that I would need to "refresh" the dialogue system somehow for it to check the conditions again.

Thanks!
User avatar
Tony Li
Posts: 21925
Joined: Thu Jul 18, 2013 1:27 pm

Re: Unlock Dialogue Options in Runtime

Post by Tony Li »

Hi,

If you set the Lua variable before the conversation gets to the response menu (2+ nodes before), you can use Conditions on the response dialogue entries to only show those response entries if the Conditions are true.

If you change the Lua variable while the response menu is visible, you can call DialogueManager.UpdateResponses() to tell the conversation to reevaluate the Conditions and update the response menu accordingly.
GREI
Posts: 20
Joined: Fri Oct 14, 2022 2:38 pm

Re: Unlock Dialogue Options in Runtime

Post by GREI »

worked out great, thanks!
User avatar
Tony Li
Posts: 21925
Joined: Thu Jul 18, 2013 1:27 pm

Re: Unlock Dialogue Options in Runtime

Post by Tony Li »

Glad to help!
GREI
Posts: 20
Joined: Fri Oct 14, 2022 2:38 pm

Re: Unlock Dialogue Options in Runtime

Post by GREI »

Hi, a follow-up to UpdateResponses() question.

When I call this method, it seems to work as a "Continue" button as well.
That is to say it presses the continue button for me if there is one pending in the dialogue.

Is there a way to disable this behaviour?

Thanks
User avatar
Tony Li
Posts: 21925
Joined: Thu Jul 18, 2013 1:27 pm

Re: Unlock Dialogue Options in Runtime

Post by Tony Li »

Hi,

If the conversation isn't currently showing a response menu, don't call UpdateResponses() since it will have this behavior.
Post Reply