CRE file format
Applies to:
IWD, IWD:HoW, IWD:TotL
General Description
This file format describes a "creature". Creatures can move, have an animation, hold items, run scripts, cast spells and initiate dialog. Creatures have several stats (some visible through the game UI) which are generally mapped to IDS or 2DA files.
Detailed Description
Overall Structure
Offset | Size (datatype) | Description |
---|---|---|
0x00000 | 4 (char array) | Signature ('CRE ') |
0x0004 | 4 (char array) | Version ('V9.0') |
0x0008 | 4 (strref) | Long name |
0x000c | 4 (strref) | Short name (tooltip) |
0x0010 | 4 (dword) | Creature flags
|
0x0014 | 4 (dword) | XP (gained for killing this creature) |
0x0018 | 4 (dword) | Creature Power Level (for summoning spells) / XP of the creature (for party members) |
0x001c | 4 (dword) | Gold carried |
0x0020 | 4 (dword) | Permanent status flags (STATE.IDS) |
0x0024 | 2 (word) | Current Hit Points |
0x0026 | 2 (word) | Maximum Hit Points |
0x0028 | 4 (dword) | Animation ID (ANIMATE.IDS) There is some structure to the ordering of these entries, however, it is mostly hard-coded into the .exe, and uneditable. |
0x002c | 1 (byte) | Metal Colour Index |
0x002d | 1 (byte) | Minor Colour Index |
0x002e | 1 (byte) | Major Colour Index |
0x002f | 1 (byte) | Skin Colour Index |
0x0030 | 1 (byte) | Leather Colour Index |
0x0031 | 1 (byte) | Armor Colour Index |
0x0032 | 1 (byte) | Hair Colour Index |
0x0033 | 1 (byte) | EFF structure version
|
0x0034 | 8 (resref) | Small Portrait |
0x003c | 8 (resref) | Large Portrait |
0x0044 | 1 (signed byte) | Reputation (minimum value: 0) |
0x0045 | 1 (byte) | Hide In Shadows (base) |
0x0046 | 2 (signed word) | Armor Class (Natural) |
0x0048 | 2 (signed word) | Armor Class (Effective) |
0x004a | 2 (signed word) | Armor Class (Crushing Attacks Modifier) |
0x004c | 2 (signed word) | Armor Class (Missile Attacks Modifier) |
0x004e | 2 (signed word) | Armor Class (Piercing Attacks Modifier) |
0x0050 | 2 (signed word) | Armor Class (Slashing Attacks Modifier) |
0x0052 | 1 (byte) | THAC0 (1-25) |
0x0053 | 1 (byte) | Number of attacks (0-10) |
0x0054 | 1 (byte) | Save versus death (0-20) |
0x0055 | 1 (byte) | Save versus wands (0-20) |
0x0056 | 1 (byte) | Save versus polymorph (0-20) |
0x0057 | 1 (byte) | Save versus breath attacks (0-20) |
0x0058 | 1 (byte) | Save versus spells (0-20) |
0x0059 | 1 (byte) | Resist fire (0-100) |
0x005a | 1 (byte) | Resist cold (0-100) |
0x005b | 1 (byte) | Resist electricity (0-100) |
0x005c | 1 (byte) | Resist acid (0-100) |
0x005d | 1 (byte) | Resist magic (0-100) |
0x005e | 1 (byte) | Resist magic fire (0-100) |
0x005f | 1 (byte) | Resist magic cold (0-100) |
0x0060 | 1 (byte) | Resist slashing (0-100) |
0x0061 | 1 (byte) | Resist crushing (0-100) |
0x0062 | 1 (byte) | Resist piercing (0-100) |
0x0063 | 1 (byte) | Resist missile (0-100) |
0x0064 | 1 (byte) | Detect illusion (minimum value : 0) |
0x0065 | 1 (byte) | Set traps |
0x0066 | 1 (byte) | Lore (0-100)* |
0x0067 | 1 (byte) | Lockpicking (minimum value: 0) |
0x0068 | 1 (byte) | Stealth (minimum value: 0) |
0x0069 | 1 (byte) | Find/disarm traps (minimum value: 0) |
0x006a | 1 (byte) | Pick pockets (minimum value: 0) |
0x006b | 1 (byte) | Fatigue (0-100) |
0x006c | 1 (byte) | Intoxication (0-100) |
0x006d | 1 (byte) | Luck |
0x006e | 1 (byte) | Large swords proficiency (Proficiencies maybe be packed into 3-bit chunks for the primary and secondary classes) |
0x006f | 1 (byte) | Small swords proficiency (Proficiencies maybe be packed into 3-bit chunks for the primary and secondary classes) |
0x0070 | 1 (byte) | Bows proficiency (Proficiencies maybe be packed into 3-bit chunks for the primary and secondary classes) |
0x0071 | 1 (byte) | Spears proficiency (Proficiencies maybe be packed into 3-bit chunks for the primary and secondary classes) |
0x0072 | 1 (byte) | Axe proficiency (Proficiencies maybe be packed into 3-bit chunks for the primary and secondary classes) |
0x0073 | 1 (byte) | Missile proficiency (Proficiencies maybe be packed into 3-bit chunks for the primary and secondary classes) |
0x0074 | 1 (byte) | Great Swords proficiency (Proficiencies maybe be packed into 3-bit chunks for the primary and secondary classes) |
0x0075 | 1 (byte) | Daggers proficiency (Proficiencies maybe be packed into 3-bit chunks for the primary and secondary classes) |
0x0076 | 1 (byte) | Halberd proficiency (Proficiencies maybe be packed into 3-bit chunks for the primary and secondary classes) |
0x0077 | 1 (byte) | Mace proficiency (Proficiencies maybe be packed into 3-bit chunks for the primary and secondary classes) |
0x0078 | 1 (byte) | Flail proficiency (Proficiencies maybe be packed into 3-bit chunks for the primary and secondary classes) |
0x0079 | 1 (byte) | Hammers proficiency (Proficiencies maybe be packed into 3-bit chunks for the primary and secondary classes) |
0x007a | 1 (byte) | Clubs proficiency (Proficiencies maybe be packed into 3-bit chunks for the primary and secondary classes) |
0x007b | 1 (byte) | Quarterstaves proficiency (Proficiencies maybe be packed into 3-bit chunks for the primary and secondary classes) |
0x007c | 1 (byte) | Crossbow proficiency (Proficiencies maybe be packed into 3-bit chunks for the primary and secondary classes) |
0x007d | 1 (byte) | Unknown proficiency (Proficiencies maybe be packed into 3-bit chunks for the primary and secondary classes) |
0x007e | 1 (byte) | Unknown proficiency (Proficiencies maybe be packed into 3-bit chunks for the primary and secondary classes) |
0x007f | 1 (byte) | Unknown proficiency (Proficiencies maybe be packed into 3-bit chunks for the primary and secondary classes) |
0x0080 | 1 (byte) | Unknown proficiency (Proficiencies maybe be packed into 3-bit chunks for the primary and secondary classes) |
0x0081 | 1 (byte) | Unknown proficiency (Proficiencies maybe be packed into 3-bit chunks for the primary and secondary classes) |
0x0082 | 1 (byte) | Turn undead level |
0x0083 | 1 (byte) | Tracking skill (0-100) |
0x0084 | 32 (char array) | Tracking target |
0x00a4 | 4*100 (Strref*100) | Strrefs pertaining to the character. Most are connected with the sound-set (see SOUNDOFF.IDS (BG1) and SNDSLOT.IDS (BG2)). |
0x0234 | 1 (byte) | Highest attained level in class (0-100). For dual/multi class characters, the levels for each class are split between 0x0234, 0x0235 and 0x0236 according to the internal class name, i.e. for a FIGHTER_THIEF 0x0234 will hold the fighter level, 0x0235 will hold the thief level and 0x0236 will be 0. |
0x0235 | 1 (byte) | Highest attained level in class (0-100) |
0x0236 | 1 (byte) | Highest attained level in class (0-100) |
0x0237 | 1 (byte) | Sex (from gender.ids) - checkable via the sex stat |
0x0238 | 1 (byte) | Strength (1-25) |
0x0239 | 1 (byte) | Strength % Bonus (0-100) |
0x023a | 1 (byte) | Intelligence (1-25) |
0x023b | 1 (byte) | Wisdom (1-25) |
0x023c | 1 (byte) | Dexterity (1-25) |
0x023d | 1 (byte) | Constitution (1-25) |
0x023e | 1 (byte) | Charisma (1-25) |
0x023f | 1 (byte) | Morale |
0x0240 | 1 (byte) | Morale break |
0x0241 | 1 (byte) | Racial enemy (RACE.IDS) |
0x0242 | 2 (word) | Morale Recovery Time |
0x0244 | 4 (dword) | Kit information NONE ABJURER 0x00400000 CONJURER 0x00800000 DIVINER 0x01000000 ENCHANTER 0x02000000 ILLUSIONIST 0x04000000 INVOKER 0x08000000 NECROMANCER 0x10000000 TRANSMUTER 0x20000000 NB.: The values of this offset are written in big-endian style |
0x0248 | 8 (resref) | Creature script - Override |
0x0250 | 8 (resref) | Creature script - Class |
0x0258 | 8 (resref) | Creature script - Race |
0x0260 | 8 (resref) | Creature script - General |
0x0268 | 8 (resref) | Creature script - Default |
0x0270 | 1 (byte) | Visible (0 = No, 1 = Yes) |
0x0271 | 1 (byte) | Set _DEAD variable on death (0 = No, 1 = Yes) |
0x0272 | 1 (byte) | Set KILL_<scriptname>_CNT on death (0 = No, 1 = Yes) |
0x0273 | 1 (byte) | Unknown |
0x0274 | 5 * 2 (word) | Internal variables |
0x027e | 32 (char array) | Secondary death variable (set to 1 on death) |
0x029e | 32 (char array) | Tertiary death variable (incremented by 1 on death) |
0x02be | 2 (word) | Unknown |
0x02c0 | 2 (word) | Saved X coordinate |
0x02c2 | 2 (word) | Saved Y coordinate |
0x02c4 | 2 (word) | Saved orientation |
0x02c6 | 18 (bytes) | Unknown |
0x02d8 | 1 (byte) | Enemy-Ally (EA.IDS) |
0x02d9 | 1 (byte) | General (GENERAL.IDS) |
0x02da | 1 (byte) | Race (RACE.IDS) |
0x02db | 1 (byte) | Class (CLASS.IDS) |
0x02dc | 1 (byte) | Specific (SPECIFIC.IDS) |
0x02dd | 1 (byte) | Gender (GENDER.IDS) |
0x02de | 5 (bytes) | OBJECT.IDS references |
0x02e3 | 1 (byte) | Alignment (ALIGNMEN.IDS) |
0x02e4 | 2 (word) | Global actor enumeration value |
0x02e6 | 2 (word) | Local (area) actor enumeration value |
0x02e8 | 32 (char array) | Death Variable (set SPRITE_IS_DEADvariable on death) |
0x0308 | 4 (dword) | Known spells offset |
0x030c | 4 (dword) | Known spells count |
0x0310 | 4 (dword) | Spell memorization info offset |
0x0314 | 4 (dword) | Spell memorization info entries count |
0x0318 | 4 (dword) | Memorized spells offset |
0x031c | 4 (dword) | Memorized spells count |
0x0320 | 4 (dword) | Offset to Item slots |
0x0324 | 4 (dword) | Offset to Items |
0x0328 | 4 (dword) | Count of Items |
0x032c | 4 (dword) | Offset to effects |
0x0330 | 4 (dword) | Count of effects |
0x0334 | 8 (resref) | Dialog file |
NB. Lore is calculated as ((level * rate) + int_bonus + wis_bonus). Intelligence and wisdom bonuses are from lorebon.2da and the rate is the lookup value in lore.2da, based on class. For multiclass characters, (level * rate) is calculated for both classes separately and the higher of the two values is used - they are not cumulative.
This section details which spells the creature knows, and it consists of an array of entries formatted as follows.
Offset | Size (data type) | Description |
---|---|---|
0x0000 | 8 (resref) | Resource name of the SPL file |
0x0008 | 2 (word) | Spell Level -1 |
0x000a | 2 (word) | Spell type
|
This section details how many spells the creature can memorize, and how many it has memorized. It consists of an array of entries formatted as follows.
Offset | Size (data type) | Description |
---|---|---|
0x0000 | 2 (word) | Spell level - 1 |
0x0002 | 2 (word) | Number of spells memorizable |
0x0004 | 2 (word) | Number of spells memorizable (after effects) |
0x0006 | 2 (word) | Spell type
|
0x0008 | 4 (dword) | Index into memorized spells array of first memorized spell of this type in this level |
0x000c | 4 (dword) | Count of memorized spell entries in memorized spells array of memorized spells of this type in this level |
This section details which spells the character has memorized. It consists of an array of entries formatted as follows.
Offset | Size (data type) | Description |
---|---|---|
0x0000 | 8 (resref) | Resource name of the SPL file |
0x0008 | 4 (dword) | Memorised: 0 = No, 1 = Yes |
This section details which items the character has. It consists of an array of entries formatted as follows:
Offset | Size (data type) | Description |
---|---|---|
0x0000 | 8 (resref) | Resource name of the ITM file holding the particular item |
0x0008 | 1 (byte) | Item expiration time - item creation hour (replace with drained item) |
0x0009 | 1 (byte) | Item expiration time - (elapsed hour count divided by 256, rounded down) + 1 (replace with drained item) When the game hour and elapsed hour count for the current game time exceed these values, the item is removed. |
0x000a | 2 (word) | Quantity/Charges 1 |
0x000c | 2 (word) | Quantity/Charges 2 |
0x000e | 2 (word) | Quantity/Charges 3 |
0x0010 | 4 (dword) | Flags
|
This is an array keeping track of which items are located in each particular location in the CRE's inventory. There are 40 slots, and they are NOT the same as the order specified in specified in SLOTS.IDS. The actual order is: