CRE file format

Applies to:
PST

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.

Engine specific notes:
• PST creature disguises are not stored as a field in the creature file, they are held as a GLOBAL variable, named 'appearance'. A value of 1 equates to zombie disguise, a value of 2 equates to dustman disguise.
• Several fields for TNO are generated dynamically, and as a result changing fields in the relevant CRE file will have no effect.

Detailed Description


Offset Size (datatype) Description
0x00000 4 (char array) Signature ('CRE ')
0x0004 4 (char array) Version ('V1.2')
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 Quest related
  • bit 13 Quest critical
  • 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 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 creature is indicated is 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)
There is some structure to the ordering of these entries. BAM files are mapped by the RESDATA.ini files.
0x002c 1 (byte) Metal Colour Index (BG1 animations)
0x002d 1 (byte) Minor Colour Index (BG1 animations)
0x002e 1 (byte) Major Colour Index (BG1 animations)
0x002f 1 (byte) Skin Colour Index (BG1 animations)
0x0030 1 (byte) Leather Colour Index (BG1 animations)
0x0031 1 (byte) Armor Colour Index (BG1 animations)
0x0032 1 (byte) Hair Colour Index (BG1 animations)
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 (BMP)
0x0044 2 (signed word) Reputation (minimum value: 0)
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) Fist proficiency (Proficiencies maybe be packed into 3-bit chunks for the primary and secondary classes)
0x006f 1 (byte) Edged proficiency (Proficiencies maybe be packed into 3-bit chunks for the primary and secondary classes)
0x0070 1 (byte) Hammer proficiency (Proficiencies maybe be packed into 3-bit chunks for the primary and secondary classes)
0x0071 1 (byte) Axe proficiency (Proficiencies maybe be packed into 3-bit chunks for the primary and secondary classes)
0x0072 1 (byte) Club proficiency (Proficiencies maybe be packed into 3-bit chunks for the primary and secondary classes)
0x0073 1 (byte) Bow proficiency (Proficiencies maybe be packed into 3-bit chunks for the primary and secondary classes)
0x0074 1 (byte) Unused Proficiency Slots
0x0075 1 (byte) Unused Proficiency Slot
0x0076 1 (bytes) Unused Proficiency Slot
0x0077 1 (bytes) Unused Proficiency Slot
0x0078 1 (bytes) Unused Proficiency Slot
0x0079 1 (bytes) Unused Proficiency Slot
0x007a 1 (bytes) Unused Proficiency Slot
0x007b 1 (bytes) Unused Proficiency Slot
0x007c 1 (bytes) Unused Proficiency Slot
0x007d 1 (bytes) Unused Proficiency Slot
0x007e 1 (bytes) Unused Proficiency Slot
0x007f 1 (bytes) Unused Proficiency Slot
0x0080 1 (bytes) Unused Proficiency Slot
0x0081 1 (bytes) Unused Proficiency Slot
0x0082 1 (bytes) 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 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) - not changed by effects
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
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 36 (bytes) Unknown
0x0294 4 (dword) Offset to overlay section
0x0298 4 (dword) Size of overlay section
0x029c 4 (dword) XP (Secondary class)
0x02a0 4 (dword) XP (Tertiary class)
0x02a4 2 (word) Internal 0
0x02a6 2 (word) Internal 1
0x02a8 2 (word) Internal 2
0x02aa 2 (word) Internal 3
0x02ac 2 (word) Internal 4
0x02ae 2 (word) Internal 5
0x02b0 2 (word) Internal 6
0x02b2 2 (word) Internal 7
0x02b4 2 (word) Internal 8
0x02b6 2 (word) Internal 9
0x02b8 1 (byte) GOOD variable increment value
0x02b9 1 (byte) LAW variable increment value
0x02ba 1 (byte) LADY variable increment value
0x02bb 1 (byte) MURDER variable increment value
0x02bc 32 (char array) Monstrous Compendium Entry
0x02dc 1 (char) Dialog Activation Range
0x02dd 1 (byte) Selection circle size
0x02de 1 (byte) Unknown
0x02df 1 (byte) Number of Colours
0x02e0 4 (dword) Attribute flags
  • bit 0: Unused
  • bit 1: Transparent
  • bit 2: Unused
  • bit 3: Unused
  • bit 4: Increment death variable counter (deathvariable_DEAD) - specified at 0x0324
  • bit 5: Increment character type death counter - specified at 0x02bc
  • bit 6: Character type death counter modifier (0: charactertype 1: KILL_charactertype)
  • bit 7: Increment faction death counter (KILL_faction) - specified at 0x313
  • bit 8: Increment team death counter (KILL_team) - specified at 0x312
  • bit 9: Invulnerable
  • bit 10: Increment GOOD variable - amount specified at 0x02b8
  • bit 11: Increment LAW variable - amount specified at 0x02b9
  • bit 12: Increment LADY variable - amount specified at 0x02ba
  • bit 13: Increment MURDER variable - amount specified at 0x02bb
  • bit 14: Do not face target during dialog
  • 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: Unknown

NB. Kill() respects the increment global bits, DestroySelf() does not.
0x02e4 2 (word) Colour 1 (Clownclr.ids)
0x02e6 2 (word) Colour 2 (Clownclr.ids)
0x02e8 2 (word) Colour 3 (Clownclr.ids)
0x02ea 2 (word) Colour 4 (Clownclr.ids)
0x02ec 2 (word) Colour 5 (Clownclr.ids)
0x02ee 2 (word) Colour 6 (Clownclr.ids)
0x02f0 2 (word) Colour 7 (Clownclr.ids)
0x02f2 3 (bytes) Related to colours
0x02f5 1 (char) Colour Placement 1
These fields are bitfields:
  • bit 0: Plasma — shift palette color entries by 1 each update
  • bit 1: Pulsating — change color brightness to ~50% and back to full
