SCRMaps
/
Sign in

Structure offsets: one unit's own data

Every Marine shares its damage; each Marine has its own hit points. Where that line falls.

6 min read

Change one Marine's damage with EUD and every Marine changes. But when one Marine drops to 20 hit points the others are untouched, and when one is Ensnared the rest are not. Same unit type, yet some data is shared and some is not.

Where each kind of data lives
units.dat / weapons.datOne per unit TYPE: damage, max hit points, cost, size, properties. Writing one changes every unit of that type.
구조 오프셋 (CUnit)One per unit INSTANCE: current hit points, owner, position, active spells, invincibility, and which unit it is.

That per instance storage is the structure offset, and eudplib calls it CUnit. There are 1,700 slots and each is 0x150 bytes, which is 336.

index 0     0x59CCA8
index 1699  0x59CDF8     <- 0x150 다음 칸인데 1번이 아니다
index 1698  0x59CF48
...
index 1      0x628298
The slot after index 0 holds the LAST index, and it counts down from there.

This layout defies intuition: index 0 is first, but the slot after it is 1699, not 1. Walking units by computing addresses yourself will almost certainly be wrong. Use eudplib's EUDLoopPlayerUnit or EUDLoopUnit. The reason to know the ordering is not to compute with it but to know not to.

In practice the place this distinction bites most often is appearance. The flingy a unit wears is type data, so if you dress a mob in some unit's flingy and then write a speed onto that flingy, every unit wearing it changes speed. If anything the player owns is in that list, you have shipped a bug.

One flingy, many units
Sign in to track your progress