condition
Conditions are predicates inside triggers that control when actions run. When a condition evaluates to false, the trigger halts — subsequent conditions and actions in that trigger are skipped for the current evaluation.
Condition names match e_condition_type in @blamnetwork/blf (none is a wire sentinel and is not written in source).
| Name | Arguments | |||
|---|---|---|---|---|
if | <left> <comparison> <right> | Yes | Yes | Yes |
object_in_area | <object> <area> | Yes | Yes | Yes |
player_died | <player> <killer_type> | Yes | Yes | Yes |
team_disposition | <team> <team> <disposition> | Yes | Yes | Yes |
timer_expired | <timer> | Yes | Yes | Yes |
object_is_type | <object> <type> | Yes | Yes | Yes |
team_is_active | <team> | Yes | Yes | Yes |
object_out_of_bounds | <object> | Yes | Yes | Yes |
player_is_fire_team_leader | <player> | Yes | Yes | Yes |
player_assisted_with_kill | <player> <player> | Yes | Yes | Yes |
object_matches_filter | <object> <filter> | Yes | Yes | Yes |
player_is_active | <player> | Yes | Yes | Yes |
equipment_is_active | <object> | 73+ | Yes | Yes |
player_is_spartan | <player> | 73+ | Yes | Yes |
player_is_elite | <player> | 73+ | Yes | Yes |
player_is_editor | <player> | 73+ | Yes | Yes |
game_is_forge | (none) | 73+ | Yes | Yes |
Syntax
condition [not] <name> [arg1] [arg2] ... [or]not— optional prefix that negates the resultname— the condition type (e.g.if,player_died,timer_expired)- args — operands specific to the condition type
or— optional suffix that joins this condition with the next using logical OR
condition if score_to_win_round != 0
condition if teams_enabled == 1
condition player_died current_player enemy
condition not if current_player.heard_game_start == 0
condition timer_expired current_player.game_start_voComparison conditions (if)
The if condition compares two values. It supports several operator spellings:
| Operator | Alternatives |
|---|---|
equal_to | == |
not equal_to | != |
less_than | < |
greater_than | > |
less_than_or_equal_to | <= |
greater_than_or_equal_to | >= |
condition if hidden_gametype equal_to k_hidden_swat
condition if score_to_win_round != 0
condition if round_time_limit > 0
condition if current_player.is_leader equal_to true
condition if shields > 100
condition not if current_player.score == 0Both sides of a comparison can be variables, constants, built-in globals, game options, or member variables.
Event conditions
Event conditions test game state rather than comparing values. The table above lists every condition type; common examples:
condition player_died current_player enemy
condition timer_expired round_timer
condition object_in_area current_player current_object
condition object_out_of_bounds current_team.flag
condition team_is_active current_team
condition object_is_type current_object "area"player_died killer types
condition player_died current_player any ; any death
condition player_died current_player enemy ; killed by an enemy
condition player_died current_player betrayal ; team kill
condition not player_died current_player enemy ; not killed by enemy (suicide, etc.)Combining conditions
AND (implicit)
Separate condition lines act as a logical AND. All must be true for subsequent actions to run:
trigger player
condition player_died current_player enemy
condition if current_player.is_leader equal_to true
action set_score add leader_kill_bonus player killing_player
endOR
Append or to a condition line to join it with the next condition using logical OR:
trigger general
condition if hidden_gametype equal_to k_hidden_covy or
condition if hidden_gametype equal_to k_hidden_swat
action for_each health_packs
action delete_object current_object
end
endMultiple or-joined conditions can span several lines:
condition if current_player.team equal_to attackers or
condition if current_player.team equal_to fourth_party or
condition if current_player.team equal_to third_partyIf the combined OR group evaluates to false, the trigger halts.
NOT
Prefix a condition with not to invert its result:
condition not if current_player.heard_game_start == 0
condition not player_died current_player enemy
condition not if one_flag equal_to noneConditions inside for_each
Inside an action for_each sub-trigger, a false condition skips the current iteration rather than halting the entire trigger. This is equivalent to a continue statement:
action for_each player
condition if current_player.team equal_to attackers
action set current_player.fireteam set_to 0
endOnly players on the attacking team have their fireteam set; other players are skipped.
Condition placement
Conditions can appear anywhere in a trigger — before actions, between actions, or after actions. Actions that appear before a failing condition have already executed:
trigger team
; this action always runs
action set_pickup_filter current_team.flag enemies
temporary player carrier none
action get_player_holding_object current_team.flag carrier
; this condition gates what follows
condition not if carrier equal_to none
action apply_player_traits carrier flag_carrier_traits
endSee also
- trigger — trigger execution model and halt-on-false
- action — actions that follow conditions
- Variable model — operands in comparisons
- References — player, team, object operands