orders.dat Format

orders.dat holds the data of the orders: the things a unit can be doing, such as moving, attacking, harvesting, casting a spell or building (see Appendix: Orders list). Orders are started by number: by the order fields of units.dat, by the command buttons and by the game's own code. This file gives each order's properties: how it is queued and interrupted, what it targets, the weapon and technology of a spell, the button it highlights and its requirements.

The file is arr\orders.dat in the game's MPQ archives. It has 189 entries, one for each order, and is 4158 bytes long. It is stored field by field, not entry by entry: first the Label of all 189 orders, then the Attack Order of all 189, and so on, with nothing in between. The offsets below count from the start of the file. Five fields (Label and four flags) are not read by any code in any version from 1.04 to 1.17; they are marked Unused below.

The layout is the same in every version from 1.04 to 1.17, in both StarCraft and Brood War. StarCraft 1.00 to 1.03 used an older layout with 176 orders (3872 bytes). That older file is still in StarDat.mpq in later versions, but it is never loaded, because the game finds the copy in BrooDat.mpq (or patch_rt.mpq) first.

The game loads the file each time a game starts, together with units.dat. StarEdit does not use it. If the file is longer than the layout, the game stops with a file error. A shorter file loads without an error if it ends exactly where a field ends; the missing fields then keep whatever they held before. Out-of-range values are not rejected: the game then reads whatever follows the table that the value points into.

Label

Offset
0x0000
Length
378 bytes (2 bytes / Order)
Description
Not used by the game. It holds the order's name as a string number in rez\stat_txt.tbl, counting from 1 (order 0 is string 903, "Die"); seven spell orders point at button strings instead.
Values
Integer value between 0 and the number of strings in rez\stat_txt.tbl; ignored.

Attack Order

Offset
0x017A
Length
189 bytes (1 byte / Order)
Description
Marks an order that attacks its target. For spells and target clicks, the target is checked with the order's Weapon if this is set, and with the technology's target rules otherwise. An attacking unit also drops a target that becomes allied, keeps its current target when choosing targets, and is not counted as idle by the computer AI.
Bits
0x00
No
0x01 and up
Yes

Unused

Offset
0x0237
Length
189 bytes (1 byte / Order)
Description
Not used: no code reads it. Shipped 1 for orders that run while the unit does something else (Train, Build Add-on, Cloak and others).
Values
Any value; ignored.

Unused

Offset
0x02F4
Length
189 bytes (1 byte / Order)
Description
Not used: no code reads it. Shipped 0 only for the turret orders.
Values
Any value; ignored.

Pass to Turret

Offset
0x03B1
Length
189 bytes (1 byte / Order)
Description
When a unit with a turret (subunit) starts this order from its queue, the turret gets the same order and target. The unit's own guard and attack orders (units.dat) are always passed on as the turret's guard and attack orders, whatever this says.
Bits
0x00
The turret keeps its order
0x01 and up
The turret gets the same order

Unused

Offset
0x046E
Length
189 bytes (1 byte / Order)
Description
Not used: no code reads it.
Values
Any value; ignored.

Interruptible

Offset
0x052B
Length
189 bytes (1 byte / Order)
Description
0 makes the order run until it ends by itself: orders given in the meantime wait in the queue, except Die. When a new order is given, interruptible orders at the end of the queue are removed; a non-interruptible one stays and the new order goes after it. Shipped 0 for, among others, Die, Lift Off, Siege Mode, Burrow and the harvesting steps.
Bits
0x00
Not interruptible
0x01 and up
Interruptible

Brake Before

Offset
0x05E8
Length
189 bytes (1 byte / Order)
Description
Read for the next order in a unit's queue each time the unit gets a move target: if that order has 0, the unit does not brake at the end of its move but goes through the point at speed. Shipped 0 for Move, so a chain of queued moves is not slowed at each point. With nothing queued the unit always brakes.
Bits
0x00
The unit keeps its speed into this order
0x01 and up
The unit brakes before this order

Queueable

Offset
0x06A5
Length
189 bytes (1 byte / Order)
Description
Whether the order can be queued with Shift. A queued order is added after the current one, unless the unit is guarding, doing nothing, picking up, patrolling or acting as a Medic, in which case it replaces it. A unit can have at most 8 queued orders that have an Icon.
Bits
0x00
Always replaces the current order
0x01 and up
Can be queued

Keep Target When Disabled

Offset
0x0762
Length
189 bytes (1 byte / Order)
Description
When the unit is hit by Lockdown, Stasis Field or Maelstrom, it forgets the target unit of its order unless this is set. Shipped 1 for building, repairing, entering a Nydus Canal, harvesting and healing.
Bits
0x00
Forget the target
0x01 and up
Keep the target

