If Health Icon If Health

This action is used to check the value of the instance variable health using a specific expression. You give the type of expression to check with and the value to check the current health against, and the "if" statement will always return either true or false depending on the expressions and values used. The available expressions are:

If you flag the Not argument, then the above will be negated expressions, for example "equals to" becomes "not equals to", so you would be checking if the health value is not equals to the given value.

IMPORTANT Due to floating point precision issues, checking to see if two values are exactly equal may return false, since one may be exactly 1, while the other may be 1.00000000000001. This can be avoided by using the Decimal to Integer action before checking or using the "greater than" or "less than" expressions.

Note that to add actions into the "if" block, they should be dropped to the side of the action, as shown in the image below:

If Health drop actionsThese actions will now be run if the "if" evaluates to true, while any actions dropped elsewhere will be performed after the "if" block.

 

Action Syntax:

If Health Action

Arguments:

ArgumentDescription
NotSet to check if the expression does not evaluate to true.
ExpressionThe type of expression to use for the check.
ValueThe value to check the health against.

 

Example:

If Health ExampleThe above action block code will add 25 onto the health variable and then check to see if the variable is now greater than 100, and if it is it will be set to 100.