Dialogues/Conditions

From SF3
< Dialogues
Revision as of 12:27, 27 October 2016 by Dave (talk | contribs)

Jump to: navigation, search

Every quest, quest task, 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 dialogue fragments, quests, and quest tasks, 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
  • Qst: Check the state of a given quest
  • Tsk: Check the state of a given quest task

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

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 

Var: 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.

Qst: Quest Conditions

For quest conditions, Expression must match the following format:

 QuestName [[not] RequiredState]

Where QuestName is the technical name of the quest of which the state should be tested.
RequiredState is the state the quest must be in in order to satisfy the condition. This can be one of: Unfinished, Completed, Failed.
not may be specified optionally in order to invert the condition (i.e. the quest state must be anything but the specified state).

If no state is specified, the condition will default to checking whether the quest has been completed.

Some examples for valid quest conditions:

 Qst: MyAwesomeQuest             // Checks whether MyAwesomeQuest has been completed (Completed is assumed if not specified)
 Qst: MyAwesomeQuest Unfinished  // Checks that MyAwesomeQuest has not been finished yet.
 Qst: MyAwesomeQuest not Failed  // Checks that MyAwesomeQuest has not failed (may be either unfinished or completed successfully)

Tsk: Quest Task Conditions

Quest task conditions are mostly identical to quest conditions, the only difference being that there is a task name specified in addition to the quest name.
The required format for Expression is:

 QuestName TaskName [[not] RequiredState]

Where TaskName is the technical name of the task for which the state should be checked. All other parameters are identical to those used by Quest Conditions.

Some examples for valid quest task conditions:

 Tsk: MyAwesomeQuest Task_A           // Checks whether Task_A in MyAwesomeQuest has been completed (Completed is assumed if not specified)
 Tsk: MyAwesomeQuest Task_A Failed    // Checks that Task_A in MyAwesomeQuest has failed.

Multiple Conditions

You can specify multiple conditions per topic/fragment, simply separate them by line breaks (i.e. one condition per line).
If multiple conditions are given for a topic/fragment, it will only be available if ALL conditions have been met.

Every quest, quest task, 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 dialogue fragments, quests, and quest tasks, 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
  • Qst: Check the state of a given quest
  • Tsk: Check the state of a given quest task

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

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 

Var: 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.

Qst: Quest Conditions

For quest conditions, Expression must match the following format:

 QuestName [[not] RequiredState]

Where QuestName is the technical name of the quest of which the state should be tested.
RequiredState is the state the quest must be in in order to satisfy the condition. This can be one of: Unfinished, Completed, Failed.
not may be specified optionally in order to invert the condition (i.e. the quest state must be anything but the specified state).

If no state is specified, the condition will default to checking whether the quest has been completed.

Some examples for valid quest conditions:

 Qst: MyAwesomeQuest             // Checks whether MyAwesomeQuest has been completed (Completed is assumed if not specified)
 Qst: MyAwesomeQuest Unfinished  // Checks that MyAwesomeQuest has not been finished yet.
 Qst: MyAwesomeQuest not Failed  // Checks that MyAwesomeQuest has not failed (may be either unfinished or completed successfully)

Tsk: Quest Task Conditions

Quest task conditions are mostly identical to quest conditions, the only difference being that there is a task name specified in addition to the quest name.
The required format for Expression is:

 QuestName TaskName [[not] RequiredState]

Where TaskName is the technical name of the task for which the state should be checked. All other parameters are identical to those used by Quest Conditions.

Some examples for valid quest task conditions:

 Tsk: MyAwesomeQuest Task_A           // Checks whether Task_A in MyAwesomeQuest has been completed (Completed is assumed if not specified)
 Tsk: MyAwesomeQuest Task_A Failed    // Checks that Task_A in MyAwesomeQuest has failed.

Multiple Conditions

You can specify multiple conditions per topic/fragment, simply separate them by line breaks (i.e. one condition per line).
If multiple conditions are given for a topic/fragment, it will only be available if ALL conditions have been met.