Page 1 of 1

[Solved] A "fallback" condition for responses

Posted: Mon Jun 03, 2024 5:27 pm
by tomb
Hi Tony

Sometimes I'm working on responses which deal with several different outcomes. For example with two variables, A and B, it is easy enough check both variable states in the conditions for each response:
  • A == true AND B == false
  • A == false AND B == true
  • A == true OR B == true
  • A == true AND B == true
  • A == false AND B == false
When I add a third (or more!) variable the list of possible conditions quickly expands as I'm not only checking for the condition I want, but also making sure other responses exclude those conditions. For example:
  • A == true AND B == false AND C = true
  • A == false AND B == true AND D = false
  • A == true OR B == true OR C = false
  • A == true AND B == true AND D = true
  • A == false AND B == false AND C = true
In these situations it becomes harder to make sure I'm catching all the cases to make sure at least one response will be displayed for the player.

I was wondering if there is a way to set a condition equivalent to "Show this response if there are no other valid responses at this point in the conversation". This way I can set up a set of complex conditions for responses then, if none of them match for that player, they would see this other response.

This "fallback" condition would help me not have to worry about making sure the complex conditions always have a valid response.

This would be different from a response with no conditions at all, as I'd only want it displayed if none of the conditions for the other responses are matched rather than it being always displayed as an option.

Thank you

Tom

Re: A "fallback" condition for responses

Posted: Mon Jun 03, 2024 7:49 pm
by Tony Li
Hi,

If you're talking about NPC dialogue entries that the NPC would respond to the player with, then yes. You don't even need to use priority levels. If you make the fallback node the last one in the "Links To" list, it will use this one if none of the previous nodes' Conditions are true:

fallback.png
fallback.png (36.54 KiB) Viewed 350 times

This is because the NPC will use the first entry in the "Links To" list whose Conditions are true.


If it's for player response menus, then you can't rely on this because the Dialogue System will show all nodes whose Conditions are true. However, in this case you can priorities. A simple example:

priority1.png
priority1.png (45.25 KiB) Viewed 350 times

For more complex conditions, you can use group nodes to simplify each node's individual Conditions:

priority2.png
priority2.png (77.2 KiB) Viewed 350 times

Re: A "fallback" condition for responses

Posted: Tue Jun 04, 2024 8:57 am
by tomb
Hi Tony

I was using this for player response menus so it was priorities that I was missing!

This is going to be extremely useful - thank you so much!

For your group node examples, this is a setup I have been using to reduce the individual conditions. It was making me think about the "group" checkbox - is that something I should use in these situations? I normally set a "Continue()" sequence on the node. Is there any difference between ticking group vs adding the Continue?

Thanks

Tom

Re: A "fallback" condition for responses

Posted: Tue Jun 04, 2024 9:12 am
by Tony Li
Yes. Use the Group checkbox in these cases.

Group nodes act like gated passthroughs. If the Conditions are true, evaluation passes straight through to the group node's children.

A regular node with Continue(), on the other hand, stops at the regular node and "shows" it. Since the node's Sequence is Continue(), it immediately moves on to its children.

Re: A "fallback" condition for responses

Posted: Tue Jun 04, 2024 9:18 am
by tomb
Okay great - thanks for the explanation!