any/all mix in Lua conditions

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
annathehank
Posts: 95
Joined: Sun May 03, 2020 2:17 pm

any/all mix in Lua conditions

Post by annathehank »

Happy Monday!

I was curious if the and/or functions of the Lua conditions can be combined? For instance, in the buttons that I have turning on and off if certain conversations and relationship levels are met, would it be possible to set up a sort of, either or series of conditions?

Example: Conversation #3 is available to a player if conversation 1 had is true, conversation 2 had is true, and the relationship value is over 25. All of this works with the and function in the Lua condition wizard. Would I also be able to add an or condition at the end of that so the player could activate the conversation if some of those conditions are false but a secondary set of conditions is true?

Basically something like
V1 = true and
V2 = true and
V3 = true or
Vsecret = true and
Vothersecret = true
User avatar
Tony Li
Posts: 22165
Joined: Thu Jul 18, 2013 1:27 pm

Re: any/all mix in Lua conditions

Post by Tony Li »

Hi,

Yes. The easiest way is to choose one option, such as "All". This will add "and" between all of the conditions:

Code: Select all

V1 == true and
V2 == true and
V3 == true and
Vsecret == true and
Vothersecret == true
Then manually change the "and" to "or", and add parentheses to clarify the grouping:

Code: Select all

(V1 == true and
V2 == true and
V3 == true) or
(Vsecret == true and
Vothersecret == true)
annathehank
Posts: 95
Joined: Sun May 03, 2020 2:17 pm

Re: any/all mix in Lua conditions

Post by annathehank »

ahh okay! I thought that might work but I didn't want to put it all together and end up with 7 errors when I try to run it :lol: Thank you!
User avatar
Tony Li
Posts: 22165
Joined: Thu Jul 18, 2013 1:27 pm

Re: any/all mix in Lua conditions

Post by Tony Li »

You're welcome!

BTW, while the format will be the same, your actual Conditions will almost certainly look a bit different in details. Maybe something closer to:

Code: Select all

(Variable["DidConv1"] == true and
 Variable["DidConv2"] == true and
 Actor["Ann"].Relationship > 25) or
(Variable["secret"] == true and
 Variable["othersecret"] == true)
Post Reply