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.
Campaign commands
Section titled “Campaign commands”add_soldiers
Section titled “add_soldiers”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.
adjust_treasury
Section titled “adjust_treasury”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.
ally_desire
Section titled “ally_desire”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.
change_character_faction
Section titled “change_character_faction”REX/M2EX · campaign
change_character_faction <character> <faction>Moves a character to another faction.
create_assassin
Section titled “create_assassin”REX/M2EX · campaign
create_assassin <settlement>Spawns an assassin at the settlement, owned by the settlement’s faction.
create_diplomat
Section titled “create_diplomat”REX/M2EX · campaign
create_diplomat <settlement>Spawns a diplomat at the settlement, owned by the settlement’s faction.
create_fort
Section titled “create_fort”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 iswooden_fort.permanentmakes a permanent fort.name <name>names the fort. A bare name is a localisation key fromexpanded.txt; a “quoted” name is used as literal text.
create_merchant
Section titled “create_merchant”M2EX · campaign
create_merchant <settlement>Spawns a merchant at the settlement, owned by the settlement’s faction.
create_resource
Section titled “create_resource”REX/M2EX · campaign
create_resource <x> <y> <resource>Adds a trade resource to strat map tile (x, y).
create_spy
Section titled “create_spy”REX/M2EX · campaign
create_spy <settlement>Spawns a spy at the settlement, owned by the settlement’s faction.
cull_faction
Section titled “cull_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.
decimation_army
Section titled “decimation_army”REX/M2EX · campaign
decimation_army <character> <percent>Reduces every unit in the character’s army by the given percent (1 to 100).
destroy_building
Section titled “destroy_building”REX/M2EX · campaign
destroy_building <settlement> <building level>Destroys a building in the settlement. Building level names come from export_descr_buildings.txt.
destroy_fort
Section titled “destroy_fort”REX/M2EX · campaign
destroy_fort <x> <y>Removes the fort at strat map tile (x, y). It fails if the fort has a garrison.
destroy_selected_fort
Section titled “destroy_selected_fort”REX/M2EX · campaign
destroy_selected_fortRemoves the fort selected in the UI. It fails if no fort is selected or the fort has a garrison.
display_message
Section titled “display_message”REX/M2EX · campaign
display_message <message id>Shows a custom event message from custom_messages.txt.
downgrade_building
Section titled “downgrade_building”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.
dump_region_names
Section titled “dump_region_names”REX/M2EX · campaign
dump_region_namesWrites 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.
give_settlement
Section titled “give_settlement”REX/M2EX · campaign
give_settlement <faction> <settlement>Gives the settlement to the faction. This doesn’t count as a diplomatic transgression.
go_to_capital
Section titled “go_to_capital”REX/M2EX · campaign
go_to_capital <faction>Moves the camera to the faction’s capital.
go_to_char
Section titled “go_to_char”REX/M2EX · campaign
go_to_char <character>Moves the camera to the character.
go_to_pos
Section titled “go_to_pos”REX/M2EX · campaign
go_to_pos <x> <y>Moves the camera to strat map tile (x, y).
go_to_sett
Section titled “go_to_sett”REX/M2EX · campaign
go_to_sett <settlement>Moves the camera to the settlement.
kill_army
Section titled “kill_army”REX/M2EX · campaign
kill_army <character>Kills the army led by the character. If the character has no army, only the character dies.
remove_ancillary
Section titled “remove_ancillary”REX · campaign
remove_ancillary <character> <ancillary>Removes an ancillary from the character. The original M2TW already has this command.
remove_resource
Section titled “remove_resource”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.
replen_all_forts
Section titled “replen_all_forts”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.
owneronly replenishes forts in regions the faction owns.not_siegeskips forts that are under siege.
replen_soldiers
Section titled “replen_soldiers”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.
set_heir
Section titled “set_heir”REX/M2EX · campaign
set_heir <character>Makes the character the faction heir.
set_leader
Section titled “set_leader”REX/M2EX · campaign
set_leader <character>Makes the character the faction leader.
set_population
Section titled “set_population”REX/M2EX · campaign
set_population <settlement> <amount>Sets the population of the settlement.
show_counter
Section titled “show_counter”REX/M2EX · campaign
show_counter <name>Shows the current value of a script counter.
show_counters
Section titled “show_counters”REX/M2EX · campaign
show_countersLists all active script counters and their values.
Battle commands
Section titled “Battle commands”battle_time_multiplier
Section titled “battle_time_multiplier”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.
cloud_drift
Section titled “cloud_drift”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.
cloud_sunset_rim
Section titled “cloud_sunset_rim”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.
freecam
Section titled “freecam”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.
lbc_carry_tune
Section titled “lbc_carry_tune”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.
lens_flare
Section titled “lens_flare”REX · battle, battle editor
lens_flare [on | off]Toggles the original game’s lens flare.
set_time
Section titled “set_time”REX/M2EX · battle, battle editor
set_time <hour | HH:MM>Jumps to a time of day, such as 18.5 or 18:30.
set_weather
Section titled “set_weather”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.
show_lbw_debug
Section titled “show_lbw_debug”REX · battle
show_lbw_debugToggles a debug view of the city population: the routes, destinations and attraction areas.
showtime
Section titled “showtime”REX/M2EX · battle, battle editor
showtime [on | off]Toggles the battle time display.
solar_lighting
Section titled “solar_lighting”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.
spawn_projectile
Section titled “spawn_projectile”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 fromexport_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 arrowspawn_projectile big_fiery_boulder 5spawn_projectile "roman archer"toggle_collisions
Section titled “toggle_collisions”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.
mountshows each mount’s collision shape fromdescr_mount.txt, coloured per alliance. The footprint comes fromradius,x_radius(REX) ory_offset(M2EX), and it reaches up to the mount’sheight.radiusandx_radiusare 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_radiusand it sitstusk_zahead of the elephant.dead_radiusis 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, ofscythe_radiusaround 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.
- Elephants also show their tusk reach as an orange ring on the ground: its radius is
projectileshows each projectile in flight as a white sphere the size of itsradiusfromdescr_projectile_new.txt(REX) ordescr_projectile.txt(M2EX). Projectiles withradius 0, such as pila and javelins, hit as a single point and get a small marker instead. When a projectile with anarealands, the area it damages shows as a white disc. A fainter, wider ring shows how far its knockback reaches: 1.35 times thearea, and only unmounted infantry get knocked back. Both fade out over two seconds.shiptoggles ship volumes, which aren’t drawn yet.
Examples:
toggle_collisionstoggle_collisions mountvulnerable_general
Section titled “vulnerable_general”REX/M2EX · battle
vulnerable_general <character>Makes the named general vulnerable in battle again.
Campaign and battle commands
Section titled “Campaign and battle commands”hide_ui
Section titled “hide_ui”REX/M2EX · campaign, battle
hide_uiHides the UI, like the hide_ui script command.
show_ui
Section titled “show_ui”REX · campaign, battle
show_ui [true | false]Shows the UI again. show_ui false hides it. The original M2TW already has this command.
snd_reload
Section titled “snd_reload”REX · everywhere, also in multiplayer
snd_reloadReloads the sound events. The original M2TW already has this command.
toggle_cursor
Section titled “toggle_cursor”REX/M2EX · campaign, battle (M2EX also in the battle editor)
toggle_cursorShows or hides the mouse cursor. Input keeps working while it’s hidden.
REX/M2EX · campaign, battle
vramShows how much video memory each part of the game uses, plus the total for the process.
Scripting and debugging
Section titled “Scripting and debugging”These commands work everywhere, including the editors.
dump_docudemon
Section titled “dump_docudemon”REX/M2EX
dump_docudemonWrites documentation for the script commands, conditions, events and console commands to the documentation/ folder.
lua, sq
Section titled “lua, sq”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.
script_reload
Section titled “script_reload”REX/M2EX
script_reloadReloads the scripts from disk. If any entry script fails to load, the running scripts are kept.
script_run
Section titled “script_run”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.
script_selftest
Section titled “script_selftest”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.
script_status
Section titled “script_status”REX/M2EX
script_statusShows which script VMs are running, what they loaded and what is registered on them.