Disable a specific response button

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
jonathancarroll
Posts: 5
Joined: Tue Jan 23, 2024 6:26 am

Disable a specific response button

Post by jonathancarroll »

Hello, I'd like to set a specific response option's button to be disabled, ie interactable = false, if a certain condition is met.
Wondering how to write the LUA to do this.
I want the player to be able to see that they can't choose the option, so I'd be setting a specific "disabled" color in the button component.
Thanks!
User avatar
Tony Li
Posts: 21678
Joined: Thu Jul 18, 2013 1:27 pm

Re: Disable a specific response button

Post by Tony Li »

Hi,

Set that dialogue entry's Conditions. For example:
  • Menu Text: "Buy a laser pistol [50 credits]"
  • Conditions: Variable["Credits"] >= 50
Then tick the Dialogue Manager GameObject's Display Settings > Input Settings > Include Invalid Entries. This will tell the Dialogue System to include response buttons for entries whose Conditions are false, but it will make them non-interactable.

You can also set the [em#] Tag for Invalid Entries dropdown to show the response button's text in a specific emphasis setting value by automatically adding [em#] markup tags.

If you only want to have "Include Invalid Entries" behavior for certain invalid entries but not others, see this post.
jonathancarroll
Posts: 5
Joined: Tue Jan 23, 2024 6:26 am

Re: Disable a specific response button

Post by jonathancarroll »

Thank you so much!
User avatar
Tony Li
Posts: 21678
Joined: Thu Jul 18, 2013 1:27 pm

Re: Disable a specific response button

Post by Tony Li »

Happy to help!
Post Reply