Skip to content

Console commands

This page only lists the console commands that REX and M2EX add. All the original game’s console commands still work, but they aren’t listed here.

The console opens with the ` key (left of 1 on most keyboards). Type a command and press Enter. Arguments are separated by spaces. Put an argument in quotes if it contains spaces, such as a unit name.

In the syntax, <value> is required and [value] is optional. Use the dropdown to show only the commands for one game.

REX/M2EX · campaign

add_soldiers <character | settlement> <unit type> <amount>

Adds soldiers to an existing unit of that type in the character’s army or the settlement’s garrison.

REX/M2EX · campaign

adjust_treasury [faction] <multiplier>

Multiplies a faction’s treasury, so 1.05 gives 105% of the current amount. Without a faction it uses your own.

REX · campaign

ally_desire <faction> <target faction>

Shows the seven terms of the betrayal score for the alliance between two factions: land desire, strength, common enemy, human difficulty, core attitude, current wars and turns at peace.

REX/M2EX · campaign

change_character_faction <character> <faction>

Moves a character to another faction.

REX/M2EX · campaign

create_assassin <settlement>

Spawns an assassin at the settlement, owned by the settlement’s faction.

REX/M2EX · campaign

create_diplomat <settlement>

Spawns a diplomat at the settlement, owned by the settlement’s faction.

REX/M2EX · campaign

create_fort <x> <y> <faction> <culture> [variant] [permanent] [name <name>]

Creates a fort for the faction at strat map tile (x, y).

  • [variant] picks the fort type (M2EX only). The default is wooden_fort.
  • permanent makes a permanent fort.
  • name <name> names the fort. A bare name is a localisation key from expanded.txt; a “quoted” name is used as literal text.

M2EX · campaign

create_merchant <settlement>

Spawns a merchant at the settlement, owned by the settlement’s faction.

REX/M2EX · campaign

create_resource <x> <y> <resource>

Adds a trade resource to strat map tile (x, y).

REX/M2EX · campaign

create_spy <settlement>

Spawns a spy at the settlement, owned by the settlement’s faction.

M2EX · campaign

cull_faction <faction>

Disbands every named general of the faction, and the field army each one leads. The leader, the heir and their direct paternal line are kept. Governors’ garrisons are left intact.

REX/M2EX · campaign

decimation_army <character> <percent>

Reduces every unit in the character’s army by the given percent (1 to 100).

REX/M2EX · campaign

destroy_building <settlement> <building level>

Destroys a building in the settlement. Building level names come from export_descr_buildings.txt.

REX/M2EX · campaign

destroy_fort <x> <y>

Removes the fort at strat map tile (x, y). It fails if the fort has a garrison.

REX/M2EX · campaign

destroy_selected_fort

Removes the fort selected in the UI. It fails if no fort is selected or the fort has a garrison.

REX/M2EX · campaign

display_message <message id>

Shows a custom event message from custom_messages.txt.

REX/M2EX · campaign

downgrade_building <settlement> <building level>

Downgrades a building by one level. A building that is already at its lowest level is destroyed.

REX/M2EX · campaign

dump_region_names

Writes the current region and settlement names, including in-game renames, to <mod>/data/text/<language>/<campaign>_regions_and_settlement_names.dump.txt. The file is ready to drop back into the mod.

REX/M2EX · campaign

give_settlement <faction> <settlement>

Gives the settlement to the faction. This doesn’t count as a diplomatic transgression.

REX/M2EX · campaign

go_to_capital <faction>

Moves the camera to the faction’s capital.

REX/M2EX · campaign

go_to_char <character>

Moves the camera to the character.

REX/M2EX · campaign

go_to_pos <x> <y>

Moves the camera to strat map tile (x, y).

REX/M2EX · campaign

go_to_sett <settlement>

Moves the camera to the settlement.

REX/M2EX · campaign

kill_army <character>

Kills the army led by the character. If the character has no army, only the character dies.

REX · campaign

remove_ancillary <character> <ancillary>

Removes an ancillary from the character. The original M2TW already has this command.

REX/M2EX · campaign

remove_resource <x> <y>

Removes the trade resource at strat map tile (x, y).

rename_faction, rename_fort, rename_region, rename_settlement

Section titled “rename_faction, rename_fort, rename_region, rename_settlement”

REX/M2EX · campaign

rename_faction <faction> <name>
rename_region <region> <name>
rename_settlement <settlement> <name>
rename_fort <x> <y> <name>

Renames a faction, region, settlement or the fort at strat map tile (x, y). Regions use their descr_regions.txt name. A bare name is a localisation key from expanded.txt; a “quoted” name is used as literal text.

REX/M2EX · campaign

replen_all_forts [faction] <percent> [owner] [not_siege]

Replenishes the units garrisoned in the faction’s forts by the given percent of their full size (1 to 100). Generals’ bodyguards are skipped. Without a faction it uses your own.

  • owner only replenishes forts in regions the faction owns.
  • not_siege skips forts that are under siege.

REX/M2EX · campaign

replen_soldiers <character | settlement> <percent>

Replenishes the units in the character’s army or the settlement’s garrison by the given percent of their full size (1 to 100). Generals’ bodyguards are skipped.

REX/M2EX · campaign

set <unit_cost_multiplier | unit_upkeep_multiplier | building_cost_multiplier> [value]

Changes one of the descr_strat.txt cost multipliers during the campaign. Without a value it shows the current one. The value is saved with the campaign.

REX/M2EX · campaign

set_heir <character>

Makes the character the faction heir.

REX/M2EX · campaign

set_leader <character>

Makes the character the faction leader.

REX/M2EX · campaign

set_population <settlement> <amount>

Sets the population of the settlement.

REX/M2EX · campaign

show_counter <name>

Shows the current value of a script counter.

REX/M2EX · campaign

show_counters

Lists all active script counters and their values.

REX/M2EX · battle, battle editor

battle_time_multiplier [multiplier]

Changes how fast time of day and weather move during the battle. 1 is the normal speed and 0 freezes it. Without a value it shows the current multiplier.

REX · battle, battle editor

cloud_drift [0..360]

Sets how fast the clouds drift, in degrees per minute at normal battle speed and 10 m/s wind. 0 keeps them still.

REX · battle, battle editor

cloud_sunset_rim [0..2]

Sets how strongly sunset light shines on the edges of the clouds. 0 turns it off.

REX/M2EX · battle (M2EX also in the battle editor), also in multiplayer

freecam [on | off]

Toggles the free-fly camera. It can turn 360 degrees on the spot and move up and down with Q and E. Your normal battle camera setting is kept.

REX · battle

lbc_carry_tune <list | select N | next | show | print | done | offset X Y Z | rotate X Y Z | scale S | move axis amount | turn axis degrees | nudge_offset X Y Z | nudge_rotate X Y Z | nudge_scale S | reset | axes [on | off]>

A modding tool for live-tuning the props that city civilians carry, such as amphorae and stones.

REX · battle, battle editor

lens_flare [on | off]

Toggles the original game’s lens flare.

REX/M2EX · battle, battle editor

set_time <hour | HH:MM>

Jumps to a time of day, such as 18.5 or 18:30.

REX/M2EX · battle, battle editor

set_weather <weather | random> [seconds]

Switches to a weather type and holds it. With [seconds] it changes gradually over that many battle seconds. random returns to the normal weather cycle.

REX · battle

show_lbw_debug

Toggles a debug view of the city population: the routes, destinations and attraction areas.

REX/M2EX · battle, battle editor

showtime [on | off]

Toggles the battle time display.

REX · battle, battle editor

solar_lighting [0 | 1]

1 makes the lighting follow the real position of the sun. 0 uses the old fixed-clock lighting.

REX · battle

spawn_projectile <projectile | unit type> [delay]

Fires a projectile from the camera at the point under the cursor. If the cursor is out of reach, it fires straight along the camera view. The projectile kills any soldier it hits, friend or foe, including everyone caught in an area blast. Invulnerable generals survive. Buildings and gates take the projectile’s normal damage.

  • <projectile>
  • <unit type> is a unit type from export_descr_unit.txt. It fires that unit’s missile weapon with the unit’s attack stats and sounds.
  • [delay] is optional, in seconds (0 to 3600). The projectile hangs where it was spawned and launches after the delay. This gives you time to move the camera to the target and watch it land. The delay counts battle time, so it pauses with the game and follows the game speed.

If the name is neither a projectile nor a unit type, the console lists the valid projectile names.

Examples:

spawn_projectile arrow
spawn_projectile big_fiery_boulder 5
spawn_projectile "roman archer"

REX/M2EX · battle

toggle_collisions [mount | ship | projectile]

Shows or hides collision volumes as see-through 3D shapes, so you can check the collision values in your data files.

  • With no parameter, it shows every type at once. If every type is already shown, it hides them all instead. You can still turn single types on or off afterwards.
  • mount shows each mount’s collision shape from descr_mount.txt, coloured per alliance. The footprint comes from radius, x_radius (REX) or y_offset (M2EX), and it reaches up to the mount’s height. radius and x_radius are measured from the mount’s centre to the edge, so the shape is twice as long and wide as those values.
    • Elephants also show their tusk reach as an orange ring on the ground: its radius is tusk_radius and it sits tusk_z ahead of the elephant. dead_radius is not shown.
    • Chariots show in a lighter version of the alliance colour: the wheels (wheel_radius), the axle (axle_width), and the tow pole (pole_length). Scythed chariots also show their scythe reach as an orange ring on the ground, like the tusks, of scythe_radius around each end of the axle.
    • Scorpion carts also show the scorpion in teal: its stand, its barrel (scorpion_forward_length) and the point its bolts leave from. The scorpion itself has no collision.
    • Tusk and scythe reach show as rings on the ground because the game only measures them across the ground, not by height. Anyone whose centre is inside a ring can be hit.
  • projectile shows each projectile in flight as a white sphere the size of its radius from descr_projectile_new.txt (REX) or descr_projectile.txt (M2EX). Projectiles with radius 0, such as pila and javelins, hit as a single point and get a small marker instead. When a projectile with an area lands, the area it damages shows as a white disc. A fainter, wider ring shows how far its knockback reaches: 1.35 times the area, and only unmounted infantry get knocked back. Both fade out over two seconds.
  • ship toggles ship volumes, which aren’t drawn yet.

Examples:

toggle_collisions
toggle_collisions mount

REX/M2EX · battle

vulnerable_general <character>

Makes the named general vulnerable in battle again.

REX/M2EX · campaign, battle

hide_ui

Hides the UI, like the hide_ui script command.

REX · campaign, battle

show_ui [true | false]

Shows the UI again. show_ui false hides it. The original M2TW already has this command.

REX · everywhere, also in multiplayer

snd_reload

Reloads the sound events. The original M2TW already has this command.

REX/M2EX · campaign, battle (M2EX also in the battle editor)

toggle_cursor

Shows or hides the mouse cursor. Input keeps working while it’s hidden.

REX/M2EX · campaign, battle

vram

Shows how much video memory each part of the game uses, plus the total for the process.

These commands work everywhere, including the editors.

REX/M2EX

dump_docudemon

Writes documentation for the script commands, conditions, events and console commands to the documentation/ folder.

REX/M2EX

imgui_demo

Toggles the Dear ImGui demo window.

REX/M2EX

lua <line>
sq <line>

Runs one line of Lua (lua) or Squirrel (sq) code. It runs in the active script runtime, or in a scratch VM when no runtime is running. The reply says which one was used.

REX/M2EX

script_reload

Reloads the scripts from disk. If any entry script fails to load, the running scripts are kept.

REX/M2EX

script_run <file.lua | file.nut>

Runs a script file from disk in the live VM. The extension picks Lua or Squirrel. You can run the same file again.

REX/M2EX

script_selftest [events | persist | refs]

Runs the scripting self-tests, or all of them when no suite is named. The results go to system.log.txt.

REX/M2EX

script_status

Shows which script VMs are running, what they loaded and what is registered on them.

REX

snd_debug

Toggles a live sound diagnostics window.