SC2Mapster.com Wiki

Galaxy / Data / Requirements

=== Requirements ===

Summary

Requirements are sets of conditions that you can set for an ability or command card button to be used, these conditions include but are not limited to behaviours being set, abilities being enabled and upgrades being researched. If these conditions are met, there are two actions a requirement can undertake if your conditions are found to be true.

Actions

The two actions that a requirement can execute are as follows.

Use

Allows a visible ability or command card button to be used when conditions are met, Disallows when they are not.

Show

Shows (making it visible) an ability when the conditions are met, Hides when they are not. (Does NOT work on command card buttons)

Since you need an ability to be visible in order for it to be usable, the "Show" action can be considered a prerequisite for the "Use" action

Conditions & Requirement Nodes

Conditions are created under either of these Use and Show actions, depending of course on which action you would like to occur if the conditions are found to be true. The conditions can be both created and viewed either as an Expression - using standard logic syntax (&& means 'and', || means 'or') - or as a Tree, based on your selection at the top of the window. The tree format calls each paramater a requirement node, and displays the operators* of the requirement nodes above as 'folders' of sorts, every requirement node within these 'folders' must follow the operator's rule.

  • (of note, the operators themselves are also called requirement nodes)

The requirement nodes themselves are numerous, but generally speaking most requirement nodes have a "Type", "Alias" and "State"

Type

The kind of condition being called, e.g.: one that counts behaviours, one that checks if a unit is allowed in the tech tree.

Alias

The name of the subject of the condition, e.g.: for Count Behaviour this would be the behaviour

State

The required state for the subject, e.g.: if it needs to be Completed or simply In Progress or Queued, if it needs to be on a specific Unit

Constants

In order for conditions to be made, a comparison must be made between one or more requirement nodes. The most common requirement node that is compared against, is the Constant requirement node.

Constant

An absolute (not relative to anything) numerical value

This requirement node allows you to check whether for example a "Count Behaviour" or "Count Unit" requirement node is "Equals" a certain value, "Equals" being one of the operators (and the most common one used). In order for this situation to occur the requirement nodes need to be paired underneath an operator as was previously mentioned, so that it forms a tree.

+ Equals

  • Count Behaviour Dummy Behaviour
  • Constant 1

In the above example if the Dummy Behaviour count for the unit triggering the ability "Equals" the "Constant" "1" (basically if the unit has the behaviour), then the condition has been met.

Note that the constant can also be used as a Boolean value, meaning that 1 can be equal to True and 0 can be equal to False, for such requirement nodes as Ability Allowed or Unit Allowed.

Operators

There are various operators which can be used, all of which compare two requirement nodes to eachother. The most common of these operators are as follows.

Equals

Checks whether one requirement node is equal to another, such as the previous example of "Count Behaviour" and "Constant 1"

Greater Than/Less Than/etc..

Checks whether one requirement node is greater than, less than or equal to another - likely that this will only work as constants as there is no comparison mechanic between other requirement nodes to state which is "Greater Than" or "Less Than".

Or

Checks whether one condition is equal to another, this node is special because it can only be used with whole conditions such as the above "Equals" example and needs at least two to work. This operator allows any nested condition to execute the action instead of needing all conditions as is normally required.

And

Checks whether one condition is equal to another, this node is special because it can only be used with whole conditions such as the above "Equals" example and needs at least two to work. This operator requires all nested conditions to execute the action, normally this is required anyway but if you are also using an "Or" operator higher up in the tree, its effect will be negated for conditions underneath this operator.

Sum

Adds the value of two requirement nodes together, obviously requires an operator higher up in the tree to check the result of this operator against something else. e.g.: Equals > "Sum (behaviour count 1 + behaviour count 2), Constant 4" would compare the sum of both behaviour counts to the value of "4" and return true if it is equal.

You must login to post a comment. Don't have an account? Register to get one!