Hi Tony,
I wanted to ask if there's a way to change the submit key during runtime for the response menu.
For example, my current entry goes like this: Press the "R" key to beckon Max to follow.
Subsequently, I will have another entry: Press "Q" key to activate Max's beamlights.
Currently, my submit button is the spacebar and I've tried attaching a UI button Key Trigger for the "R key" to the response menu which works.
But two problems I'm encountering here!
1) How can I allow the R key to activate only during a specified entry itself and not throughout the whole conversation?
2) How can I change this submit key to another key in an easy way?
Hope to hear your thoughts Tony!
Change response menu submit key during runtime
Re: Change response menu submit key during runtime
Hi,
You'll probably have to do a little scripting.
When you say "submit," I'm not sure if you're talking about the EventSystem's Submit input, which is used to click UI buttons, or something else like the Use Button on a Selector component.
Assuming it's the EventSystem's Submit input, from your description it sounds like you don't actually need a menu because there's only one "choice" (e.g., "Press 'R' key to beckon Max to follow."). If this is the case, then I recommend a custom sequencer command instead. For example, your node might look like:
You'll probably have to do a little scripting.
When you say "submit," I'm not sure if you're talking about the EventSystem's Submit input, which is used to click UI buttons, or something else like the Use Button on a Selector component.
Assuming it's the EventSystem's Submit input, from your description it sounds like you don't actually need a menu because there's only one "choice" (e.g., "Press 'R' key to beckon Max to follow."). If this is the case, then I recommend a custom sequencer command instead. For example, your node might look like:
- Dialogue Text: "Press "R" key to beckon Max to follow."
Sequence: WaitForKey(r)
Code: Select all
public class SequencerCommandWaitForKey : SequencerCommand
{
IEnumerator Start()
{
string key = GetParameter(0);
while (!Input.GetKeyDown(key))
{
yield return null;
}
Stop();
}
}
Re: Change response menu submit key during runtime
Hi tony. Thanks for this.
Yes I am referring to the EventSystem's Submit input.
I tried the script you provided but the dialogue entry for the response node still only proceeds with the spacebar key rather than the "R key".
I am not sure if the sequencer is playing because it's meant to be a response node?
Yes I am referring to the EventSystem's Submit input.
I tried the script you provided but the dialogue entry for the response node still only proceeds with the spacebar key rather than the "R key".
I am not sure if the sequencer is playing because it's meant to be a response node?
Re: Change response menu submit key during runtime
Hi,
If there's only one response node, see: How To: Bypass Response Menu When Player Has One Choice
I think that's what you're looking for.
However, if you really want to run it as a response menu and use the EventSystem's Submit input, you can add a script to the Dialogue Manager that has an OnConversationResponseMenu method. In this method, determine what key the response should use for Submit, and change the EventSystem's Submit input accordingly.
If there's only one response node, see: How To: Bypass Response Menu When Player Has One Choice
I think that's what you're looking for.
However, if you really want to run it as a response menu and use the EventSystem's Submit input, you can add a script to the Dialogue Manager that has an OnConversationResponseMenu method. In this method, determine what key the response should use for Submit, and change the EventSystem's Submit input accordingly.
Re: Change response menu submit key during runtime
Thank you for this Tony. Will give it a try!