Oblivion Mod:Save File Format/NPC
This page describes the save file format for both NPC_ and CREA change records, since the two records share an identical format. An NPC_ Change Record (change record type 35) describes changes to the game's non-player characters (NPC_ mod file records) -- and also to the player's character (in the NPC_ change record for formid 0x00000007). A CREA Change Record (change record type 36) describes changes to the game's creatures (CREA mod file records).
Values specified an NPC_ or CREA record affect all instances of that actor. Values specific to a single instance of the actor are provided in the appropriate ACHR or ACRE record. The majority of the player character information is detailed in the ACHR change record for formid 0x00000014, instead of in the NPC_ change record.
The following table summarizes the subrecords that have been found in NPC_ and CREA records:
Bit in Overall Flags |
Hex Value of Bit |
Subrecord Name |
Size |
Relative Location |
---|---|---|---|---|
0 | 0x00000001 | Form Flags | 4 | 1 |
2 | 0x00000004 | Base Health | 4 | 7 |
3 | 0x00000008 | Base Attributes | 8 | 2 |
4 | 0x00000010 | Base Data | 16 | 3 |
5 | 0x00000020 | Spell List | variable | 5 |
6 | 0x00000040 | Factions | variable | 4 |
7 | 0x00000080 | Full Name | variable | 9 |
8 | 0x00000100 | AI Data | 4 | 6 |
9 | 0x00000200 | Skills | 21 | 10 |
10 | 0x00000400 | Combat Style | 4 | 11 |
28 | 0x10000000 | Base Modifiers | variable | 8 |
The relative positions of the subrecords have all been confirmed; their contents (as far as they are understood) are based on actual save files.
Form Flags
The Form Flags subrecord is present when bit 0 (0x00000001) is set in any change record's overall Flags. Its length is a constant 4 bytes.
The Form Flags subrecord has been seen in nearly every type of change record, always associated with bit 0, always using the same name in the text dump files, and always using the same format. The only record types without any Form Flags (so far) have been: CELL, FACT, INFO, PACK, and QUST. Furthermore, in analyzed save files, bit 0 has never been set for any of those five record types, so it is possible that even for those records, bit 0 is reserved for the Form Flags subrecord.
Name | Type/Size | Info |
---|---|---|
flags | ulong | The record's current form flags. Related to form flags in mod files, but the meaning of some bits is unknown.
|
Base Attributes[edit]
The Base Attributes subrecord is present when bit 3 (0x00000008) is set in a CREA/NPC_ change record's overall Flags. Its length is a constant 8 bytes. Each byte provides the base value (without fortifications or damage) of one basic attribute. The attributes are listed in order of their standard index. Unlike Morrowind save files, for the player character these are the attributes at the current level.
Name | Type/Size | Info |
---|---|---|
Strength | ubyte | |
Intelligence | ubyte | |
Willpower | ubyte | |
Agility | ubyte | |
Speed | ubyte | Note that speed has a slightly different meaning for creatures than for NPCs. In particular, some creatures have Speed=255. |
Endurance | ubyte | |
Personality | ubyte | |
Luck | ubyte |
Base Data[edit]
The Base Data subrecord is present when bit 4 (0x00000010) is set in a CREA/NPC_ change record's overall Flags. Its length is a constant 16 bytes, and its format follows that of the mod file NPC_ ACBS subrecord.
Name | Type/Size | Info | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
flags | ulong |
|
||||||||||||||||||||||||
baseMagicka | ushort | Base magicka
For the player character, this is the magicka at 0 intelligence (i.e., the sum of the player's racial or birthsign Fortify Magicka bonuses). The player's actual base magicka is dynamically calculated from (baseMagicka + 2*Intelligence). Presumably this is to ensure that Fortify Intelligence and Damage Intelligence effects always alter the player's magicka. On the other hand, an NPC's magicka is unaffected by Intelligence changes. |
||||||||||||||||||||||||
baseFatigue | ushort | Base fatigue
For the player character, this value is zero because fatigue is dynamically calculated from (Endurance + Strength + Agility + Willpower). As with magicka, this is presumably to ensure that Fortify/Damage Attribute effects alter fatigue, whereas an NPC's fatigue is impervious to such effects. |
||||||||||||||||||||||||
barterGold | ushort | |||||||||||||||||||||||||
level | short | Level (non-autocalc NPCs) or offset relative to player's level (autocalc NPCs) | ||||||||||||||||||||||||
calcMin | ushort | Minimum auto-calculated level. | ||||||||||||||||||||||||
calcMax | ushort | Maximum auto-calculated level. |
Factions[edit]
The Factions subrecord is present when bit 6 (0x00000040) is set in a CREA/NPC_ change record's overall Flags. Its length is variable, but the parameters controlling its length are well-understood. The subrecord lists the NPC or creature's faction memberships, and rank within those factions.
Name | Type/Size | Info |
---|---|---|
factionsNum | ushort | Number of factions. |
faction | struct[factionsNum] | Character's factions. |
|
iref | Faction's iref |
|
byte | The numerical value of the actor's rank within the faction. -1 is used when the actor has been suspended from the faction (either temporarily or permanently); 0 is the lowest-level (default) rank in the faction. |
Spell List[edit]
The Spell List subrecord is present when bit 5 (0x00000020) is set in a CREA/NPC_ change record's overall Flags. Its length is variable, but the parameters controlling its length are well-understood. The subrecord lists the spells known by the NPC or creature.
Name | Type/Size | Info |
---|---|---|
spellCount | ushort | |
spellIds | iref[spellCount] | Array of spell irefs (SPEL records). |
AI Data[edit]
The AI Data subrecord is present when bit 8 (0x00000100) is set in a CREA/NPC_ change record's overall Flags. Its length is a constant 4 bytes. The meaning of the data contained in the AI Data subrecord is unknown, however, the observed values are consistent with 4 separate ubyte variables, each of which is set to a multiple of 5 (e.g., 5,100,80,80).
Name | Type/Size | Info |
---|---|---|
unknown | ubyte[4] | Constant length of observed subrecords. |
Base Health[edit]
The Base Health subrecord is present when bit 2 (0x00000004) is set in a CREA/NPC_ change record's overall Flags. Its length is a constant 4 bytes, and it provides the NPC or creature's base health.
Name | Type/Size | Info |
---|---|---|
baseHealth | ulong | For NPCs, both auto-calc and not, this is the character's base health (health when undamaged, without and fortification bonuses).
For the player character, this is the health at 0 endurance, i.e. the sum of the (Endurance/10) bonuses gained each time the player levels. The player's actual base health is dynamically calculated from (baseHealth + endurance*2). As with magicka and fatigue, this is presumably done to ensure that Damage Endurance and Fortify Endurance always alter the player's health. An NPC's health is immune to such effects. |
Base Modifiers[edit]
The Base Modifiers subrecord is present when bit 28 (0x10000000) is set in a CREA/NPC_ change record's overall Flags. Its length is variable, but the parameters controlling its length are well-understood. This subrecord is used to record changes to miscellaneous actor attributes.
Interpretation of the subrecord is based on a limited number of samples, but seems reasonable. For example, index 45 (Blindness) is set to 100 for the Blind Moth Priests and Dredhwen; index 69 (Vampirism) is set to 100 for known vampires (except Jakben and Janus Hassildor, for whom the value is 25 and 50, respectively). For the player, this section contains any racial modifiers (e.g., resist disease 75%). Indices in the ranges 0-8 and 12-32 have not been seen, presumably because the Base Attributes and Skills subrecords are used for such data.
Name | Type/Size | Info |
---|---|---|
modCount | ushort | |
modifiers | struct[modCount] | |
|
ubyte | See Actor Value Indices to decode the indices. The same index can appear multiple times in a single NPC_ subrecord (with the same value listed each time); presumably these values are redundant rather than cumulative. |
|
float | Previous documentation incorrectly listed the value's type as ulong. |
Full Name[edit]
The Full Name subrecord is present when bit 7 (0x00000080) is set in a CREA/NPC_ change record's overall Flags. It contains a variable-length string, providing the new name of the NPC or creature.
Note that CELL change records can also contain a "Full Name" subrecord with the same contents, but in CELL records, its presence is triggered by bit 4, not bit 7.
Name | Type/Size | Info |
---|---|---|
fullName | bstring | New full name for character. |
Skills[edit]
The Skills subrecord is present when bit 9 (0x00000200) is set in a CREA/NPC_ record's overall Flags. Its length is a constant 21 bytes. Each byte provides the base value of one skill. The skills are listed in order of their standard index.
Name | Type/Size | Info |
---|---|---|
Armorer | ubyte | |
Athletics | ubyte | |
Blade | ubyte | |
Block | ubyte | |
Blunt | ubyte | |
Hand To Hand | ubyte | |
Heavy Armor | ubyte | |
Alchemy | ubyte | |
Alteration | ubyte | |
Conjuration | ubyte | |
Destruction | ubyte | |
Illusion | ubyte | |
Mysticism | ubyte | |
Restoration | ubyte | |
Acrobatics | ubyte | |
Light Armor | ubyte | |
Marksman | ubyte | |
Mercantile | ubyte | |
Security | ubyte | |
Sneak | ubyte | |
Speechcraft | ubyte |
Combat Style[edit]
The Skills subrecord is present when bit 10 (0x00000400) is set in a CREA/NPC_ record's overall Flags. Its length is a constant 4 bytes, and it provides information on the actor's current combat style.
Name | Type/Size | Info |
---|---|---|
combatStyle | iref | iref pointing to a CSTY (Combat Style) record |