scmJS docs

UNIx

UNIS for Brood War: the same tables, with 130 weapons.

Name UNIx (55 4E 49 78)
Size 4168 bytes.
Read by The game, at the start of a Use Map Settings game, in a file of any revision.
Required For Use Map Settings in a Brood War file (VER 205, or Remastered's 206). In a VER 59, 63 or 64 file it is optional, and read after the original table when present.
The game accepts Exactly 4168 bytes. Any other length refuses the map.
More than one copy Combined entry by entry: a copy changes only the entries it marks as not using the game's own values, and every other entry keeps what an earlier copy gave it.
In scmJS Read, and written again when you change what it holds.

Layout:

Offset Type Holds
0 u8 × 228 Per unit type: 0 to use this section's values; anything else for the game's own, ignoring the rest of this section
228 u32 × 228 Hit points × 256
1140 u16 × 228 Shields
1596 u8 × 228 Armour
1824 u16 × 228 Build time, in game frames
2280 u16 × 228 Mineral cost
2736 u16 × 228 Gas cost
3192 u16 × 228 Name, a string number; 0 for the default name
3648 u16 × 130 Per weapon: base damage
3908 u16 × 130 Per weapon: damage added by each upgrade level

Example#

Each column is one value per unit type, so a unit type's values are spread across the section: its entry in each column is at the column's offset plus the unit type times the column's width. A Carrier (unit type 72) given 400 hit points and a new cost:

  72  00           does not use the game's own values
 516  00 90 01 00  hit points 102400 = 400 × 256
1284  96 00        shields 150
1668  04           armour 4
1968  34 08        build time 2100 frames
2424  2C 01        300 minerals
2880  C8 00        200 gas
3336  00 00        the game's own name

The first byte decides whether the rest counts. While it is anything but 0, the game uses its own values for the unit type and ignores the other columns, the name included, so a unit type's new name shows only once the type is marked as not using the game's own values. UNIS is laid out the same way with 100 weapons instead of 130, so every column is at the same offset except the last, the damage each upgrade adds.

The weapon columns are not read for their own sake. The game sets a weapon's damage only while it sets up a unit type that fires it and does not use the game's own values, so a new damage for a weapon whose units all keep their defaults is ignored. A unit with a turret, such as the Goliath or the Siege Tank, takes its weapons from the turret. So to change a weapon, also mark one of the unit types that fire it.