CRE file format

Applies to:
BG1, BG1: TotS, BG2, BG2: ToB, BGEE

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


Offset Size (datatype) Description
0x00000 4 (char array) Signature ('CRE ')
0x0004 4 (char array) Version ('V1.0')
0x0008 4 (strref) Long name
0x000c 4 (strref) Short name (tooltip)
0x0010 4 (dword) Creature flags
  • bit 0 Show longname in tooltip
  • bit 1: No corpse
  • bit 2: Keep corpse
  • bit 3: Original class was Fighter
  • bit 4: Original class was Mage
  • bit 5: Original class was Cleric
  • bit 6: Original class was Thief
  • bit 7: Original class was Druid
  • bit 8: Original class was Ranger
  • bit 9: Fallen Paladin
  • bit 10: Fallen Ranger
  • bit 11: Exportable
  • bit 12: Hide injury status in tooltip
  • bit 13: Quest critical / affected by alternative damage
  • bit 14: Can activate "Can not be used by NPC" triggers
  • bit 15: Been in Party
  • bit 16: Restore item in hand
  • bit 17: Un-sets bit 16
  • bit 18 - 19 Unused
  • bit 20: Prevent exploding death (BGEE)
  • bit 21: Unused
  • bit 22: Don't apply nightmare mode modifiers (BGEE)
  • bit 23: No tooltip (BGEE)
  • bit 24: Related to random walk (ea)
  • bit 25: Related to random walk (general)
  • bit 26: Related to random walk (race)
  • bit 27: Related to random walk (class)
  • bit 28: Related to random walk (specific)
  • bit 29: Related to random walk (gender)
  • bit 30: Related to random walk (alignment)
  • bit 31: Un-interruptable (memory only)
A multiclass char is indicated by the absence of any of the "original class" flags being set.
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)

BGEE:
Animation slots have been (for the most parts) externalised. Symbolic names are defined in ANIMATE.IDS. Animation definitions can be found in INI files where filenames are made up from the hexadecimal representation of the slot value and the ".INI" extension. Example: Animation of "0x6004 CLERIC_MALE_GNOME" is defined in 6004.INI.

Other games:
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
  • 0: Version 1 EFF
  • 1: Version 2 EFF
0x0034 8 (resref) Small Portrait (BMP)
0x003c 8 (resref) Large Portrait (PSTEE: BAM, Other games: BMP)
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) BG1: Large swords proficiency
Other games: Unused proficiency
Note: Proficiencies are packed into 3-bit chunks for primary and secondary classes.
0x006f 1 (byte) BG1: Small swords proficiency
BG2: Unused proficiency
Note: Proficiencies are packed into 3-bit chunks for primary and secondary classes.
0x0070 1 (byte) BG1: Bows proficiency
BG2: Unused proficiency
Note: Proficiencies are packed into 3-bit chunks for primary and secondary classes.
0x0071 1 (byte) BG1: Spears proficiency
BG2: Unused proficiency
Note: Proficiencies are packed into 3-bit chunks for primary and secondary classes.
0x0072 1 (byte) BG1: Blunt proficiency
BG2: Unused proficiency
Note: Proficiencies are packed into 3-bit chunks for primary and secondary classes.
0x0073 1 (byte) BG1: Spiked proficiency
BG2: Unused proficiency
Note: Proficiencies are packed into 3-bit chunks for primary and secondary classes.
0x0074 1 (byte) BG1: Axe proficiency
BG2: Unused proficiency
Note: Proficiencies are packed into 3-bit chunks for primary and secondary classes.
0x0075 1 (byte) BG1: Missile proficiency
BG2: Unused proficiency
Note: Proficiencies are packed into 3-bit chunks for primary and secondary classes.
0x0076 1 (byte) Unused proficiency (Proficiencies are packed into 3-bit chunks for primary and secondary classes)
0x0077 1 (byte) Unused proficiency (Proficiencies are packed into 3-bit chunks for primary and secondary classes)
0x0078 1 (byte) Unused proficiency (Proficiencies are packed into 3-bit chunks for primary and secondary classes)
0x0079 1 (byte) Unused proficiency (Proficiencies are packed into 3-bit chunks for primary and secondary classes)
0x007a 1 (byte) Unused proficiency (Proficiencies are packed into 3-bit chunks for primary and secondary classes)
0x007b 1 (byte) BG1, BG2: Unused proficiency (Proficiencies are packed into 3-bit chunks for primary and secondary classes)
PSTEE: Unspent proficiencies
0x007c 1 (byte) BG1, BG2: Unused proficiency (Proficiencies are packed into 3-bit chunks for primary and secondary classes)
PSTEE: Number of available inventory slots (0 indicates default number)
0x007d 1 (byte) BG1, BG2: Unused proficiency (Proficiencies are packed into 3-bit chunks for primary and secondary classes)
BGEE: Nightmare mode modifiers applied
0x007e 1 (byte) BG1, BG2: Unused proficiency (Proficiencies are packed into 3-bit chunks for primary and secondary classes)
BGEE: Translucency (range: 0-255)
0x007f 1 (byte) BG1, BG2: Unused proficiency (Proficiencies are packed into 3-bit chunks for primary and secondary classes)
BGEE: Reputation gain/loss when killed
PSTEE: MURDER variable increment value
0x0080 1 (byte) BG1, BG2: Unused proficiency (Proficiencies are packed into 3-bit chunks for primary and secondary classes)
BGEE: Reputation gain/loss when joining party
0x0081 1 (byte) BG1, BG2: Unused proficiency (Proficiencies are packed into 3-bit chunks for primary and secondary classes)
BGEE: Reputation gain/loss when leaving party
0x0082 1 (byte) Turn undead level
0x0083 1 (byte) Tracking skill (0-100)
The following entry applies to BG1, BG2 and BGEE:
0x0084 32 (char array) Tracking target
The following entries apply only to PSTEE:
0x0084 4 (dword) Current thief class experience
0x0088 4 (dword) Current mage class experience
0x008c 1 (byte) GOOD variable increment value
0x008d 1 (byte) LAW variable increment value
0x008e 1 (byte) LADY variable increment value
0x008f 1 (byte) Faction (see FACTION.IDS)
0x0090 1 (byte) Team (see TEAM.IDS)
0x0091 1 (byte) Species (see RACE.IDS)
0x0092 1 (byte) Dialogue activation range
0x0093 1 (byte) Selection circle size
0x0094 1 (byte) Shield flags:
  • Bit 0: Normal shield
  • Bit 1: Black barbed shield
