Skyrim Mod:Mod File Format
Mod files (Plugin files) are collections of records, which are further divided into fields.
Records generally correspond to objects (e.g., a creature, a game setting, a dialog entry), with the fine details of the object (e.g., health of a creature, a dialog entry test) being handled by the fields of the record. Records themselves are organized into groups.
At the highest grouping level, a plugin file is generally:
- A single TES4 record (plugin information).
- A collection of top groups.
Mod Plugin Types[edit]
Mod files take the form of a plugin file in one of the three below formats:
- Elder Scrolls Master (ESM, .esm)
- Elder Scrolls Plugin (ESP, .esp)
- Elder Scrolls Light Master (ESL, .esl)
Elder Scrolls Master and Elder Scrolls Plugin files are similar to each other, except for the difference in that ESMs are pinned to the top of the load order, taking precedence over all non-flagged ESP and ESL plugin files. Elder Scrolls Light Master plugins are unique in that they do not conform to the load order specification of either ESM or ESP plugins, and as such, up to 4096 ESL plugins can exist in the load order, rather than the maximum of 254 plugins when only non-flagged ESM and ESP plugin files are used. The primary limitation of ESL plugins are that they only allow up to 4096 Form ID records whereas ESM and ESP plugins have a significantly higher record limit. Since v1.6.1130, ESL plugins can hold up to 4096 records. Before, the form ID range 0x0000
to range 0x07FF
was reserved, resulting in a 2048 record limit.
ESL plugins were introduced with the addition of Creation Club content known as Creations in update 1.5 of the Special Edition, and are therefore only available for use starting from this update and future updates and versions, including the Anniversary Edition. Due to this, they will not load or be detected in either the Legendary Edition or earlier versions of the Special Edition prior to update 1.5.
ESM and ESP plugins can be flagged as an ESL if the maximum number of records in the plugin conforms to the 4096 form ID limit and that their form ID records are compacted prior to the flagging of them as an ESL. They can additionally be given the ESM flag to pin them to the top of the load order, similar to the default behaviour of non-flagged ESM files.
The position in the load order depends on the file extension (.esm, .esl, or .esp), so what is functionally an ESL file can be given an ESP extension to allow placing them towards the bottom of the load order.
Note that ESP files (which are not flagged as ESL) have a special behavior in which all references they contain are treated as permanent, even if they are temporary references. This means that these references are always loaded and actively processed, regardless of which cells they are in, and they always count towards the maximum reference cap in the engine. For this reason, plain ESP files should be avoided and mods should preferably be released as ESL (or ESL-flagged ESP) if possible, or ESM otherwise.
Record Types[edit]
|
|
|
|
Groups[edit]
GRUPs are collections of records, and are used to improve scanning of files to make it easier to skip over records that the reading program is not interested in. In addition to this, subgroups for WRLD and CELLS provide some useful structural information (e.g., the division of cell data into persistent and non-persistent references).
File Format[edit]
Type/Size | Info | ||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
char[4] | Record type (always "GRUP") | ||||||||||||||||||||||||||||||||||||||||||||
uint32 | Size of the entire group, including the group header (24 bytes). | ||||||||||||||||||||||||||||||||||||||||||||
uint8[4] | Label. Format depends on group type (see next field).
|
||||||||||||||||||||||||||||||||||||||||||||
int32 | Group type:
|
||||||||||||||||||||||||||||||||||||||||||||
uint16 | Timestamp
|
||||||||||||||||||||||||||||||||||||||||||||
uint16 | Version Control Info
|
||||||||||||||||||||||||||||||||||||||||||||
uint32 | Unknown. The values stored here are significantly different than those used in records and appear to be a 32-bit value rather than two 16-bit values. Values break out by group type:
|
||||||||||||||||||||||||||||||||||||||||||||
uint8[groupSize-24] | Records and subgroups. |
Top Groups[edit]
In Skyrim.esm, the top, or highest level groups are stored in the following order:
- GMST, KYWD, LCRT, AACT, TXST, GLOB, CLAS, FACT, HDPT, HAIR, EYES, RACE, SOUN, ASPC, MGEF, SCPT, LTEX, ENCH, SPEL, SCRL, ACTI, TACT, ARMO, BOOK, CONT, DOOR, INGR, LIGH, MISC, APPA, STAT, SCOL, MSTT, PWAT, GRAS, TREE, CLDC, FLOR, FURN, WEAP, AMMO, NPC_, LVLN, KEYM, ALCH, IDLM, COBJ, PROJ, HAZD, SLGM, LVLI, WTHR, CLMT, SPGD, RFCT, REGN, NAVI, CELL, WRLD, DIAL, QUST, IDLE, PACK, CSTY, LSCR, LVSP, ANIO, WATR, EFSH, EXPL, DEBR, IMGS, IMAD, FLST, PERK, BPTD, ADDN, AVIF, CAMS, CPTH, VTYP, MATT, IPCT, IPDS, ARMA, ECZN, LCTN, MESG, RGDL, DOBJ, LGTM, MUSC, FSTP, FSTS, SMBN, SMQN, SMEN, DLBR, MUST, DLVW, WOOP, SHOU, EQUP, RELA, SCEN, ASTP, OTFT, ARTO, MATO, MOVT, HAZD, SNDR, DUAL, SNCT, SOPM, COLL, CLFM, REVB
Whether the game engine expects this order is unknown, but it's probably safer to use this order than not.
All top groups contain records matching their label (e.g., the GMST top group contains GMST records). For most top groups, only the matching record types are present. However, in the CELL, WRLD and DIAL top groups, each main record can be followed by one or more child groups which contain additional records of a different type. Unlike Oblivion, WRLD groups in Skyrim no longer contain ROAD records.
Notes:
- 6 record types have a GRUP but no records: CLDC, HAIR, RGDL, SCPT, SCOL, PWAT.
- There are 2 HAZD groups, the second one has no records.
Dawnguard The following had field order changes and updates. Also pre-existing or new records were added.
- LCTN, INFO, NPC_, RACE, NAVI, QUST, REFR, WRLD
New Fields:
- LCTN added: ACID, ACSR, ACUN, ACEC, ACEP, RCPR
- NAVI added: NVSI
- REFR added: XATR
Subgroups[edit]
The following groups are only found in subgroups of other records:
- REFR, ACHR, NAVM, PGRE, PHZD, LAND, INFO
Records[edit]
Type/Size | Info | ||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
char[4] | Type | ||||||||||||||||||||||||||||||||||||||||||||||||||
uint32 | Size of data field | ||||||||||||||||||||||||||||||||||||||||||||||||||
uint32 | Flags
|
||||||||||||||||||||||||||||||||||||||||||||||||||
uint32 | Record (form) identifier | ||||||||||||||||||||||||||||||||||||||||||||||||||
uint16 | Timestamp (see the same field in Groups) | ||||||||||||||||||||||||||||||||||||||||||||||||||
uint16 | Version Control Info (see the same field in Groups) | ||||||||||||||||||||||||||||||||||||||||||||||||||
uint16 | The internal version of the record. This can be used to distinguish certain records that have different field layouts or sizes. | ||||||||||||||||||||||||||||||||||||||||||||||||||
uint16 | Unknown. Values range between 0-15. | ||||||||||||||||||||||||||||||||||||||||||||||||||
uint8[dataSize] | Data
|
Fields[edit]
Type/Size | Info |
---|---|
char[4] | Field type. |
uint16 | Size of data field. † |
uint8[dataSize] | Data.
|
†If the preceding field has the type XXXX, then dataSize will be 0 and the size of the data is in fact the 32 bit quantity stored in the XXXX field. This feature is commonly used to store large navmesh fields in Skyrim.esm.
Commonly used fields and their definitions can be found here. Many records allow for object bounds (OBND) and scripting (VMAD) fields, but ignore them. It's unclear why. Only those records to which they actually apply will have these fields listed.
See Also[edit]
- Raw Data: a dump of all records/fields in Skyrim.esm and their associated counts/sizes.
- Raw Function Data: a dump of all script/console functions and events in TESV.exe.