Megalith glossary
Words a mode author meets in the Megalith docs, A to Z, each with a link to where it is explained.
A
- Ability keys
Four keys every player has for game modes, Ability 1 to Ability 4, bound under Game Mode Abilities in Settings. A script hears them in
on button pressasbutton.ability_1tobutton.ability_4; in a mode that doesn't listen they do nothing.See Ability keys.
- alias
Gives a variable slot, a constant or a
script_option[n]a name, such asalias points = player.number[0], used ascurrent_player.points.allocate temporary numberorallocate global.numbertakes a free slot for you. An alias lasts to the end of its block.See The language.
- Arithmetic
Sums written between values, such as
current_player.biped.get_speed() * 3 / 4 + 1:*and/before+and-, with parentheses, wherever a number goes. Numbers stay whole; mathematics such asmin,max,clamp,sqrt,sinandatan2carries fractions as thousandths.
B
- Biped
A character's body.
current_player.bipedis the player's body, orno_objectwhile they're dead;set_bipedmoves a living player into another body, and a class names its body inbiped.- Body list
The 38 body names a mode can create or give players: every Halo 3 character, Flood forms included, each with the campaign map it comes from and its model variants. The host needs that campaign map;
spartan,eliteandforge_monitorneed nothing extra.See Every body.
break,continueIn a
for eachloop: leave the loop, or go on with its next player, team or object.- Bundled modes
The eight modes that come with the game: Gun Game, Growth, One in the Chamber, Zone Control, Flood Infection, UNSC vs Covenant vs Flood, UNSC vs Covenant: Reach and Conquest. They sit in the Project Reclaimer folder of Game Modes; the game puts back one that's missing and never overwrites one you changed.
See The modes.
In a widget's text, a button such as
button.fire, which each player reads as their own key or controller button for it: “Hold Left mouse” for one, “Hold RT” for another.
C
- Class
A role players choose before each life, declared under
[logic.deployment]with its body, look, weapons, grenades, traits, cost andmax_activelimit. A mode has 2 to 128 classes, at most 48 a team, and needs"rounds.teams" = 1and a free class without a limit on each team.- Class abilities
What a script makes of ability keys, equipment, objects, traits and timers, such as active camouflage on a key or cover an Engineer deploys. There are no new animations, models or HUD icons.
- Class picker
Where players choose a class: the built-in class cards, the deployment map in a mode with deploy points, or a picker the script draws itself with widgets when
script_menu = true, deploying the clicked class withdeploy_class.- Co-op spawning
Reach's way of spawning a dead player beside a living teammate of their fireteam who is out of combat, set with
set_co_op_spawningon a team or a player. While they wait they watch that teammate or their spawn location and step through the choices with the D-pad's up and down. Invasion spawns this way.See Reach's calls.
- Condition call
A call that tests something and goes in an
if:is_zero,is_not_respawning,has_any_players,has_alliance_status,shape_contains,is_of_type,has_forge_label,is_button_held,is_driver,is_airborne,is_crouched,is_grounded,has_crosshair_pointand the others the docs mark (condition).- Conquest
The bundled mode
bf-conquest.rmeg: two teams of five classes, in squads, fight over Halo 3's territories for tickets and choose where to deploy on the deployment map. It plays Territories;megalo-conquest.rmegis a smaller example without classes or squads.See Conquest.
- Created object
An object the script makes with
place_at_me. The round's end removes it, except bodies players are in; delete the ones you're done with: a script keeps at most 2,048 at once.See Creating objects.
current_player,current_object,current_teamThe player, object or team a loop is visiting or an event is about. A loop gives the previous one back when it ends.
See The language.
D
- Damage category
The kind of a hit, written
damage.NAME:none,falling,bullet,grenade,high_explosive,sniper,melee,flame,mounted_weapon,vehicle,plasma,needleandshotgun.set_damage_fromlets a category reach an object or not, andon object damagedgives it asdamage_category.See Damage.
- declare
Gives a variable a starting value, such as
declare player.number[0] = 3; without one, numbers and timers start at 0 and references atno_object,no_playerorno_team.declare team_countsets how many teams the mode has.See The language.
- Declared object
A zone or object type named in the header under
[logic.objects.NAME], up to 64: a weapon, a body, a stock object, a tag path or a placement of the saved map. A zone is there from the round's start; the others are typesplace_at_metakes by name.- Deploy point
An object a team's players may deploy beside, set with
object.set_deploy_point(team), or(team, squad)for one squad;no_teamtakes it away. Up to 64 at once, and a body counts only while its player lives.- Deployment map
What the dead see in a mode with classes and deploy points: a panel of classes and places beside the battle seen from high above. Players choose while the respawn countdown runs and deploy as it ends, at HQ, the team's own spawn points, if their place is gone; split screen keeps the class cards.
- Deployment points
The points players spend on classes, 0 to 100,000; a class's
costis what it takes.get_deployment_points()andset_deployment_points(n)read and change them.
E
- enum
A set of named whole-number constants. Entries count up from the last value, starting at 0.
See The language.
- Equipment
Halo 3's equipment, such as
bubble_shield,regeneratorortrip_mine.place_at_medeploys it as if thrown, andgive_equipment(name)hands it to a living player's body to use with Use equipment.- Event
A handler that runs when something happens:
on init,on widget click,on button press,on object damaged,on object death, players joining, spawning, leaving and changing teams, vehicles entered and left, objectives picked up, dropped, reset and scored, and more. Each event has one handler, at the top level of the file (on object damagedmay have more, for one label or one category); everything outside the events runs every tick.See Events and timers.
F
- Faction
A side in UNSC vs Covenant vs Flood and UNSC vs Covenant: Reach. The lobby's teams are the factions, and each has limited reinforcements.
for eachLoops over every player (
for each player, orrandomlyfor a shuffled order), every team, every object, or the objects with a label (for each object with label "gift"). Each visit setscurrent_player,current_teamorcurrent_object; dead players are visited too.- Fine units
A header's
[logic]setting,fine_units = true, that counts positions, distances, speeds and facings in thousandths of a Forge unit and of a degree, for modes that move bodies themselves.See Fine units.
- Forge label
A group name saved on a Forge object under Megalith scripting in its Properties, up to 32 bytes, with capitals counting. Scripts find labeled objects with
for each object with labeland test one withhas_forge_label, so one script works on any map whose objects carry the label.- Forge unit
The distance unit of Forge, 10 feet. Positions, distances and offsets in a script are in tenths of a Forge unit;
move_to, a position in the header and zone sizes are in whole Forge units. In fine units they're all thousandths.See Units.
- function
A named block of script that may take up to 16 values, each written
TYPE NAME, such asfunction award(number amount, player who). It works on the caller's current player, team and object too and returns nothing;returnleaves it early. Declare it before using it.See Functions.
G
- Game Modes folder
The folder in your player folder where modes live; in Host Game, Game Type, Open Folder opens it. A mode in it, or in a folder inside it, is on the Megalith card after Refresh.
See Install a mode.
- Game option
A setting of Game Options, set in the header's
[options]by its name, such as"rounds.teams" = 1. The quickest way to find a name is to change the setting, choose Save as Variant and read the saved.jsonfile.See Game options by name.
- Game type
The multiplayer game type a mode plays, named by
modein the header, such asSlayer,KingOfTheHillorTerritories; Slayer without one. Its objectives, scoring and round rules keep running alongside the script, and Forge and the campaign can't be scripted.See Game types.
- Global variable
A variable slot that belongs to the round: 64 numbers, 32 objects, 16 players, 16 teams and 16 timers, such as
global.number[0]. Every round starts fresh.See The language.
H
- Health and shields
On a body,
max_healthandmax_shieldsset the maximums in percent of the character's own, 1 to 1000, andhealthandshieldsset what's left. On a player's body they stay for every life from then on.- HUD widget
One of a mode's 32 text lines,
script_widget[0]toscript_widget[31], each with an optional bar. Every player has their own copy, so text, bars and visibility can differ from player to player; widgets start hidden, and a placed widget sits anywhere on the script screen.See HUD widgets.
I
if,elseif,else,altif,altif … then … elseif … then … else … endtests comparisons and condition calls, joined withnot,andandor, and runs the first branch whose condition holds.orbinds first. Megalo'saltifandaltalso work, but check the earlier conditions again rather than remembering which branch ran; aniftakes one kind or the other.
J
- JSON game type
A mode saved as a
.jsonfile: Game Options → Save as Variant writes one with the script and options together, andmode-compilemakes one from a source. It holds the source text too, and older modes written in JSON keep working.See Older JSON modes.
L
- Loadout
What a class carries:
primaryandsecondaryweapons by name or tag path,dual_wield, andgrenades, 0 to 4 each of frag, plasma, spike and firebomb. A script can also arm a player withset_weapon.- Loadout camera
A Reach game variant's wait at each round's start,
game.loadout_cam_timeseconds (10 unless the variant says otherwise), in which nobody gets a body and each player sees the map's Initial Loadout Camera. The script and its timers run meanwhile.localA variable of a block's own, such as
local number totalorlocal object nearest = current_object, gone with the block and empty each time it's entered. Locals are temporaries.See Variables.
- Looks
A look a mode puts over the one a player picked, with
set_model,set_armor,set_armor_colorandset_visor_color; what it leaves out stays the player's.reset_look()gives back the player's own, and a look lasts until the round ends.See Looks.
M
- Megalith
Project Reclaimer's game mode language, grown from Megalo so far that it has a name of its own (before 0.10.12 it was called Megalo). It reads every Megalo source as written, adds arithmetic, more events,
else,breakandreturn, functions with values and local variables, and every bundled mode is written in it. Only the host runs a script; players see what it does through the game.See What Megalith is.
- Megalith card
The card after the game types in the game type picker, listing every Megalith mode with the game type it plays. A mode also shows among the variants of its game type.
See Play one.
- Megalith console
The chat line's
/megalithcommand (/megalostill works), which runs a line of Megalith in the running game, orreloads orrestarts the mode's script without loading the map again. Off by default: turn on Megalith console in Host Settings and host on this PC alone, with Network set to Local. It never works in a game other players can join.See The Megalith console.
- Megalo
The scripting language of Halo: Reach's game types, in the text form ReachVariantTool writes. Megalith grew from it and reads every Megalo source as written, Reach's own game variants included.
See What Megalith is.
megalo-checkA command of the game that reads a script alone, checks its types and lists what it needs, such as
timer.set_rate. It doesn't read the header or check that Halo 3 can do all of it:mode-checkdoes.See Check a mode.
- Mode header
The block comment from a line
--[=[ modeto]=]that holds a mode's settings as TOML: itsname,mode,author, rules, options, world settings and[logic]tables. A source without one plays as Slayer, named after its file.See The mode header.
What
set_movement(share, percent)changes about how a player's bodies move on foot, in percent of the body's own:run_speed,crouch_speed,acceleration,air_acceleration,decelerationandair_deceleration.See Movement and aim.
mode-checkA command of the game that checks a
.rmeg,.rvtor.jsonmode the way the game does when it lists one: the header, the script, and that the game plays everything it asks for. It names a mistake by line and column.See Check a mode.
mode-compileA command that checks a mode and writes the JSON game type it plays to
--output NEW.json. It is never needed to play a mode and never overwrites a file.See Check a mode.
- Model variant
One of a body's looks, such as
heavyfor a Grunt orcaptainfor an ODST, named in the last argument ofplace_at_meor in a class'smodel_variant;nonegives the default look. A variant the body doesn't have stops the script.See Choosing a look.
N
neutral_teamThe fixed team beside the playable ones.
for each teamvisits it, but it isn't a team to join and has no name to set.See The language.
no_object,no_player,no_teamEmpty references. A saved reference becomes one when its player leaves or its object is deleted, and a call on one does nothing and gives 0 or nothing back.
See The language.
O
- Object types
What
is_of_typetests andplace_at_memakes: object kinds such asvehicle, kinds of vehicle such asaircraft, stock objects, weapons, bodies, objective items (flag,bomb,oddball) and tag paths.- Object variable
A variable slot that belongs to an object: 32 numbers, 8 objects, 8 players, 4 teams and 8 timers, such as
current_object.number[0].See The language.
The event that runs when a player presses a button, with
current_playerthe player who pressed andpressed_buttonthe button, such asbutton.ability_1orbutton.jump. Holding a key doesn't repeat it.on initThe event that runs once as each round starts, such as to set a timer counting.
See Events and timers.
on object damagedThe event that runs for every hit on every object, with
current_objectthe object hit,current_playerwho's responsible anddamage_categorythe kind of hit, beside the attacker's body or vehicle and the damage as it came and as the rules left it. It runs often, so keep its handler short.See Events and timers.
on object deathThe event that runs when a player's body dies, with
current_playerthat player,killed_objectthe body,killer_playerandkiller_object. A revive keeps the body from here.See Events and timers.
on widget clickThe event that runs when a player clicks a placed, clickable widget in their script menu, with
current_playerthe player andclicked_widgetthe widget's number.one_team_ends_scripted_gamesA dedicated server's Experimental setting, off by default: a scripted game ends, as Halo 3's own game types do, once only one team has been left for 5 seconds, unless the mode ends the round first. A game that began with one team never ends this way.
See Teams and the game.
- Option
A setting hosts can change, declared in
[logic.options]as{ value, min, max }and shown under Custom Mode Options in the game type's rules. The script reads it asscript_option[n], counting the options in alphabetical order; a mode declares up to 32 and reads the first 16.- Other games' characters
Characters of Halo: Reach, Halo: Combat Evolved and Halo 2, such as
reach_spartan,halo1_chieforhalo2_elite, which a mode names like any body when that game is installed. The host's Other games' characters setting, on by default, allows them, and players who join need that game.See Other games' bodies.
P
place_at_meplace_at_me(type, label, flags, x, y, z, variant)creates an object at this one and returns it. The offsets are tenths of a Forge unit along the object's heading, and the last value is a body's model variant ornone.See Creating objects.
- Player variable
A variable slot that belongs to a player: 32 numbers, 8 objects, 8 players, 8 teams and 8 timers, such as
current_player.number[0]. It stays through respawns and is cleared when the player leaves, so it suits cooldowns, deployed objects and a chosen class.See The language.
pregameandlocalReach's events, read in any source.
pregameruns beforeinitas a round starts, andlocalruns each tick once for each player, withhud_playerthat player and the widgets it changes theirs alone.
R
- Raycast
game.raycast(x1, y1, z1, x2, y2, z2): a line between two points that the host follows through the level and its objects. From the next tick on,game.raycast_hit()says whether it met something, and where and what.See Teams and the game.
- Reach content on Halo 3 maps
On Halo 3 and ODST maps, a mode that names Reach objects such as
unsc_data_coregets them brought from Reach before the map loads, with the loadout weapons Halo 3 lacks and missing announcer lines. The host needs Reach installed and Other games' characters on, and the map still needs the labels the mode expects.- Reach game variant
One of Halo: Reach's own game variants, from MCC, the Workshop or ReachVariantTool. It runs through the same interpreter as a
.rmeg, but plays by Reach's rules where they differ from Megalith's: its script reads the options the host set, its timers count as Reach's, and a division by zero gives 0.- Reference
A variable that holds an object, a player or a team. It stays on what it points at: when the player leaves or the object is deleted it becomes
no_objectorno_player, never something else. References take only=.See The language.
- Refresh
The game type picker's button that reads the Game Modes folder again. After every change to a file, choose Refresh and select the mode again: the lobby keeps the copy it loaded, and a running round keeps the script it started with.
- Reinforcements
A faction's lives in UNSC vs Covenant vs Flood and its Reach version, 150 by default. Each death costs one, a faction with none deploys nobody, and the faction with the most when the battle ends wins.
- Respawn object
The object a dead player spawns beside, set with
set_primary_respawn_object(object): a teammate's body, a beacon, a vehicle or a fallen body.no_objectspawns them where Halo 3 does.returnLeaves the function or event being run; in the script's body, the rest of this tick's run.
- Revive
Bringing a fallen player back where they fell: keep their body from
on object deathand respawn them beside it at once. Conquest's and Combined Arms' Medics revive by holding Ability 3 over the body..rmegThe file extension of a Project Reclaimer Megalith mode: one text file holding the mode header and the script. ReachVariantTool's
.rvtfiles read the same; a file ending in.rmeg.txtisn't listed.See What Megalith is.
S
A player's menu over the game, opened with
current_player.set_ui_menu(true): their cursor appears and their game input stops; on a controller the D-pad walks the clickable widgets and A clicks. Clicking a placed widget marked withset_clickablerunson widget click, and only the script closes the menu.- Script screen
The 1280 by 720 area, 0, 0 at the top left, on which placed widgets sit. Each player's view shows it scaled to fit and centered, so a layout keeps its proportions on every display.
- Script stops
What happens when an event fails, such as a division by zero (outside a Reach game variant), a value out of range or too many steps: its changes to the script's state are thrown away and the script stops for the rest of the game. The game goes on without it, and the host's log says why, by line and column.
See Limits.
scripted_round_endA
[logic]setting of the header: withtrue, the game type's score, time and objective limits no longer end a round, and the script ends it withgame.end_round()orteam.end_round().See The mode header.
- Spawn beacon
An object a squad or team spawns beside. In Conquest it's a Recon's deployed radar jammer, their squad's until the enemy destroys it; Combined Arms uses objects labeled
spawn_beacon.See Conquest.
- Spawn sequence
A number from −128 to 127 saved on a Forge object beside its label, read by scripts as
spawn_sequenceto tell labeled objects apart. Objects without one, and objects the script creates, read 0.- Squad
A group of players in a team, 1 to 16, set with
set_squad(n)and read withget_squad(); 0 is none. The deployment map shows a player their squad in green, and a squad can have deploy points of its own.- Step limit
The most steps one event may take: 65,536 in a game of up to 16 players, and more in bigger games. It keeps any script from running forever or holding up the game.
See Limits.
T
- Tag path
The name of an object tag the map has, such as
"objects/vehicles/mongoose/mongoose", written with forward slashes.place_at_me,set_weapon, a class's weapons and the vehicle calls take one, so a mode can use a mod's or another game's objects loaded on the map.See Tag paths.
- Team count
declare team_count, from 2 to 64 at the top level of the script, gives a team game more teams than Halo 3's eight. Only Slayer, Oddball, King of the Hill, VIP and Territories can have more than eight, and in a mode with classes it must match the classes' teams.- Team names and colors
team[3].set_name("Squad %n", 4)andteam[3].set_color(255, 140, 0)rename and recolor a team everywhere players see it. Teams 9 to 64 start as “Team 9” to “Team 64”, each with a color of its own.- Team variable
A variable slot that belongs to a team: 32 numbers, 8 objects, 8 players, 8 teams and 8 timers, such as
team.number[0].See The language.
- Temporaries
Variable slots that last for the current tick only: 256 numbers, 128 objects, 64 players and 64 teams, and no timers. They take no starting value.
localvariables and functions' values are temporaries too.See The language.
- Territories
Halo 3's game type of capturing and holding territories, which Conquest plays.
team.get_territory_count()counts a team's, andobject.get_territory_owner()tells who holds one by its marker object.See Game types.
- Tick
One step of the game, 30 or 60 a second as the host runs, which
game.get_ticks_per_second()reads;game.get_tick()counts them from the round's start. Everything outside an event runs on every tick, after that tick's deaths and spawns; a paused game has no ticks.See Events and timers.
- Tickets
A team's score in Conquest, kept in a number of the script: each death costs one, a Medic's revive gives it back, and the team holding fewer territories bleeds them. A team out of tickets loses.
See Conquest.
- Timer
A variable that counts seconds.
set_rate(-100%)counts it down,100%up and0%stops it;reset()puts back its declared value, andis_zero()is a test to check every tick, not an event.See Events and timers.
- Trait set
A set of Halo 3 player traits declared in
[[logic.megalo_traits]], read asscript_traits[0]and on, up to 16.apply_traitsgives one for a single tick, so apply it every tick the player should have it.- Trait values
The values a trait set or a class's traits take: each a choice by its place in Game Options' list, not a percentage, with 0 meaning unchanged.
See Trait values.
V
- Variable
A numbered slot holding a whole number, a reference or a timer. Slots belong to the round, a player, a team, an object or the current tick, count from 0, and are named with
alias.See The language.
W
- Waypoint
Halo 3's objective marker over an object, shown once
set_waypoint_visibilityis set, with an icon, a priority, and optional text and timer. It's blue to the object's team and red to the others, and at most 64 show at once.See Waypoints.
Z
- Zone
An invisible area with a shape, a sphere, a box or a cylinder, that players can't see or bump into. A mode declares one in its header, or uses a Forge object's zone;
shape_containstests whether an object is inside (a player's body by its feet or a point just above them), andset_positionmoves it.