0x0095 1 (byte) Field of vision (bitfield?)
0x0096 4 (dword) Attribute flags:
  • Bit 0: Auto-calculate marker rectangle
  • Bit 1: Translucent
  • Bit 2: Unknown
  • Bit 3: Unknown
  • Bit 4: Increment death variable counter (deathvariable_DEAD)
  • Bit 5: Increment character type death counter
  • Bit 6: Character type death counter modifier
  • Bit 7: Increment faction death counter (KILL_faction)
  • Bit 8: Increment team death counter (KILL_team)
  • Bit 9: Invulnerable
  • Bit 10: Increment GOOD variable
  • Bit 11: Increment LAW variable
  • Bit 12: Increment LADY variable
  • Bit 13: Increment MURDER variable
  • Bit 14: Do not face target during dialogue
  • Bit 15: Turn all nearby creatures party-hostile when calling Help()
  • Bit 16: Unknown
  • Bit 17: Unknown
  • Bit 18: Unknown
  • Bit 19: Unknown
  • Bit 20: Unknown
  • Bit 21: Unknown
  • Bit 22: Unknown
  • Bit 23: Unknown
  • Bit 24: Unknown
  • Bit 25: Unknown
  • Bit 26: Unknown
  • Bit 27: Unknown
  • Bit 28: Unknown
  • Bit 29: Unknown
  • Bit 30: Do not increment globals (used in save games to prevent duplicate counting)
  • Bit 31: Area supplemental
