Skip to content

References

Megalo actions and conditions take operands — values that identify players, teams, objects, timers, and variables at runtime. This page describes the reference model: how operands are written and what they resolve to.

Reference types

Megalo has five typed reference kinds:

TypeHoldsExample
PlayerA player slotcurrent_player, killer, none
TeamA teamcurrent_team, attackers, defenders, none
ObjectA map objectcurrent_object, one_flag, none
TimerA countdown timerround_timer, current_player.game_start_vo
NumberAn integer valuemy_counter, score_to_win_round, 0

Each type has a none sentinel meaning "no reference" or "empty."

Context references

Trigger kind determines which implicit context references are available:

Trigger kindAvailable context
playercurrent_player
teamcurrent_team
object / map object filtercurrent_object
general, initialization, etc.(none)

These are built-in references that always point to the instance the trigger is currently evaluating.

Custom variable references

Variables declared in variables blocks are referenced by name. Member variables use dot notation:

megalo
; global variable
action set sudden_death_condition set_to true

; player member variable
action set current_player.is_leader set_to 1

; team member variable
action set current_team.goal set_to current_object

; object member variable
action timer_set_rate buy_zone.phase_1_timer 1

; chained member access
action set buy_zone.allies_present set_to attackers_in_area

Team designators

Teams can be referenced by their designator name:

DesignatorRole
attackersAttacking team
defendersDefending team
third_partyThird team
fourth_partyFourth team
fifth_partyFifth team
sixth_partySixth team
seventh_partySeventh team
eighth_partyEighth team
noneNo team
megalo
action play_sound team defenders bone_cv_ph1_intro
action set_score add 1 team attackers
condition if current_player.team equal_to attackers

Team designators are assigned in teams blocks:

megalo
teams
	team
		designator defenders
	end
	team
		designator attackers
	end
end

Team or player target

Some actions take a team or player target — a specific player, a specific team, or everyone. Syntax is team <team_ref>, player <player_ref>, or everyone. See Team or player target for the full operand reference.

megalo
action set_score add 1 team attackers
action play_sound team defenders bone_cv_ph1_intro
action hud_post_message everyone none "Round started!"

Audience references

Other actions take an audience operand that specifies who is affected (visibility, pickup filters, and similar):

AudienceMeaning
everyoneAll players
alliesFriendly players (relative to context)
enemiesEnemy players
playerA specific player (followed by the player ref)
teamA specific team (followed by the team ref)
no_oneNobody
megalo
action navpoint_set_visible current_object allies
action set_pickup_filter one_flag enemies
action boundary_set_visible capture_zone everyone

Built-in timer references

The engine provides built-in timers that are not declared in variables blocks:

TimerDescription
round_timerElapsed time in the current round
sudden_death_timerSudden death countdown
grace_period_timerGrace period after round time expires

Custom timers are declared as networked timer variables and referenced by name or through member access.

Object type references

Object types in create_object and object_is_type use quoted names from object lists:

megalo
action create_object "flag" at current_team.flag_spawn set current_team.flag never_garbage
action create_object "invis_cov_resupply_capsule" at current_object never_garbage
condition object_is_type current_object "area"
condition object_is_type current_object "fireteam_1_respawn_zone"

Player-as-object references

A player reference can be used wherever an object reference is expected. The engine resolves the player's physical body object:

megalo
; from simple/koth/1.txt — a player reference used as an object reference
action for_each player
	condition object_in_area current_player current_object
	action timer_set_rate current_player.time_in_hill 1
end

temporary object my_body current_player
action for_each general
	condition if my_body != none
	action set current_player.body = my_body
end

String table references

String operands in actions and element fields reference symbols defined in string_table blocks:

megalo
action hud_post_message player current_player none invasion_title_spartan
action player_set_objective current_player slayer_objective score_to_win_round
action navpoint_set_text current_object nav_weapon_drop

These are not quoted strings in the source — they are identifier references resolved through the string table at runtime.

Filter references

Object filter operands identify who can interact with an object:

FilterMeaning
allEveryone
alliesFriendly players/teams
enemiesEnemy players/teams
no_oneNobody
noneNo filter (disabled)

Used in respawn, pickup, and fireteam filter actions:

megalo
action set_respawn_filter current_object allies
action set_pickup_filter current_object no_one
action set_fireteam_respawn_filter current_object all

See also