0x02f6 1 (char) Colour Placement 2
0x02f7 1 (char) Colour Placement 3
0x02f8 1 (char) Colour Placement 4
0x02f9 1 (char) Colour Placement 5
0x02fa 1 (char) Colour Placement 6
0x02fb 1 (char) Colour Placement 7
0x02fc 21 (bytes) Unknown
0x0311 1 (byte) Species (RACE.IDS)
0x0312 1 (byte) Team (TEAM.IDS)
0x0313 1 (byte) Faction (FACTION.IDS)
0x0314 1 (byte) Enemy-Ally (EA.IDS)
0x0315 1 (byte) General (GENERAL.IDS)
0x0316 1 (byte) Race (RACE.IDS)
0x0317 1 (byte) Class (CLASS.IDS)
0x0318 1 (byte) Specific (SPECIFIC.IDS)
0x0319 1 (byte) Gender (GENDER.IDS)
0x031a 5 (bytes) OBJECT.IDS references
0x031f 1 (byte) Alignment (ALIGNMEN.IDS)
0x0320 2 (word) Global actor enumeration value
0x0322 2 (word) Local (area) actor enumeration value
0x0324 32 (char array) Death Variable (set SPRITE_IS_DEADvariable on death)
0x0344 4 (dword) Known spells offset
0x0348 4 (dword) Known spells count
0x034c 4 (dword) Spell memorization info offset
0x0350 4 (dword) Spell memorization info entries count
0x0354 4 (dword) Memorized spells offset
0x0358 4 (dword) Memorized spells count
0x035c 4 (dword) Item slots offset
0x0360 4 (dword) Items offset
0x0364 4 (dword) Items count
0x0368 4 (dword) Offset to effects
0x036c 4 (dword) Count to effects
0x0370 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 visual effects applied to the creature by opcode 201 (the specific effect applied is controled by paramter 2). Each entry is 40 bytes.
0 - SPWI304 - Cloak of Warding - absorbs 3d4+level damage then removed, or level*5 seconds expired
1 - SPWI111 - Shield - AC = 3, +1 to saving throws, removed after level*25 seconds
2 - SPWI203 - Black Barbed Shield - +2 AC, attackers suffer 1d6 damage, removed after 10d3 seconds
3 - SPWI209 - Pain Mirror - hostile creatures nearby suffer the same damage as the caster, removed after level*5 seconds or after triggered once
4 - SPWI704 - Guardian Mantle - deflects all attacks if attacker doesn't make saving throw -4 vs. spells, removed after 50+level*5 seconds
5 - Shroud of Darkness (projectile)
6 - SPWI504 - Enoll Eva's Duplication - double projectiles?
7 - SPWI101 - Armor - AC = 6, removed after 8+level damage
8 - SPWI601 - Antimagic Shell - disables all projectiles? disables casting?
9 - ?
10- ?
11- SPPR201 - Flamewalk - 50% fire resistance, +2 saving throws vs. fire
12- SPPR106 - Protection from Evil - +2 AC vs. evil, +2 saving throws vs. evil
13- SPWI902 - Conflagration - 2d6 damage on target per 5 seconds, anyone comes close also suffers it, but entitled to save vs. spells
14- SPWI312 - Infernal Shield - 150% fire resistance (fire heals half damage).
15- SPWI119 - Submerge the Will - AC = 2, +1 to saving throws, removed after level*12 seconds
16- SPWI314 - Balance in All Things - hostile creatures nearby suffer the same damage as the caster, removed after level*5 seconds, can be triggered level/4 times

Offset Size (data type) Description
0x0000 8 (resref)
Overlay BAM file
0x0008 4 (dword)
Unknown
0x000c 2 (word)
Timing
0x000e 2 (word) Type
0x0010 4 (dword) Duration
0x014 4 (dword)
Unknown
0x0018 8 (bytes)
Unknown
0x0020 4 (dword)
Unknown
0x0024 2 (word)
Unknown


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 - 1
0x0002 2 (word) Count of spells memorizable
0x0004 2 (word) Count 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 keeping track of which items are located in each particular location in the CRE's inventory. There are 48 slots, and they are not the same as the order specified in specified in SLOTS.IDS. The actual order is:
  • Right Earring/Lens/Helmet
  • Armor
  • Left Tattoo
  • Hand
  • L.Ring
  • R.Ring
  • Left Earring/Eyeball
  • Right Tattoo (lower)
  • Boots
  • Weapon 1
  • Weapon 2
  • Weapon 3
  • Weapon 4
  • Quiver 1
  • Quiver 2
  • Quiver 3
  • Quiver 4
  • Quiver 5
  • Quiver 6 (cannot be accesed from GUI)
  • Right Tattoo (upper)
  • Quick item 1
  • Quick item 2
  • Quick item 3
  • Quick item 4
  • Quick item 5
  • Inventory item (1 to 20)
  • Magic weapon
  • Selected weapon
  • Selected weapon ability
Each entry will be either 0xFFFF ("empty") or an index into the Items table. Selected is a dword indicating which weapon slot us currently selected. Values are from slots.ids - 35, with 1000 meaning "fist".