0x009a 10 (bytes) Unused
Continued for all games:
0x00a4 4*100 (Strref*100) Strrefs pertaining to the character.
Most are connected with the sound-set (see SOUNDOFF.IDS (BG1) and SNDSLOT.IDS for (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                0x00000000
KIT_BARBARIAN       0x00004000
KIT_TRUECLASS       0x40000000
KIT_BERSERKER       0x40010000
KIT_WIZARDSLAYER    0x40020000
KIT_KENSAI          0x40030000
KIT_CAVALIER        0x40040000
KIT_INQUISITOR      0x40050000
KIT_UNDEADHUNTER    0x40060000
KIT_ARCHER          0x40070000
KIT_STALKER         0x40080000
KIT_BEASTMASTER     0x40090000
KIT_ASSASSIN        0x400A0000
KIT_BOUNTYHUNTER    0x400B0000
KIT_SWASHBUCKLER    0x400C0000
KIT_BLADE           0x400D0000
KIT_JESTER          0x400E0000
KIT_SKALD           0x400F0000
KIT_TOTEMIC         0x40100000
KIT_SHAPESHIFTER    0x40110000
KIT_AVENGER         0x40120000
KIT_GODTALOS        0x40130000
KIT_GODHELM         0x40140000
KIT_GODLATHANDER    0x40150000
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.
NB.: In BG1 the valid values are mages schools and None
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) Enemy-Ally (EA.IDS)
0x0271 1 (byte) General (GENERAL.IDS)
0x0272 1 (byte) Race (RACE.IDS)
0x0273 1 (byte) Class (CLASS.IDS)
0x0274 1 (byte) Specific (SPECIFIC.IDS)
0x0275 1 (byte) Gender (GENDER.IDS). Dictates the casting voice, and checked for the summoning cap.
0x0276 5 (bytes) OBJECT.IDS references
0x027b 1 (byte) Alignment (ALIGNMEN.IDS)
0x027c 2 (word) Global actor enumeration value
0x027e 2 (word) Local (area) actor enumeration value
0x0280 32 (char array) Death Variable (set SPRITE_IS_DEADvariable on death)
0x02a0 4 (dword) Known spells offset
0x02a4 4 (dword) Known spells count
0x02a8 4 (dword) Spell memorization info offset
0x02ac 4 (dword) Spell memorization info entries count
0x02b0 4 (dword) Memorized spells offset
0x02b4 4 (dword) Memorized spells count
0x02b8 4 (dword) Offset to Item slots
0x02bc 4 (dword) Offset to Items
0x02c0 4 (dword) Count of Items
0x02c4 4 (dword) Offset to effects
0x02c8 4 (dword) Count of effects.
0x02cc 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
  • 0=Priest
  • 1=Wizard
  • 2=Innate


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 (less 1)
0x0002 2 (word) Number of spells memorizable
0x0004 2 (word) Number of spells memorizable (after effects)
0x0006 2 (word) Spell type
  • 0=Priest
  • 1=Wizard
  • 2=Innate
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
  • bit 0 Memorised
  • bit 1 Disabled


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
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
  • bit 0: Identified
  • bit 1: Unstealable
  • bit 2: Stolen
  • bit 3: Undroppable


This is an array of words keeping track of which items are located in each particular location in the CRE's inventory. Each entry will be either -1 (0xFFFF - "empty") or an index into the Items table. Selected weapon is a word value indicating which weapon slot is currently selected. Values are from slots.ids - 35, with 1000 meaning "fist".

BG1, BG2, BGEE:
There are 40 slots, and they are not the same as the order specified in specified in SLOTS.IDS. The actual order is:
  • Helmet
  • Armor
  • Shield
  • Gloves
  • L.Ring
  • R.Ring
  • Amulet
  • Belt
  • Boots
  • Weapon 1
  • Weapon 2
  • Weapon 3
  • Weapon 4
  • Quiver 1
  • Quiver 2
  • Quiver 3
  • Quiver 4 (cannot be accesed from GUI)
  • Cloak
  • Quick item 1
  • Quick item 2
  • Quick item 3
  • Inventory item (1 to 16)
  • Magic weapon
  • Selected weapon
  • Selected weapon ability

PSTEE:
Non-party characters have 40 item slots by default if field at offset 0x007c is set to 0. Slot configuration is defined in ITMSLOTS.2DA. The default order is:
  • Left Earring/Lens/Helmet
  • Chest
  • Right Tattoo (lower)
  • Hand
  • Right Ring
  • Left Ring
  • Right Earring/Eyeball
  • Left Tattoo
  • Wrist
  • Weapon 1
  • Weapon 2
  • Weapon 3
  • Weapon 4
  • Quiver 1
  • Quiver 2
  • Quiver 3
  • Quiver 4
  • Right Tattoo (upper)
  • Quick item 1
  • Quick item 2
  • Quick item 3
  • Inventory item (1 to 16)
  • Magic weapon
  • Selected weapon
  • Selected weapon ability
Party members have 57 item slots by default. Actual slot number (excluding "Selected weapon ability") is defined at offset 0x007c. Slot configuration can be modified in ITMSLOTS.2DA. The default order is:
  • Left Earring/Lens/Helmet
  • Chest
  • Right Tattoo (lower)
  • Hand
  • Right Ring
  • Left Ring
  • Right Earring/Eyeball
  • Left Tattoo
  • Wrist
  • Weapon 1
  • Weapon 2
  • Weapon 3
  • Weapon 4
  • Quiver 1
  • Quiver 2
  • Quiver 3
  • Quiver 4
  • Right Tattoo (upper)
  • Quick item 1
  • Quick item 2
  • Quick item 3
  • Inventory item (1 to 16)
  • Magic weapon
  • Quiver 5
  • Unused
  • Quick item 4
  • Quick item 5
  • Inventory item (17 to 20)
  • Unused
  • Unused
  • Unused
  • Unused
  • Unused
  • Unused
  • Unused
  • Unused
  • Unused
  • Selected weapon
  • Selected weapon ability