If Then Variable in Node Script
Posted: Wed Oct 19, 2022 4:02 pm
Howdy!
I'm trying to do some Icarian complicated branching dialogue stuff, and I'm just trying to make sure I understand the Conditional command or not.
Basically the idea is that the dialogue changes based on the order in which the player learned information, and I'm trying to use a number variable that will change based on that.
In my example code here, 0 means the player hasn't talked to either A or B. Talking to character A sets it to 1, talking to character B sets it to 2. But I want to make it so that if you have talked to character B before talking to character A, it will be set to 3 (and subsequently if you talked to A before talking to B, it will be set to 4.) Does this code look like it should do the job?
Character A conversation node:
Conditional("Variable['Sanctuarywasfoulplay'] == 0",
Variable["Sanctuarywasfoulplay"] = 1;
Conditional("Variable['Sanctuarywasfoulplay'] == 2",
Variable["Sanctuarywasfoulplay"] = 3;
And then the inverse for Character B:
Conditional("Variable['Sanctuarywasfoulplay'] == 0",
Variable["Sanctuarywasfoulplay"] = 2;
Conditional("Variable['Sanctuarywasfoulplay'] == 1",
Variable["Sanctuarywasfoulplay"] = 4;
I'm trying to do some Icarian complicated branching dialogue stuff, and I'm just trying to make sure I understand the Conditional command or not.
Basically the idea is that the dialogue changes based on the order in which the player learned information, and I'm trying to use a number variable that will change based on that.
In my example code here, 0 means the player hasn't talked to either A or B. Talking to character A sets it to 1, talking to character B sets it to 2. But I want to make it so that if you have talked to character B before talking to character A, it will be set to 3 (and subsequently if you talked to A before talking to B, it will be set to 4.) Does this code look like it should do the job?
Character A conversation node:
Conditional("Variable['Sanctuarywasfoulplay'] == 0",
Variable["Sanctuarywasfoulplay"] = 1;
Conditional("Variable['Sanctuarywasfoulplay'] == 2",
Variable["Sanctuarywasfoulplay"] = 3;
And then the inverse for Character B:
Conditional("Variable['Sanctuarywasfoulplay'] == 0",
Variable["Sanctuarywasfoulplay"] = 2;
Conditional("Variable['Sanctuarywasfoulplay'] == 1",
Variable["Sanctuarywasfoulplay"] = 4;