How to bypass menu if no choices are "available"?
Posted: Sat Jun 25, 2022 9:05 am
Hi there,
Not sure if this has been answered already (quite possibly), but I can't find it.
I'd like to implement a way to, once you reach a node in a conversation, get a menu with X possible choices, each of them subject to be shown or not according to their specific conditions (quest states, most likely). They'd be things like returning a quest item, asking about specific info, etc...
In this case, as I don't want those choices appearing at all, their nodes are set with "Show Invalid" = False.
Then, at the bottom of those choices, there would be an "Continue" option for the conversation going on until the end.
I know how to do all that, okay... but what I don't know is how to bypass that menu entirely IF ALL of those choices end up being invalid at that moment, and just continue as if the "Continue" button was clicked.
But with my current setup, if all choices are invalid, I get a "Continue" button...
...and as I was writing this, I've realized maybe I should uncheck that "Always Force Response Menu" option, lol...
I don't know if that will mess up with another part of my setup, so I'll enable it just on this conversation and cross my fingers.
I'll still publish this thread in case it's useful for someone, and in case you have something to add.
----------------------------------------------------------
These are my Controller settings:
And it should be noted I'm using a script you sent me some time ago...:
Not sure if this has been answered already (quite possibly), but I can't find it.
I'd like to implement a way to, once you reach a node in a conversation, get a menu with X possible choices, each of them subject to be shown or not according to their specific conditions (quest states, most likely). They'd be things like returning a quest item, asking about specific info, etc...
In this case, as I don't want those choices appearing at all, their nodes are set with "Show Invalid" = False.
Then, at the bottom of those choices, there would be an "Continue" option for the conversation going on until the end.
I know how to do all that, okay... but what I don't know is how to bypass that menu entirely IF ALL of those choices end up being invalid at that moment, and just continue as if the "Continue" button was clicked.
But with my current setup, if all choices are invalid, I get a "Continue" button...
...and as I was writing this, I've realized maybe I should uncheck that "Always Force Response Menu" option, lol...
I don't know if that will mess up with another part of my setup, so I'll enable it just on this conversation and cross my fingers.
I'll still publish this thread in case it's useful for someone, and in case you have something to add.
----------------------------------------------------------
These are my Controller settings:
And it should be noted I'm using a script you sent me some time ago...:
Code: Select all
using UnityEngine;
using PixelCrushers.DialogueSystem;
public class HandleInvalidTags : MonoBehaviour
{
public void OnConversationResponseMenu(Response[] responses)
{
// If any responses' text contains "{invalid}", make the response invalid:
foreach (Response response in responses)
{
string text = response.formattedText.text;
if (text.Contains("{invalid}"))
{
text = text.Replace("{invalid}", string.Empty); // Remove "{invalid}"
// This next line applies the Em Tag For Invalid Responses formatting:
text = string.Format("[em{0}]{1}[/em{0}]", (int)DialogueManager.displaySettings.inputSettings.emTagForInvalidResponses, text);
response.formattedText.text = FormattedText.Parse(text).text;
response.enabled = false; // This means it's invalid and not clickable.
}
}
}
}