Obstructable

Offset
0x081F
Length
189 bytes (1 byte / Order)
Description
For a target on the ground, the clicked point is moved to a nearby place where the unit, or the group, fits. 0 keeps the exact point: spells and attacks on the ground use 0.
Bits
0x00
Exact point
0x01 and up
Moved to where the units fit

Flee When Attacked

Offset
0x08DC
Length
189 bytes (1 byte / Order)
Description
A unit doing this order that is attacked by something it cannot fight back (or a worker under attack) moves away from the attacker. Shipped 1 for guarding, patrolling, Carrier and critter orders and a few others.
Bits
0x00
Stays
0x01 and up
Flees

Unused

Offset
0x0999
Length
189 bytes (1 byte / Order)
Description
Not used: no code reads it. Shipped 1 for most orders that move the unit.
Values
Any value; ignored.

Weapon

Offset
0x0A56
Length
189 bytes (1 byte / Order)
Description
The weapon (weapons.dat) of a spell or ability: the weapon fired by the animation script command castspell, and the range and cooldown when the spell is cast. 130 means none. With Attack Order set, any value other than 130 is used as a weapon without a check.
Values
A weapon, or 130 for none.

Technology

Offset
0x0B13
Length
189 bytes (1 byte / Order)
Description
The technology (techdata.dat) of a spell or ability. 44 means none. It sets the energy the order costs, the target rules of spells without Attack Order, and replaces this order's own requirements with the technology's use requirements. A value from 45 to 255 makes the order impossible to give by clicking a target.
Values
A technology, or 44 for none.

Animation

Offset
0x0BD0
Length
189 bytes (1 byte / Order)
Description
The animation (entry of the unit's animation script) played when the spell is cast. Shipped 7 (CastSpell) for the 19 spell orders and 28 for the rest, which never use it.
Values
Integer value between 0 and 27.

Icon

Offset
0x0C8D
Length
378 bytes (2 bytes / Order)
Description
The command button lit up while a unit does this order: the visible button with this icon (frame of cmdicons.grp) is drawn highlighted. 0xFFFF means none, and the turret's order is used instead (also when the value is 229, Stop, and the turret's order has an icon). Only orders with an icon count towards the limit of 8 queued orders.
Values
Integer value between 0 and the last frame of cmdicons.grp, or 0xFFFF for none.

Requirements

Offset
0x0E07
Length
378 bytes (2 bytes / Order)
Description
Where this order's requirements (what must be true for a unit to be given it) start in the game's built-in requirement list (the order requirements, inside the executable, not in any data file), as a position in that list. 0 means the order has no requirements entry and is never allowed. The game fills this field in itself: whenever it checks a order whose entry holds 0xFFFF, it walks the built-in list, stores the position for every order listed there (replacing what the file had), and sets every entry still 0xFFFF to 0. So a value other than 0xFFFF only survives for orders that have no entry in the built-in list, or if the file has no 0xFFFF at all, and it then picks (part of) an existing entry of the list; nothing checks it. The shipped file has 0xFFFF everywhere, so the game always uses its built-in list. Orders with a Technology use that technology's requirements instead.
Values
0xFFFF (let the game fill it in).

Obscured Order

Offset
0x0F81
Length
189 bytes (1 byte / Order)
Description
For the orders a unit gets when it is told to act on a unit hidden by the fog of war (Attack, Repair, Gather and so on, chosen by the button): once the unit gets there and sees the target, it is given this order on it (for Attack, its own attack order from units.dat). 189 means the order cannot target a unit under the fog, so the click counts as a click on the ground. In the shipped file every order holds its own number, except the fog orders, which hold the order they turn into.
Values
An order, or 189 for none.

Appendix: Orders list

