CRE files

Description

This file format describes a "creature" (i.e. for lack of a better description, any object you are capable of attacking. Not all objects you can open a dialog with are creatures. Doors, for instance, can have associated dialogs, and could even talk to you, if they were so programmed.) Interestingly enough, the same format for this file is used in Baldur's Gate 2 and Baldur's Gate. The additional capabilities (such as new weapons proficiencies) are attached to the creature as long-lived effects. I will attempt to document this at some point in the future, but essentially, they are attached in EFF V2.0 formatted blocks (though with the header zeroed), and an effect type of 0xe9. The specific stats which are stored in the given structures are given by a mapping in one of the IDS or 2DA files. Details will be forthcoming when I get some more time.

CRE file versions

CRE V1.0

Overall structure

CRE V1.0 Header

OffsetSize (datatype)Description
0x00004 (char array)Signature ('CRE ')
0x00044 (char array)Version ('V1.0')
0x00084 (Strref)Long Creature name
0x000c4 (Strref)Short Creature name (used for tooltips)
0x00104 (dword)unknown
0x00144 (dword)experience value (i.e. value in XP for killing this creature)
0x00184 (dword)experience
0x001c4 (dword)gold
0x00204 (dword)(permanent) status flags (as per STATE.IDS). This varies from game to game, but includes such things as invisibility, charmed, silenced, and draw-upon-holy-might.
0x00242 (word)Current hit points
0x00262 (word)Max hit points
0x00282 (word)Animation ID (as from ANIMATE.IDS). Note that while there is some structure to the ordering of these, it is actually worked out via a sort of tangled routine which sorts into major categories based on the high nybble. In Baldur's Gate, the way BAM files (for display on the overland screen) are mapped to CRE files is via this field; the resource names which are mapped to by ANIMATE ids are hard-coded in the executable. Yuck.
0x002a2 (word)unknown
0x002c1 (byte)metal color index
0x002d1 (byte)minor color index
0x002e1 (byte)major color index
0x002f1 (byte)skin color index
0x00301 (byte)leather color index
0x00311 (byte)armor color index
0x00321 (byte)hair color index
0x00331 (byte)In TotSC, a new format for effects was created, as evident in their EFF V2.0 files. In Icewind Dale, and possibly also in TotSC, this byte is a flag: if equal to 0, the effect structures attached to this CRE file are old style effects. If this byte is equal to 1, the effect structures are as in the EFF V2.0 format, for which we have no information at present.
0x00348 (resref)resource name for the 'small portrait' associated with this CRE, if any (i.e. small portrait as customizable for each character in the game options)
0x003c8 (resref)resource name for the 'large portrait' associated with this CRE, if any (i.e. large portrait as customizable for each character in the game options)
0x00441 (byte)reputation (minimum value: 0)
0x00451 (byte)unknown
0x00462 (signed word)armor class (natural?)
0x00482 (signed word)armor class (effective?)
0x004a2 (signed word)armor class (crushing attacks modifier)
0x004c2 (signed word)armor class (missile attacks modifier)
0x004e2 (signed word)armor class (piercing attacks modifier)
0x00502 (signed word)armor class (slashing attacks modifier)
0x00521 (byte)THAC0 (1-25)
0x00531 (byte)number of attacks (0-10)
0x00541 (byte)save versus death (0-20)
0x00551 (byte)save versus wands (0-20)
0x00561 (byte)save versus poly (0-20)
0x00571 (byte)save versus breath (0-20)
0x00581 (byte)save versus spell (0-20)
0x00591 (byte)resist fire (0-100)
0x005a1 (byte)resist cold (0-100)
0x005b1 (byte)resist electricity (0-100)
0x005c1 (byte)resist acid (0-100)
0x005d1 (byte)resist magic (0-100)
0x005e1 (byte)resist magic fire (0-100)
0x005f1 (byte)resist magic cold (0-100)
0x00601 (byte)resist slashing (0-100)
0x00611 (byte)resist crushing (0-100)
0x00621 (byte)resist piercing (0-100)
0x00631 (byte)resist missile (0-100)
0x00641 (byte)unknown
0x00651 (byte)unknown
0x00661 (byte)lore skill (0-100)
0x00671 (byte)lockpicking skill (minimum value: 0)
0x00681 (byte)stealth skill (minimum value: 0)
0x00691 (byte)traps skill (minimum value: 0)
0x006a1 (byte)pick-pockets skill (minimum value: 0)
0x006b1 (byte)fatigue (0-100)
0x006c1 (byte)intoxification (0-100)
0x006d1 (byte)luck
0x006e1 (byte)(not used in BG2) Large swords proficiency (It is rumored that proficiencies are packed in 3-bit chunks for the primary and secondary classes -- i.e. primary class proficiency is the low 3 bits, secondary is the middle 3 bits. This may be true.)
0x006f1 (byte)(not used in BG2) Small swords proficiency (It is rumored that proficiencies are packed in 3-bit chunks for the primary and secondary classes -- i.e. primary class proficiency is the low 3 bits, secondary is the middle 3 bits. This may be true.)
0x00701 (byte)(not used in BG2) Bows proficiency (It is rumored that proficiencies are packed in 3-bit chunks for the primary and secondary classes -- i.e. primary class proficiency is the low 3 bits, secondary is the middle 3 bits. This may be true.)
0x00711 (byte)(not used in BG2) Spears proficiency (It is rumored that proficiencies are packed in 3-bit chunks for the primary and secondary classes -- i.e. primary class proficiency is the low 3 bits, secondary is the middle 3 bits. This may be true.)
0x00721 (byte)(not used in BG2) Blunt weapons proficiency (It is rumored that proficiencies are packed in 3-bit chunks for the primary and secondary classes -- i.e. primary class proficiency is the low 3 bits, secondary is the middle 3 bits. This may be true.)
0x00731 (byte)(not used in BG2) Spiked weapons proficiency (It is rumored that proficiencies are packed in 3-bit chunks for the primary and secondary classes -- i.e. primary class proficiency is the low 3 bits, secondary is the middle 3 bits. This may be true.)
0x00741 (byte)(not used in BG2) Axe weapons proficiency (It is rumored that proficiencies are packed in 3-bit chunks for the primary and secondary classes -- i.e. primary class proficiency is the low 3 bits, secondary is the middle 3 bits. This may be true.)
0x00751 (byte)(not used in BG2) Missile weapons proficiency (It is rumored that proficiencies are packed in 3-bit chunks for the primary and secondary classes -- i.e. primary class proficiency is the low 3 bits, secondary is the middle 3 bits. This may be true.)
0x007613 (bytes)unknown
0x00831 (byte)tracking skill (0-100)
0x008432 (bytes)unknown
0x00a44*100 (Strref*100)Strrefs which relate to the character. Most of them relate to the sound-set. In the file SOUNDOFF.IDS, there are several numbers. These indicate indices into this array, and they match various occurrences to Strrefs. For instance, SOUNDOFF.IDS has "SELECT_RARE", at index 35. SELECT_RARE actually takes up 4 entries -- the next numbered entry is at 39. So the 35th through the 39th entries in this are the "select rare" entries, which, it turns out, correspond to the amusing sound-bites you get if you repeatedly click on a character. A character's biography appears to be stored in the 74th entry in this array. What any other entries may be used for is unknown, although I suspect it varies from character to character, judging from the label "MISC" that is applied around entry #58. Presumably the rest of the entries are just for miscellaneous purposes which only apply to certain characters.
0x02341 (byte)Highest attained level in primary class (0-100)
0x02351 (byte)Highest attained level in secondary class (0-100)
0x02361 (byte)Highest attained level in tertiary class (0-100)
0x02371 (byte)unknown (level in quaternary class? probably not...)
0x02381 (byte)Strength (1-25)
0x02391 (byte)Strength % Bonus (0-100)
0x023a1 (byte)Intelligence (1-25)
0x023b1 (byte)Wisdom (1-25)
0x023c1 (byte)Dexterity (1-25)
0x023d1 (byte)Constitution (1-25)
0x023e1 (byte)Charisma (1-25)
0x023f1 (byte)Morale
0x02401 (byte)Morale break
0x02411 (byte)Racial enemy (see RACE.IDS)
0x02421 (byte)Morale Recovery Time
0x02433 (bytes)unknown
0x02462 (word)mage type (see MAGETYPE.IDS)
0x02488 (resref)creature script ("override" script?)
0x02508 (resref)creature script ("class" script?)
0x02588 (resref)creature script ("race" script?)
0x02608 (resref)creature script ("general" script?)
0x02688 (resref)creature script ("default" script?)
0x02701 (byte)"Enemy-Ally" type (see EA.IDS). This field and the next several require some explanation. It seems probable, due to the similar layout of these fields, that this is actually an object identifier. For reference, see the script compiler manual, but in short, it means that it has EA, GENERAL, RACE, CLASS, and SPECIFIC, among other things. This data could be used to explain the other unused fields. The only difficulty with this theory is that the byte which is currently listed as "gender" would normally be 'special case' according to the script compiler manual. On the other hand, the script compiler manual is poorly written and inaccurate in places, probably the result of a quick edit of an internal specification which was hacked into a public document.
0x02711 (byte)"General" type (see GENERAL.IDS).
0x02721 (byte)"Race" type (see RACE.IDS).
0x02731 (byte)"Class" type (see CLASS.IDS).
0x02741 (byte)"Specific" type (see SPECIFIC.IDS).
0x02751 (byte)"Gender" type (see GENDER.IDS).
0x02765 (bytes)unknown; however, see description at "Enemy-Ally" type byte above. If this is, in fact, an object id, then this here would be the 5 bytes which are used for functional specification of an object (see OBJECT.IDS). Functional specification of an object involves things like LastAttackerOf(Myself) or ProtectorOf(LastTalkedToBy(Protagonist)).
0x027b1 (byte)"Alignment" type (see ALIGNMEN.IDS.)
0x027c2 (word)unknown. This field and the next appear to hold two 16-bit words, both of which are usually 0xffff.
0x027e2 (word)unknown
0x028032 (char array)This field determines the name of the "death variable" to set when this creature has been killed.
0x02a04 (dword)Known spells offset
0x02a44 (dword)Known spells count
0x02a84 (dword)Spell memorization info offset
0x02ac4 (dword)Spell memorization info entries count
0x02b04 (dword)Memorized spells offset
0x02b44 (dword)Memorized spells count
0x02b84 (dword)Item slots offset
0x02bc4 (dword)Items offset
0x02c04 (dword)Items count
0x02c44 (dword)offset to effects currently affecting creature
0x02c84 (dword)count of effects currently affecting creature
0x02cc8 (resref)associated dialog file. (A CRE can have a default DLG file associated. This can be overridden in the ARE file, and I think can also be overridden by a script).

