Skip to content

Set Rule

What a map's author normally sets in the settings, a world processor changes during play

tick 0
Set Rule0
rulevaluep1p2p3p4
Unit Bind1
type
Unit Control2
typexy
Sensor3
=
in
@counter0number
cargonullnull
setrule unitMineSpeed 4 @sharded 0 0 0

One line, and the team’s units mine four times as fast. The mono on this map fills its twenty copper in a bit over two seconds instead of nine.

Field What is in it
first which rule
second the value
third the team — for the ten multiplier rules
the rest the corners of an area — only for the mapArea rule

A rule changes at once and in full: not for one unit and not for one building, but for all of them together. It can be put back with the same setrule and the old value — the setting does not revert by itself.

There are three dozen rules, and they fall into four kinds by what they take in the second field:

Kind Examples
a number unitCap, waveSpacing, musicVolume
on/off waves, attackMode, canGameOver, lighting
a team multiplier unitHealth, unitMineSpeed, blockHealth, buildSpeed
special ban and unban take content, mapArea takes four numbers

The full list is in the reference: «Game rules». It also shows which rule needs a team, which counts in seconds and which in tiles, and the bounds the game clamps a value to.

tick 0
Set Rule0
rulevaluep1p2p3p4
Unit Bind1
type
Sensor2
=
in
Sensor3
=
in
@counter0number
healthnullnull
limitnullnull

Here a flare stands under an enemy turret’s fire with the rule unitHealth 4 switched on. Watch limit: it is still 70. But the health drops four times slower, and the flare survives a bombardment that used to kill it.

Two rules stand apart because they do not take a number:

setrule ban @duo 0 0 0 0
setrule mapArea 0 2 2 10 5

ban and unban take content: a block or a unit. A banned block disappears from the build menu, and a banned unit stops being produced.

mapArea is the only rule that needs all four of the last fields: the coordinates of the bottom left corner, and after them the width and height of the playable area. That is how the campaign opens a map piece by piece.

Unofficial fan project, not affiliated with Anuke. Mindustry sprites, fonts and translations © Anuke, used under GPL-3.0; Fira Code under OFL-1.1. Site code is GPL-3.0.