Description
Every order, with the name the game's Label field points to (rez\stat_txt.tbl). Some names are misleading: order 6, "Ignore", is the Move order.
Bits
0x00
Die
0x01
Stop
0x02
Guard
0x03
Player Guard
0x04
Turret Guard
0x05
Bunker Guard
0x06
Ignore
0x07
Reaver Stop
0x08
Attack
0x09
Attack
0x0A
Attack Unit
0x0B
Attack Fixed Range
0x0C
Attack Tile
0x0D
Hover
0x0E
Attack Move
0x0F
Infest Mine
0x10
Nothing
0x11
Powerup
0x12
Tower
0x13
Tower
0x14
Vulture Mine
0x15
Stay In Range
0x16
Turret Attack
0x17
Nothing
0x18
Nothing
0x19
Drone Start Build
0x1A
Drone Build
0x1B
Infest Mine
0x1C
Infest Mine
0x1D
Infest Mine
0x1E
Build
0x1F
Build
0x20
Build
0x21
Build
0x22
Repair
0x23
Repair
0x24
Place Add-On
0x25
Build Add-On
0x26
Train
0x27
Rally Point
0x28
Rally Point
0x29
Zerg Birth
0x2A
Morph
0x2B
Morph
0x2C
Build Self
0x2D
Zerg Build Self
0x2E
Build
0x2F
Enter Nydus Canal
0x30
Build Self
0x31
Follow
0x32
Carrier
0x33
Carrier Ignore
0x34
Carrier Stop
0x35
Carrier Attack
0x36
Carrier Attack
0x37
Carrier Ignore
0x38
Carrier Fight
0x39
Hold Position
0x3A
Reaver
0x3B
Reaver Attack
0x3C
Reaver Attack
0x3D
Reaver Fight
0x3E
Reaver Hold
0x3F
Train Fighter
0x40
Strafe Unit
0x41
Strafe Unit
0x42
Recharge Shields
0x43
Recharge Shields
0x44
Shield Battery
0x45
Return
0x46
Drone Land
0x47
Building Land
0x48
Building Lift Off
0x49
Drone Lift Off
0x4A
Lift Off
0x4B
Reasearch Tech
0x4C
Upgrade
0x4D
Larva
0x4E
Spawning Larva
0x4F
Harvest
0x50
Harvest
0x51
Harvest Gas
0x52
Harvest Gas
0x53
Harvest Gas
0x54
Return Gas
0x55
Harvest Minerals
0x56
Harvest Minerals
0x57
Harvest Minerals
0x58
Harvest
0x59
Harvest
0x5A
Return Minerals
0x5B
Harvest
0x5C
Enter Transport
0x5D
Pick Up
0x5E
Pick Up
0x5F
Pick Up
0x60
Pick Up
0x61
Powerup
0x62
Siege Mode
0x63
Tank Mode
0x64
Watch Target
0x65
Initing Creep Growth
0x66
Spread Creep
0x67
Stopping Creep Growth
0x68
Guardian Aspect
0x69
Warping Archon
0x6A
Completing Archon Summon
0x6B
Hold Position
0x6C
Hold Position
0x6D
Cloak
0x6E
Decloak
0x6F
Unload
0x70
Move Unload
0x71
Fire Yamato Gun
0x72
Fire Yamato Gun
0x73
Magna Pulse
0x74
Burrow
0x75
Burrowed
0x76
Unburrow
0x77
Dark Swarm
0x78
Cast Parasite
0x79
Summon Broodlings
0x7A
EMP Shockwave
0x7B
Nuke Wait
0x7C
Nuke Train
0x7D
Nuke Launch
0x7E
Nuke Paint
0x7F
Nuke Unit
0x80
Nuke Ground
0x81
Nuke Track
0x82
Initializing Arbiter
0x83
Cloaking nearby units
0x84
Place Mine
0x85
Right Click Action
0x86
Sap Unit
0x87
Sap Location
0x88
Hold Position
0x89
Teleport
0x8A
Teleport to Location
0x8B
Place Scanner
0x8C
Scanner
0x8D
Defensive Matrix
0x8E
Psionic Storm
0x8F
Irradiate
0x90
Plague
0x91
Consume
0x92
Ensnare
0x93
Stasis Field
0x94
Hallucination
0x95
Hallucination
0x96
Reset Collision
0x97
Reset Collision
0x98
Patrol
0x99
CTF COP Init
0x9A
CTF COP
0x9B
CTF COP
0x9C
Computer AI
0x9D
Atk Move EP
0x9E
Harass Move
0x9F
AI Patrol
0xA0
Guard Post
0xA1
Rescue Passive
0xA2
Neutral
0xA3
Computer Return
0xA4
Initing Psi Provider
0xA5
Self Destructing
0xA6
Critter
0xA7
Hidden Gun
0xA8
Open Door
0xA9
Close Door
0xAA
Hide Trap
0xAB
Reveal Trap
0xAC
Enable Doodad
0xAD
Disable Doodad
0xAE
Warp In
0xAF
Medic
0xB0
Medic Heal
0xB1
Heal Move
0xB2
Medic Hold Position
0xB3
Medic Heal
0xB4
Restoration
0xB5
Cast Disruption Web
0xB6
Cast Mind Control
0xB7
Warping Dark Archon
0xB8
Cast Feedback
0xB9
Cast Optical Flare
0xBA
Cast Shockwave
0xBB
Junk Yard Dog
0xBC
Fatal