Dialogues/Conditions

From SF3
< Dialogues
Revision as of 14:24, 6 October 2016 by Dave (talk | contribs) (Created page with "Every dialogue topic and individual dialogue fragment can be qualified with one or more conditions. <br/> For topics, the condition(s) can be specified in a dedicated text box...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Every dialogue topic and individual dialogue fragment can be qualified with one or more conditions.
For topics, the condition(s) can be specified in a dedicated text box within their template properties. For individual fragments, conditions can be set by double clicking on the nub of their ingoing connection.

Structure of a Condition

A condition is a single line of text in the following format:

 Type: Expression

where Type is one of the following:

  • Chr: A given character must be present
  • Var: A certain variable or expression must be true

If the Type: part of the condition is omitted, it is assumed to be Chr:.

Character Conditions

For character conditions, Expression must be the technical name of a hero character. The condition is considered to be fulfilled if the character is part of the hero party and is within range of the character with whom the dialogue was initiated (same requirement as for other dialogue participants).

Some examples for character conditions:

 Chr: The_Flute_Player   // Valid: Requires the hero The_Flute_Player to be present
 The_Flute_Player        // Valid: Requires the hero The_Flute_Player to be present, Chr: is assumed if not specified
 Chr: Sentenza_Noria     // Invalid: Sentenza_Noria is not a hero, only hero characters can be optional 

Variable Conditions

For variable conditions, Expression can be any basic mathematical or logical expression including constants and global variables.

Supported comparison operations for mathematical expressions are:

 ==  // Equals
 !=  // Unequal
 >=  // Greater or equal
 <=  // Less or equal
 <   // Less
 >   // Greater

Supported mathematical operations are:

 +  // Addition
 -  // Subtraction
 *  // Multiplication
 /  // Division

Within this expression, you can use both global variables names in the form Category.VariableName or numeric literals like 0 or -3.
NOTE: Operators and operands must always be seperated by space(s) or parentheses.

Some examples for valid mathematical conditions are:

 Var: Balthazar.iMonstersKilled >= 20    // Requires Balthazar to have killed at least 20 monsters
 Var: Balthazar.iMonstersKilled >= Sentenza_Noria.iMonstersKilled * 2 // Requires Balthazar to have killed twice as many monsters as Sentenza
 Var: Balthazar.iMonstersKilled + Sentenza_Noria.iMonstersKilled > 30 // Requires Balthazar and Sentenza to have killed more than 30 monsters between them.

In addition to mathematical expressions, logical expressions can be used as well. Both can also be combined in a single expression, with varying degrees of usefulness.
For logical expressions, you can also use the constants true and false for comparisons.

In addition to the same equality and inequality comparisons as for mathematical expressions, logic expressions can use the following operators:

 ||  // Logic OR, is true if at least one of the two operands is true.
 &&  // Logic AND, is true if BOTH of the two operands are true.
 !   // Logic NOT, inverts the value of the right hand operand (e.g. ! true == false)

Some examples for valid logical conditions are:

 Var: SomeState.bEpicMonsterKilled  // Simply check if SomeState.bEpicMonsterKilled is true.
 Var: SomeState.bEpicMonsterKilled == false  // Check if SomeState.bEpicMonsterKilled is false.
 Var: SomeState.bEpicMonsterKilled && (Balthazar.iMonstersKilled > 10) // Check whether the epic monster was killed AND whether Balthazar has killed more than 10 monsters.

Multiple Conditions

You can specify multiple conditions per topic/node, simply separate them by line breaks (i.e. one condition per line).

Every dialogue topic and individual dialogue fragment can be qualified with one or more conditions.
For topics, the condition(s) can be specified in a dedicated text box within their template properties. For individual fragments, conditions can be set by double clicking on the nub of their ingoing connection.

Structure of a Condition

A condition is a single line of text in the following format:

 Type: Expression

where Type is one of the following:

  • Chr: A given character must be present
  • Var: A certain variable or expression must be true

If the Type: part of the condition is omitted, it is assumed to be Chr:.

Character Conditions

For character conditions, Expression must be the technical name of a hero character. The condition is considered to be fulfilled if the character is part of the hero party and is within range of the character with whom the dialogue was initiated (same requirement as for other dialogue participants).

Some examples for character conditions:

 Chr: The_Flute_Player   // Valid: Requires the hero The_Flute_Player to be present
 The_Flute_Player        // Valid: Requires the hero The_Flute_Player to be present, Chr: is assumed if not specified
 Chr: Sentenza_Noria     // Invalid: Sentenza_Noria is not a hero, only hero characters can be optional 

Variable Conditions

For variable conditions, Expression can be any basic mathematical or logical expression including constants and global variables.

Supported comparison operations for mathematical expressions are:

 ==  // Equals
 !=  // Unequal
 >=  // Greater or equal
 <=  // Less or equal
 <   // Less
 >   // Greater

Supported mathematical operations are:

 +  // Addition
 -  // Subtraction
 *  // Multiplication
 /  // Division

Within this expression, you can use both global variables names in the form Category.VariableName or numeric literals like 0 or -3.
NOTE: Operators and operands must always be seperated by space(s) or parentheses.

Some examples for valid mathematical conditions are:

 Var: Balthazar.iMonstersKilled >= 20    // Requires Balthazar to have killed at least 20 monsters
 Var: Balthazar.iMonstersKilled >= Sentenza_Noria.iMonstersKilled * 2 // Requires Balthazar to have killed twice as many monsters as Sentenza
 Var: Balthazar.iMonstersKilled + Sentenza_Noria.iMonstersKilled > 30 // Requires Balthazar and Sentenza to have killed more than 30 monsters between them.

In addition to mathematical expressions, logical expressions can be used as well. Both can also be combined in a single expression, with varying degrees of usefulness.
For logical expressions, you can also use the constants true and false for comparisons.

In addition to the same equality and inequality comparisons as for mathematical expressions, logic expressions can use the following operators:

 ||  // Logic OR, is true if at least one of the two operands is true.
 &&  // Logic AND, is true if BOTH of the two operands are true.
 !   // Logic NOT, inverts the value of the right hand operand (e.g. ! true == false)

Some examples for valid logical conditions are:

 Var: SomeState.bEpicMonsterKilled  // Simply check if SomeState.bEpicMonsterKilled is true.
 Var: SomeState.bEpicMonsterKilled == false  // Check if SomeState.bEpicMonsterKilled is false.
 Var: SomeState.bEpicMonsterKilled && (Balthazar.iMonstersKilled > 10) // Check whether the epic monster was killed AND whether Balthazar has killed more than 10 monsters.

Multiple Conditions

You can specify multiple conditions per topic/node, simply separate them by line breaks (i.e. one condition per line).