Running sequences on conditions ?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
nishant
Posts: 55
Joined: Mon Sep 21, 2015 3:16 pm
Location: Canada
Contact:

Running sequences on conditions ?

Post by nishant »

Hi ,
I want to popup a textbox (that will prompt for name) only when name is not given ? something like if statement ??

Currently I am using blank nodes just to check the condition but I feel there can be a better way to implement this

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

Re: Running sequences on conditions ?

Post by Tony Li »

Yes, all triggers, such as Dialogue System Trigger and Sequence Trigger, have a Condition section. You can set conditions such as certain Lua variable values, certain quest states, etc. Then they will only fire if all of the Conditions are true.
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Running sequences on conditions ?

Post by Tony Li »

Sorry, I think I misunderstood what you mean. I think you want this to happen during a conversation.

One way to do that is to inspect the node with the TextInput() sequence. Set the False Condition Action to Passthrough. This way, if the node is false it will fall through to the next node. Then set the Conditions to something like:

Code: Select all

Variable["Name"] == ""
So if Variable["Name"] is blank, it will use this node and run the TextInput() sequence. Otherwise it will fall through to the next node.
nishant
Posts: 55
Joined: Mon Sep 21, 2015 3:16 pm
Location: Canada
Contact:

Re: Running sequences on conditions ?

Post by nishant »

Hi ,
Sorry for replying so late ... was on a break . Well am doing exactly what you mentioned. Problem is I dont want a blank dialogue box along with . Isnt it possible to run a method call from sequence only on a condition ? Like how we execute sequence method after few seconds using @seconds , just want a condition instead of time. Also I noticed another issue . If I choose to cancel the conversation when textbox is active, only textbox disappears not the dialogue UI and thus player cant remove it as I freeze the user input when conversation starts.
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Running sequences on conditions ?

Post by Tony Li »

nishant wrote:Sorry for replying so late ... was on a break . Well am doing exactly what you mentioned. Problem is I dont want a blank dialogue box along with . Isnt it possible to run a method call from sequence only on a condition ? Like how we execute sequence method after few seconds using @seconds , just want a condition instead of time.
I'll put together an example and post it here later today.
nishant wrote:Also I noticed another issue . If I choose to cancel the conversation when textbox is active, only textbox disappears not the dialogue UI and thus player cant remove it as I freeze the user input when conversation starts.
This sounds like a bug. I'll look into it and report back here.
nishant
Posts: 55
Joined: Mon Sep 21, 2015 3:16 pm
Location: Canada
Contact:

Re: Running sequences on conditions ?

Post by nishant »

Ok issue with this was Cancel Button in dialogue manager was set to none , while cancel conversation was set to esc . Is this the expected behaviour ? What is the difference between the 2 ?
I read it in docs

Cancel The key and/or button that the player can use to cancel a dialogue entry sequence
Cancel Conversation The key and/or button that the player can use to cancel the active conversation

still not clear though . Can you give an example ?
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Running sequences on conditions ?

Post by Tony Li »

When the Dialogue System is displaying a dialogue entry's subtitle and playing its sequence, it checks for Cancel. If the player presses Cancel, it stops the sequence and immediately progresses to the next step in the conversation.

When the Dialogue System is displaying the response menu, it checks for Cancel Conversation. If the player presses Cancel Conversation, it stops the conversation.

Some developers wanted the Esc key to cancel the current sequence but not cancel the entire conversation. Since the two are separate above, you can configure it this way.

I still need to check about the text field UI, though. I'll get back to you on it.
nishant
Posts: 55
Joined: Mon Sep 21, 2015 3:16 pm
Location: Canada
Contact:

Re: Running sequences on conditions ?

Post by nishant »

Hey ,
So it wasnt a bug actually , I didnt realize the input field has separate buttons to Accept and cancel. Although I had removed cancel button from main dialogue manager , the cancel button on Textbox wasnt changed . So if I pressed esc button it would only cancel the textbox and not the conversation.
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Running sequences on conditions ?

Post by Tony Li »

Hi,

Here's an example that uses TextInput() only if the player has not entered his or her name yet:
Nishant_2015-10-05.unitypackage
The scene is in Assets/Test/nishant.

The key is this dialogue entry:
Image
  • The Conditions field specifies that this entry is true only if the PlayerName variable is blank.
  • False Condition Action has been set to Passthrough. If the Conditions are false (in other words, if the PlayerName is already set), it will fail through to the next entry, which greets the player by name.
nishant
Posts: 55
Joined: Mon Sep 21, 2015 3:16 pm
Location: Canada
Contact:

Re: Running sequences on conditions ?

Post by nishant »

Oh cool that should solve it .. Thanks :)
Post Reply