Hi Tony,
sorry for one question after another.
I have a custom bool field for my dialogue entries called "HideWhenUnavailable". I'm trying to see if a response has this field set to True. However I'm only able to access the dialogue node the response appears in (the subtitle) or the dialogue entry it connects to (responses.destinationEntry), not the response itself as a dialogue entry.
Is there some way to access the response as a dialogue entry that I'm overlooking?
Get Dialogue Entry Field for Response
Re: Get Dialogue Entry Field for Response
Hi,
A response isn't a dialogue entry. It's an object that encapsulates some menu text and the destination entry to use if the player chooses the response.
Is the purpose of HideWhenUnavailable to exclude the dialogue entry from the response menu? If so, you could make a subclass of StandardUIMenuPanel that overrides ShowResponses(). Something like:
A response isn't a dialogue entry. It's an object that encapsulates some menu text and the destination entry to use if the player chooses the response.
Is the purpose of HideWhenUnavailable to exclude the dialogue entry from the response menu? If so, you could make a subclass of StandardUIMenuPanel that overrides ShowResponses(). Something like:
Code: Select all
protected override void SetResponseButtons(Response[] responses, Transform target)
{
// (Assumes we're using instantiated buttons.)
base.SetResponseButtons(responses, target);
foreach (var button in instantiatedButtons)
{
// If button in inactive because Conditions are false, hide it if HideWhenUnavailable is true:
var responseButton = button.GetComponent<StandardUIResponseButton>();
if (!responseButton.isClickable && Field.LookupBool(responseButton.destinationEntry.fields, "HideWhenUnavailable"))
{
button.SetActive(false);
}
}
}
Re: Get Dialogue Entry Field for Response
Thanks Tony. It ended up working by using:
as each player choice has its own node (with the custom field I want to check). i think I just got confused because I thought the responses themselves are the player choice nodes, but they actually are the links from the previous node to the player choice node. All working now
Code: Select all
Field.LookupBool(responses[i].destinationEntry.fields, "HideUnavailable")
Re: Get Dialogue Entry Field for Response
Great! Glad to help.