CRE V1.0 Known Spells

This section details which spells the creature knows, and it consists of an array of entries formatted as follows.

OffsetSize (datatype)Description
0x00008 (resref)Resource name of the SPL file holding the particular spell
0x00082 (word)Level of the spell (less 1)
0x000a2 (word)Type of the spell (0=Priest, 1=Wizard, 2=Innate, other values? This doesn't appear in any of the IDS files, to my knowledge)

CRE V1.0 Spell Memorization Info

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.

OffsetSize (datatype)Description
0x00002 (word)Spell level (less 1)
0x00022 (word)Number of spells memorizable
0x00042 (word)Number of spells memorizable (how does this differ from the field at 2?)
0x00062 (word)Spell type (as above in Known Spells, 0=Priest, 1=Wizard, 2=Innate, other values are either unknown or invalid).
0x00084 (dword)Index into memorized spells array of first memorized spell of this type in this level.
0x000c4 (dword)Count of memorized spell entries in memorized spells array of memorized spells of this type in this level.

CRE V1.0 Memorized Spells Table

This section details which spells the character has memorized. It consists of an array of entries formatted as follows.

OffsetSize (datatype)Description
0x00008 (resref)Resource name of the SPL file holding the particular memorized spell
0x00084 (dword)Unknown; likely, it is set to 1 when the spell is memorized, and set to 0 once the spell has been cast. In this way, it keeps track of which spells are scheduled to be memorized when the CRE next sleeps.

CRE V1.0 Items Table

This section details which items the character has. It consists of an array of entries formatted as follows.

OffsetSize (datatype)Description
0x00008 (resref)Resource name of the ITM file holding the particular item
0x00082 (word)unknown
0x000a2 (word)"usage1" -- typically, the count of the item, or the number of uses remaining in the item if it is not a "stackable" item.
0x000a2 (word)"usage2" -- the second parameter passed when the script function "CreateItem" is called. This might only be used for wands and other magical items which have multiple uses (i.e. cast fireball n times and aganazzar's scorcher m times)
0x000c2 (word)"usage3" -- the third parameter passed when the script function "CreateItem" is called. Presumably like 'usage2'.
0x000e4 (dword)Flags:
  • bit 0: identified
  • other bits: to fill in later

CRE V1.0 Item Slots

This is an array keeping track of which items are located in each particular location in the CRE's inventory. There are 38 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, UNKNOWN, Quick item 1, Quick item 2, Quick item 3, and 16(?) inventory slots. Each entry in here will either be 0xffff, meaning "empty", or it will be an index into the Items table.

CRE V1.2

Overall structure

CRE V1.2 Header

OffsetSize (datatype)Description
0x00004 (char array)Signature ('CRE ')
0x00044 (char array)Version ('V1.2')
0x00084 (Strref)Long Creature name (or possibly identified name? Perhaps the lore skill was intended to function upon monsters as well?
0x000c4 (Strref)Short Creature name (or unidentified name? See note above.)
0x00104 (dword)unknown
0x00144 (dword)experience value (i.e. value in XP for killing this creature)
0x00184 (dword)experience
0x001c4 (dword)gold
0x00204 (dword)(permanent) status flags (as per STATE.IDS). This varies from game to game, but includes such things as invisibility, charmed, silenced, and draw-upon-holy-might.
0x00242 (word)Current hit points
0x00262 (word)Max hit points
0x00282 (word)Animation ID (as from ANIMATE.IDS). Note that while there is some structure to the ordering of these, it is actually worked out via a sort of tangled routine which sorts into major categories based on the high nybble. In Planescape: Torment, the way BAM files (for display on the overland screen) are mapped to CRE files is via this field; the resource names which are mapped to by ANIMATE ids are (I believe) hard-coded in the executable. According to Dmitry Jemerov, the BAM file mapped to a CRE resource may be handled by the file RESDATA.INI.
0x002a2 (word)unknown
0x002c1 (byte)metal color index
0x002d1 (byte)minor color index
0x002e1 (byte)major color index
0x002f1 (byte)skin color index
0x00301 (byte)leather color index
0x00311 (byte)armor color index
0x00321 (byte)hair color index
0x00331 (byte)unknown
0x00348 (resref)resource name for the 'small portrait' associated with this CRE, if any (i.e. small portrait as customizable for each character in the game options)
0x003c8 (resref)resource name for the 'large portrait' associated with this CRE, if any (i.e. large portrait as customizable for each character in the game options)
0x00441 (byte)reputation (minimum value: 0)
0x00451 (byte)unknown
0x00462 (signed word)armor class (natural?)
0x00482 (signed word)armor class (effective?)
0x004a2 (signed word)armor class (crushing attacks modifier)
0x004c2 (signed word)armor class (missile attacks modifier)
0x004e2 (signed word)armor class (piercing attacks modifier)
0x00502 (signed word)armor class (slashing attacks modifier)
0x00521 (byte)THAC0 (1-25)
0x00531 (byte)number of attacks (0-10)
0x00541 (byte)save versus death (0-20)
0x00551 (byte)save versus wands (0-20)
0x00561 (byte)save versus poly (0-20)
0x00571 (byte)save versus breath (0-20)
0x00581 (byte)save versus spell (0-20)
0x00591 (byte)resist fire (0-100)
0x005a1 (byte)resist cold (0-100)
0x005b1 (byte)resist electricity (0-100)
0x005c1 (byte)resist acid (0-100)
0x005d1 (byte)resist magic (0-100)
0x005e1 (byte)resist magic fire (0-100)
0x005f1 (byte)resist magic cold (0-100)
0x00601 (byte)resist slashing (0-100)
0x00611 (byte)resist crushing (0-100)
0x00621 (byte)resist piercing (0-100)
0x00631 (byte)resist missile (0-100)
0x00641 (byte)unknown
0x00651 (byte)unknown
0x00661 (byte)lore skill (0-100)
0x00671 (byte)lockpicking skill (minimum value: 0)
0x00681 (byte)stealth skill (minimum value: 0)
0x00691 (byte)traps skill (minimum value: 0)
0x006a1 (byte)pick-pockets skill (minimum value: 0)
0x006b1 (byte)fatigue (0-100)
0x006c1 (byte)intoxification (0-100)
0x006d1 (byte)luck
0x006e1 (byte)Fist proficiency (It is rumored that proficiencies are packed in 3-bit chunks for the primary and secondary classes -- i.e. primary class proficiency is the low 3 bits, secondary is the middle 3 bits. This may be true.)
0x006f1 (byte)Edged weapons proficiency (It is rumored that proficiencies are packed in 3-bit chunks for the primary and secondary classes -- i.e. primary class proficiency is the low 3 bits, secondary is the middle 3 bits. This may be true.)
0x00701 (byte)Hammer proficiency (It is rumored that proficiencies are packed in 3-bit chunks for the primary and secondary classes -- i.e. primary class proficiency is the low 3 bits, secondary is the middle 3 bits. This may be true.)
0x00711 (byte)Axe proficiency (It is rumored that proficiencies are packed in 3-bit chunks for the primary and secondary classes -- i.e. primary class proficiency is the low 3 bits, secondary is the middle 3 bits. This may be true.)
0x00721 (byte)Club weapons proficiency (It is rumored that proficiencies are packed in 3-bit chunks for the primary and secondary classes -- i.e. primary class proficiency is the low 3 bits, secondary is the middle 3 bits. This may be true.)
0x00731 (byte)Bow weapons proficiency (It is rumored that proficiencies are packed in 3-bit chunks for the primary and secondary classes -- i.e. primary class proficiency is the low 3 bits, secondary is the middle 3 bits. This may be true.)
0x00741 (byte)Probably unused (BG has 8 proficiency types, PT has only 6)
0x00751 (byte)Probably unused (BG has 8 proficiency types, PT has only 6)
0x007613 (bytes)unknown
0x00831 (byte)tracking skill (0-100)
0x008432 (bytes)unknown
0x00a44*100 (Strref*100)Strrefs which relate to the character. Most of them relate to the sound-set. In the file SOUNDOFF.IDS, there are several numbers. These indicate indices into this array, and they match various occurrences to Strrefs. For instance, SOUNDOFF.IDS has "SELECT_RARE", at index 35. SELECT_RARE actually takes up 4 entries -- the next numbered entry is at 39. So the 35th through the 39th entries in this are the "select rare" entries, which, it turns out, correspond to the amusing sound-bites you get if you repeatedly click on a character. A character's biography appears to be stored in the 74th entry in this array. What any other entries may be used for is unknown, although I suspect it varies from character to character, judging from the label "MISC" that is applied around entry #58. Presumably the rest of the entries are just for miscellaneous purposes which only apply to certain characters.
0x02341 (byte)Highest attained level in primary class (0-100)
0x02351 (byte)Highest attained level in secondary class (0-100)
0x02361 (byte)Highest attained level in tertiary class (0-100)
0x02371 (byte)unknown (level in quaternary class? probably not...)
0x02381 (byte)Strength (1-25)
0x02391 (byte)Strength % Bonus (0-100)
0x023a1 (byte)Intelligence (1-25)
0x023b1 (byte)Wisdom (1-25)
0x023c1 (byte)Dexterity (1-25)
0x023d1 (byte)Constitution (1-25)
0x023e1 (byte)Charisma (1-25)
0x023f1 (byte)Morale
0x02401 (byte)Morale break
0x02411 (byte)Racial enemy (see RACE.IDS)
0x02421 (byte)Morale Recovery Time
0x02433 (bytes)unknown
0x02462 (word)mage type (see MAGETYPE.IDS)
0x02488 (resref)creature script ("override" script?)
0x02508 (resref)creature script ("class" script?)
0x02588 (resref)creature script ("race" script?)
0x02608 (resref)creature script ("general" script?)
0x02688 (resref)creature script ("default" script?)
0x027076 (bytes)TODO/UNKNOWN
0x02bc32 (char array)Name of this race?
0x02dc53 (bytes)TODO/UNKNOWN
0x03111 (byte)Unknown, but this field is almost always the same as the "Race" field which occurs 5 bytes later
0x03121 (byte)"Team" type (see TEAM.IDS). This field and the next several require some explanation. It seems probable, due to the similar layout of these fields, that this is actually an object identifier. For reference, see the script compiler manual, but in short, it means that it has EA, GENERAL, RACE, CLASS, and SPECIFIC, among other things. This data could be used to explain the other unused fields. The only difficulty with this theory is that the byte which is currently listed as "gender" would normally be 'special case' according to the script compiler manual. On the other hand, the script compiler manual is poorly written and inaccurate in places, probably the result of a quick edit of an internal specification which was hacked into a public document.
0x03131 (byte)"Faction" type (see FACTION.IDS).
0x03141 (byte)"Enemy-Ally" type (see EA.IDS).
0x03151 (byte)"General" type (see GENERAL.IDS).
0x03161 (byte)"Race" type (see RACE.IDS).
0x03171 (byte)"Class" type (see CLASS.IDS).
0x03181 (byte)"Specific" type (see SPECIFIC.IDS).
0x03191 (byte)"Gender" type (see GENDER.IDS).
0x031a5 (bytes)unknown; however, see description at "Team" type byte above. If this is, in fact, an object id, then this here would be the 5 bytes which are used for functional specification of an object (see OBJECT.IDS). Functional specification of an object involves things like LastAttackerOf(Myself) or ProtectorOf(LastTalkedToBy(Protagonist)).
0x031f1 (byte)"Alignment" type (see ALIGNMEN.IDS.
0x03202 (word)unknown. This field and the next appear to hold two 16-bit words, both of which are usually 0xffff.
0x03222 (word)unknown
0x032432 (char array)This field determines the name of the "death variable" to set when this creature has been killed.
0x03444 (dword)Known spells offset
0x03484 (dword)Known spells count
0x034c4 (dword)Spell memorization info offset
0x03504 (dword)Spell memorization info entries count
0x03544 (dword)Memorized spells offset
0x03584 (dword)Memorized spells count
0x035c4 (dword)Item slots offset
0x03604 (dword)Items offset
0x03644 (dword)Items count
0x03684 (dword)effects offset (i.e. effects currently affecting character)
0x036c4 (dword)effects count (i.e. effects currently affecting character)
0x03708 (resref)associated dialog file. (A CRE can have a default DLG file associated. This can be overridden in the ARE file, and I think can also be overridden by a script).

CRE V1.2 Known Spells

This section details which spells the creature knows, and it consists of an array of entries formatted as follows.

OffsetSize (datatype)Description
0x00008 (resref)Resource name of the SPL file holding the particular spell
0x00082 (word)Level of the spell (less 1)
0x000a2 (word)Type of the spell (0=Priest, 1=Wizard, 2=Innate, other values? This doesn't appear in any of the IDS files, to my knowledge)

CRE V1.2 Spell Memorization Info

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.

OffsetSize (datatype)Description
0x00002 (word)Spell level (less 1)
0x00022 (word)Number of spells memorizable
0x00042 (word)Number of spells memorizable (how does this differ from the field at 2?)
0x00062 (word)Spell type (as above in Known Spells, 0=Priest, 1=Wizard, 2=Innate, other values are either unknown or invalid).
0x00084 (dword)Index into memorized spells array of first memorized spell of this type in this level.
0x000c4 (dword)Count of memorized spell entries in memorized spells array of memorized spells of this type in this level.

CRE V1.2 Memorized Spells Table

This section details which spells the character has memorized. It consists of an array of entries formatted as follows.

OffsetSize (datatype)Description
0x00008 (resref)Resource name of the SPL file holding the particular memorized spell
0x00084 (dword)Unknown; likely, it is set to 1 when the spell is memorized, and set to 0 once the spell has been cast. In this way, it keeps track of which spells are scheduled to be memorized when the CRE next sleeps.

CRE V1.2 Items Table

This section details which items the character has. It consists of an array of entries formatted as follows.

OffsetSize (datatype)Description
0x00008 (resref)Resource name of the ITM file holding the particular item
0x00082 (word)unknown
0x000a2 (word)"usage1" -- typically, the count of the item, or the number of uses remaining in the item if it is not a "stackable" item.
0x000a2 (word)"usage2" -- the second parameter passed when the script function "CreateItem" is called. This might only be used for wands and other magical items which have multiple uses (i.e. cast fireball n times and aganazzar's scorcher m times)
0x000c2 (word)"usage3" -- the third parameter passed when the script function "CreateItem" is called. Presumably like 'usage2'.
0x00104 (dword)Flags:
  • bit 0: identified
  • other bits: to fill in later

CRE V1.2 Item Slots

This is an array keeping track of which items are located in each particular location in the CRE's inventory. There are 38 slots, and they are NOT the same as the order specified in specified in SLOTS.IDS. I will update with the actual order ASAP. Each entry in here will either be 0xffff, meaning "empty", or it will be an index into the Items table.

CRE V9.0

Overall structure

CRE V9.0 Header

OffsetSize (datatype)Description
0x00004 (char array)Signature ('CRE ')
0x00044 (char array)Version ('V9.0')
0x00084 (Strref)Long Creature name
0x000c4 (Strref)Short Creature name (used for tooltips)
0x00104 (dword)unknown
0x00144 (dword)experience value (i.e. value in XP for killing this creature)
0x00184 (dword)experience
0x001c4 (dword)gold
0x00204 (dword)(permanent) status flags (as per STATE.IDS). This varies from game to game, but includes such things as invisibility, charmed, silenced, and draw-upon-holy-might.
0x00242 (word)Current hit points
0x00262 (word)Max hit points
0x00282 (word)Animation ID (as from ANIMATE.IDS). Note that while there is some structure to the ordering of these, it is actually worked out via a sort of tangled routine which sorts into major categories based on the high nybble. In Baldur's Gate, the way BAM files (for display on the overland screen) are mapped to CRE files is via this field; the resource names which are mapped to by ANIMATE ids are hard-coded in the executable. Yuck.
0x002a2 (word)unknown
0x002c1 (byte)metal color index
0x002d1 (byte)minor color index
0x002e1 (byte)major color index
0x002f1 (byte)skin color index
0x00301 (byte)leather color index
0x00311 (byte)armor color index
0x00321 (byte)hair color index
0x00331 (byte)flag: if 0, the effect structures attached to this CRE file are old style effects; if 1, the effect structures are as in the EFF V2.0 format, for which we have no information at present.
0x00348 (resref)resource name for the 'small portrait' associated with this CRE, if any (i.e. small portrait as customizable for each character in the game options)
0x003c8 (resref)resource name for the 'large portrait' associated with this CRE, if any (i.e. large portrait as customizable for each character in the game options)
0x00441 (byte)reputation (minimum value: 0)
0x00451 (byte)unknown
0x00462 (signed word)armor class (natural?)
0x00482 (signed word)armor class (effective?)
0x004a2 (signed word)armor class (crushing attacks modifier)
0x004c2 (signed word)armor class (missile attacks modifier)
0x004e2 (signed word)armor class (piercing attacks modifier)
0x00502 (signed word)armor class (slashing attacks modifier)
0x00521 (byte)THAC0 (1-25)
0x00531 (byte)number of attacks (0-10)
0x00541 (byte)save versus death (0-20)
0x00551 (byte)save versus wands (0-20)
0x00561 (byte)save versus poly (0-20)
0x00571 (byte)save versus breath (0-20)
0x00581 (byte)save versus spell (0-20)
0x00591 (byte)resist fire (0-100)
0x005a1 (byte)resist cold (0-100)
0x005b1 (byte)resist electricity (0-100)
0x005c1 (byte)resist acid (0-100)
0x005d1 (byte)resist magic (0-100)
0x005e1 (byte)resist magic fire (0-100)
0x005f1 (byte)resist magic cold (0-100)
0x00601 (byte)resist slashing (0-100)
0x00611 (byte)resist crushing (0-100)
0x00621 (byte)resist piercing (0-100)
0x00631 (byte)resist missile (0-100)
0x00641 (byte)unknown
0x00651 (byte)unknown
0x00661 (byte)lore skill (0-100)
0x00671 (byte)lockpicking skill (minimum value: 0)
0x00681 (byte)stealth skill (minimum value: 0)
0x00691 (byte)traps skill (minimum value: 0)
0x006a1 (byte)pick-pockets skill (minimum value: 0)
0x006b1 (byte)fatigue (0-100)
0x006c1 (byte)intoxification (0-100)
0x006d1 (byte)luck
0x006e1 (byte)Large swords proficiency (It is rumored that proficiencies are packed in 3-bit chunks for the primary and secondary classes -- i.e. primary class proficiency is the low 3 bits, secondary is the middle 3 bits. This may be true.)
0x006f1 (byte)Small swords proficiency (It is rumored that proficiencies are packed in 3-bit chunks for the primary and secondary classes -- i.e. primary class proficiency is the low 3 bits, secondary is the middle 3 bits. This may be true.)
0x00701 (byte)Bows proficiency (It is rumored that proficiencies are packed in 3-bit chunks for the primary and secondary classes -- i.e. primary class proficiency is the low 3 bits, secondary is the middle 3 bits. This may be true.)
0x00711 (byte)Spears proficiency (It is rumored that proficiencies are packed in 3-bit chunks for the primary and secondary classes -- i.e. primary class proficiency is the low 3 bits, secondary is the middle 3 bits. This may be true.)
0x00721 (byte)Axes proficiency (It is rumored that proficiencies are packed in 3-bit chunks for the primary and secondary classes -- i.e. primary class proficiency is the low 3 bits, secondary is the middle 3 bits. This may be true.)
0x00731 (byte)Missile weapons proficiency (It is rumored that proficiencies are packed in 3-bit chunks for the primary and secondary classes -- i.e. primary class proficiency is the low 3 bits, secondary is the middle 3 bits. This may be true.)
0x00741 (byte)Great swords proficiency (It is rumored that proficiencies are packed in 3-bit chunks for the primary and secondary classes -- i.e. primary class proficiency is the low 3 bits, secondary is the middle 3 bits. This may be true.)
0x00751 (byte)Daggers proficiency (It is rumored that proficiencies are packed in 3-bit chunks for the primary and secondary classes -- i.e. primary class proficiency is the low 3 bits, secondary is the middle 3 bits. This may be true.)
0x00761 (byte)Halberds proficiency (It is rumored that proficiencies are packed in 3-bit chunks for the primary and secondary classes -- i.e. primary class proficiency is the low 3 bits, secondary is the middle 3 bits. This may be true.)
0x00771 (byte)Maces proficiency (It is rumored that proficiencies are packed in 3-bit chunks for the primary and secondary classes -- i.e. primary class proficiency is the low 3 bits, secondary is the middle 3 bits. This may be true.)
0x00781 (byte)Flails proficiency (It is rumored that proficiencies are packed in 3-bit chunks for the primary and secondary classes -- i.e. primary class proficiency is the low 3 bits, secondary is the middle 3 bits. This may be true.)
0x00791 (byte)Hammers proficiency (It is rumored that proficiencies are packed in 3-bit chunks for the primary and secondary classes -- i.e. primary class proficiency is the low 3 bits, secondary is the middle 3 bits. This may be true.)
0x007a1 (byte)Clubs proficiency (It is rumored that proficiencies are packed in 3-bit chunks for the primary and secondary classes -- i.e. primary class proficiency is the low 3 bits, secondary is the middle 3 bits. This may be true.)
0x007b1 (byte)Quarterstaves proficiency (It is rumored that proficiencies are packed in 3-bit chunks for the primary and secondary classes -- i.e. primary class proficiency is the low 3 bits, secondary is the middle 3 bits. This may be true.)
0x007c1 (byte)Crossbow proficiency (It is rumored that proficiencies are packed in 3-bit chunks for the primary and secondary classes -- i.e. primary class proficiency is the low 3 bits, secondary is the middle 3 bits. This may be true.)
0x007d6 (bytes)Unknown
0x00831 (byte)tracking skill (0-100)
0x008432 (bytes)unknown
0x00a44*100 (Strref*100)Strrefs which relate to the character. Most of them relate to the sound-set. In the file SOUNDOFF.IDS, there are several numbers. These indicate indices into this array, and they match various occurrences to Strrefs. For instance, SOUNDOFF.IDS has "SELECT_RARE", at index 35. SELECT_RARE actually takes up 4 entries -- the next numbered entry is at 39. So the 35th through the 39th entries in this are the "select rare" entries, which, it turns out, correspond to the amusing sound-bites you get if you repeatedly click on a character. A character's biography appears to be stored in the 74th entry in this array. What any other entries may be used for is unknown, although I suspect it varies from character to character, judging from the label "MISC" that is applied around entry #58. Presumably the rest of the entries are just for miscellaneous purposes which only apply to certain characters.
0x02341 (byte)Highest attained level in primary class (0-100)
0x02351 (byte)Highest attained level in secondary class (0-100)
0x02361 (byte)Highest attained level in tertiary class (0-100)
0x02371 (byte)unknown (level in quaternary class? probably not...)
0x02381 (byte)Strength (1-25)
0x02391 (byte)Strength % Bonus (0-100)
0x023a1 (byte)Intelligence (1-25)
0x023b1 (byte)Wisdom (1-25)
0x023c1 (byte)Dexterity (1-25)
0x023d1 (byte)Constitution (1-25)
0x023e1 (byte)Charisma (1-25)
0x023f1 (byte)Morale
0x02401 (byte)Morale break
0x02411 (byte)Racial enemy (see RACE.IDS)
0x02421 (byte)Morale Recovery Time
0x02433 (bytes)unknown
0x02462 (word)mage type (see MAGETYPE.IDS)
0x02488 (resref)creature script ("override" script?)
0x02508 (resref)creature script ("class" script?)
0x02588 (resref)creature script ("race" script?)
0x02608 (resref)creature script ("general" script?)
0x02688 (resref)creature script ("default" script?)
0x0270104 (bytes)unknown
0x02d81 (byte)"Enemy-Ally" type (see EA.IDS). This field and the next several require some explanation. It seems probable, due to the similar layout of these fields, that this is actually an object identifier. For reference, see the script compiler manual, but in short, it means that it has EA, GENERAL, RACE, CLASS, and SPECIFIC, among other things. This data could be used to explain the other unused fields. The only difficulty with this theory is that the byte which is currently listed as "gender" would normally be 'special case' according to the script compiler manual. On the other hand, the script compiler manual is poorly written and inaccurate in places, probably the result of a quick edit of an internal specification which was hacked into a public document.
0x02d91 (byte)"General" type (see GENERAL.IDS).
0x02da1 (byte)"Race" type (see RACE.IDS).
0x02db1 (byte)"Class" type (see CLASS.IDS).
0x02dc1 (byte)"Specific" type (see SPECIFIC.IDS).
0x02dd1 (byte)"Gender" type (see GENDER.IDS).
0x02de5 (bytes)unknown; however, see description at "Enemy-Ally" type byte above. If this is, in fact, an object id, then this here would be the 5 bytes which are used for functional specification of an object (see OBJECT.IDS). Functional specification of an object involves things like LastAttackerOf(Myself) or ProtectorOf(LastTalkedToBy(Protagonist)).
0x02e31 (byte)"Alignment" type (see ALIGNMEN.IDS.)
0x02e42 (word)unknown. This field and the next appear to hold two 16-bit words, both of which are usually 0xffff.
0x02e62 (word)unknown
0x02e832 (char array)This field determines the name of the "death variable" to set when this creature has been killed.
0x03084 (dword)Known spells offset
0x030c4 (dword)Known spells count
0x03104 (dword)Spell memorization info offset
0x03144 (dword)Spell memorization info entries count
0x03184 (dword)Memorized spells offset
0x031c4 (dword)Memorized spells count
0x03204 (dword)Item slots offset
0x03244 (dword)Items offset
0x03284 (dword)Items count
0x032c4 (dword)offset to effects currently affecting creature
0x03304 (dword)count of effects currently affecting creature
0x03348 (resref)associated dialog file. (A CRE can have a default DLG file associated. This can be overridden in the ARE file, and I think can also be overridden by a script).

CRE V9.0 Known Spells

This section details which spells the creature knows, and it consists of an array of entries formatted as follows.

OffsetSize (datatype)Description
0x00008 (resref)Resource name of the SPL file holding the particular spell
0x00082 (word)Level of the spell (less 1)
0x000a2 (word)Type of the spell (0=Priest, 1=Wizard, 2=Innate, other values? This doesn't appear in any of the IDS files, to my knowledge)

CRE V9.0 Spell Memorization Info

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.

OffsetSize (datatype)Description
0x00002 (word)Spell level (less 1)
0x00022 (word)Number of spells memorizable
0x00042 (word)Number of spells memorizable (how does this differ from the field at 2?)
0x00062 (word)Spell type (as above in Known Spells, 0=Priest, 1=Wizard, 2=Innate, other values are either unknown or invalid).
0x00084 (dword)Index into memorized spells array of first memorized spell of this type in this level.
0x000c4 (dword)Count of memorized spell entries in memorized spells array of memorized spells of this type in this level.

CRE V9.0 Memorized Spells Table

This section details which spells the character has memorized. It consists of an array of entries formatted as follows.

OffsetSize (datatype)Description
0x00008 (resref)Resource name of the SPL file holding the particular memorized spell
0x00084 (dword)Unknown; likely, it is set to 1 when the spell is memorized, and set to 0 once the spell has been cast. In this way, it keeps track of which spells are scheduled to be memorized when the CRE next sleeps.

CRE V9.0 Items Table

This section details which items the character has. It consists of an array of entries formatted as follows.

OffsetSize (datatype)Description
0x00008 (resref)Resource name of the ITM file holding the particular item
0x00082 (word)unknown
0x000a2 (word)"usage1" -- typically, the count of the item, or the number of uses remaining in the item if it is not a "stackable" item.
0x000a2 (word)"usage2" -- the second parameter passed when the script function "CreateItem" is called. This might only be used for wands and other magical items which have multiple uses (i.e. cast fireball n times and aganazzar's scorcher m times)
0x000c2 (word)"usage3" -- the third parameter passed when the script function "CreateItem" is called. Presumably like 'usage2'.
0x000e4 (dword)Flags:
  • bit 0: identified
  • other bits: to fill in later

CRE V9.0 Item Slots

This is an array keeping track of which items are located in each particular location in the CRE's inventory. There are 38 slots, and they are NOT the same as the order specified in specified in SLOTS.IDS. I will update with the actual order ASAP. Each entry in here will either be 0xffff, meaning "empty", or it will be an index into the Items table.

[ back to index ]