--- title: "ITM file format" regenerate: true --- {% include relurl.html %}
ITM file format

Applies to:
BG1, BG1: TotS, BG2, BG2: ToB, IWD, IWD:HoW, IWD:TotL, BGEE

General Description
This file format describes an "item". Items include weapons, armor, books, scrolls, rings and more. Items can have attached abilties, occuring either when a target creature it hit, or when the item is equipped. ITM files have a similar structure to SPL files.

Header: Size = 114 Bytes Ext. Header: Size = 56 Bytes Feature Block: Size = 48 Bytes

Detailed Description
ITM files consist of a main header, zero or more extended headers (each containing zero or more feature blocks) and zero or more casting feature blocks. All the feature blocks are stored as a continuous data segment, with each extended header containing an offset into this data, and the main header containing an offset into this data for the casting feature blocks.
NB. A creature must meet the minimum stat requirements to be able to converse with an item.

Overall structure:

{% assign offset_header_name = "itmv1_Header" %} {% assign offset_header_display_name = "Header" %} {% assign offsets = site.data.file_formats.itm_v1.header %} {% include offset_table.html %} {% assign offset_header_name = "itmv1_Extended_Header" %} {% assign offset_header_display_name = "Extended Header" %} {% assign offset_header_desc = "Items can have several "abilities" that correspond to an action the item can do (e.g. melee attacks, projectile attacks, spell-casting etc.). Each of these abilities is specified through an extended header. Only the first three extended headers can have charges (extended headers further than this use the charges of the first extended header). Tooltips for item abilities are set through TOOLTIP.2DA.

NB. For items to be stackable, they must contain at least one extension header, even if it is empty.
NB. For an attack type of projectile, if the projectile type is set to 1,2 or 3, the weapon will use the attack speed of the ammunition." %} {% assign offsets = site.data.file_formats.itm_v1.extended_header %} {% include offset_table.html %} {% assign offset_header_name = "itmv1_Feature_Block" %} {% assign offset_header_display_name = "Feature Block" %} {% assign offset_header_desc = "Any action carried out by an item is done by feature blocks, each of which holds an effect number as well as targetting and timing information. The engine appears to roll a probability for each valid target type, rather than one probability per attack." %} {% assign offsets = site.data.file_formats.itm_v1.feature_block %} {% include offset_table.html %}

Header Flags

Bit Byte 1 Byte 2 Byte 3 Byte 4
0 Unsellable (critical item)
  • In BG1 and IWD, this flag does not affect whether the item can be sold or disintegrated. See BIT11 instead.
  • On EE games, Stores can buy critical items if they are flagged as Can buy Critical, provided they can buy its itemtype.
  • Will also cause the item to be moved into Player1's Inventory if the character who has it leaves the party on their own.
Silver
  • Determines how the weapon interacts with opcode #120.
Unused Undispellable
1 Two-handed
  • Forces Two-handed weapon style and attack animation.
  • Disables off-hand: attacks and equipped effects.
Cold iron
  • Determines how the weapon interacts with opcode #120.
Unused Toggle critical hit aversion (BGEE, TobEx)
  • Keep in mind that if you set this bit to 1 for an ITM whose Item type is Headgear, then you'll toggle off the Critical hit aversion.
2 Movable / Droppable Stolen (unsellable) / Off-handed
  • Set offhand animations for 0x5###-0x6### animId series (excluding 0x64##) when weapon placed in offhand.
  • Forces Dual-Wield animation (overrides BIT1).
Unused Unused
3 Displayable
  • Item will show up on the ground (when dropped). Setting the Ground Icon to "" (empty) still uses a default icon, this gets around that. It can still be clicked on and picked up.
  • The default icon if the Ground Icon is "" (empty) is a small bag "GSACK01.BAM", the icon without the Displayable flag is a 1x1 invisible pixel.
Conversable / unsellable
  • In BG1 and IWD, this flag prevents the item from being sold and is not about dialogs. This includes placement into a bag of holding.
  • Dialog can be initiated with the weapon through right-clicking in the Inventory.
  • Item needs to be listed in ITEMDIAL.2DA as: (Item ResRef) (Label StrRef) (Dialog ResRef).
    • Label StrRef is the label that will be on the button when right-clicking.
Unused Unused
4 Cursed
  • Determines how the item interacts with opcode #26.
  • The item cannot be unequipped.
  • Cursed weapons override the Magical Weapon slot.
Fake two-handed (BGEE)
  • Forces Two-handed animation.
Unused Unused
5 Cannot scribe to spellbook (scrolls)
  • Whether a scroll can be "Copy Note" to journal or "Write Magic" to spell book is determined by its ability headers. Setting this bit doesn't alter it either way.
  • It doesn't prevent a "clone" from getting a duplicate (opcode #236*p2=2).
  • It doesn't prevent the CopyGroundPilesTo() action from moving them.
  • In original BG1, it was set on every item except for the Identify Scroll.
  • In BGEE/SoD, only a few (16) random items added by Beamdog don't have it set, as well as the Identify and Chromatic Orb scrolls.
Forbid off-hand weapon (BGEE)
  • Disables Two-Weapon Style.
  • Does not disable off-hand equipped effects.
  • In Magical Weapon Slot: Disables off-hand (Attacks only).
Unused Unused
6 Magical
  • Determines how the weapon interacts with opcode #120.
  • Has no relation to the Enchantment field. Both function independently.
Usable in inventory (PSTEE) Unused Unused
7 Left-handed
  • Disables off-hand: attacks and equipped effects.
  • Disables Two-Weapon Style (Inventory display is incorrect though).
Adamantine (BGEE) Unused Unused
{% include item_types.html %}
Header Usability

Bit Byte 1 Byte 2 Byte 3 Byte 4
0 Chaotic... Cleric/Mage Fighter/Mage/Thief Dwarf
1 ...Evil Cleric/Thief Fighter/Thief Half-Elf
2 ...Good Cleric/Ranger Mage Halfling
3 ...Neutral Fighter Mage/Thief Human
4 Lawful... Fighter/Druid Paladin Gnome
5 Neutral... Fighter/Mage Ranger Monk
6 Bard Fighter/Cleric Thief Druid
7 Cleric Fighter/Mage/Cleric Elf Half-Orc

Note: PSTEE uses ITM V1.1 usability flags.

Header Animation

Value(ASCII) Value(Hex) Description
" " 2020h <none>
"2A" 3241h Leather Armor
"3A" 3341h Chainmail
"4A" 3441h Plate Mail
"2W" 3257h Robe
"3W" 3357h Robe
"4W" 3457h Robe
"AX" 4158h Axe
"BW" 4257h Bow
"CB" 4342h Crossbow
"CL" 434Ch Club
"D1" 4431h Buckler
"D2" 4432h Shield (Small)
"D3" 4433h Shield (Medium)
"D4" 4434h Shield (Large)
"DD" 4444h Dagger
"FL" 464Ch Flail
"FS" 4653h Flame Sword
"H0" 4830h Small Vertical Horns
"H1" 4831h Large Horizontal Horns
"H2" 4832h Feather Wings
"H3" 4833h Top Plume
"H4" 4834h Dragon Wings
"H5" 4835h Feather Sideburns
"H6" 4836h Large Curved Horns (incorrect paperdoll image)
"HB" 4842h Halberd
"MC" 4D43h Mace
"MS" 4D53h Morning Star
"QS" 5153h Quarter Staff (Metal)
"S1" 5331h Sword 1-Handed
"S2" 5332h Sword 2-Handed
"SL" 534Ch Sling
"SP" 5350h Spear
"SS" 5353h Short Sword
"WH" 5748h War Hammer
"S3" 5333h Katana #
"SC" 5343h Scimitar #

Header Kit Usability

Bit Byte 1 Byte 2 Byte 3 Byte 4
0 Cleric of Talos Stalker Ranger Diviner Beserker Fighter
1 Cleric of Helm Beastmaster Ranger Enchanter Wizardslayer Fighter
2 Cleric of Lathlander Assassin Thief Illusionist Kensai Fighter
3 Totemic Druid Bounty Hunter Thief Invoker Cavalier Paladin
4 Shapeshifter Druid Swashbuckler Thief Necromancer Inquisiter Paladin
5 Avenger Druid Blade Bard Transmuter Undead Hunter Paladin
6 Barbarian Jester Bard All (no kit) Abjurer
7 Wildmage Skald Bard Ferlain Conjurer

Header Proficiency

Value (hex) Description
00h None
59h Bastard Sword
5Ah Long Sword
5Bh Short Sword
5Ch Axe
5Dh Two-Handed Sword
5Eh Katana
5Fh Scimitar/Wakizashi/Ninja-To
60h Dagger
61h War Hammer
62h Spear
63h Halberd
64h Flail/Morningstar
65h Mace
66h Quarterstaff
67h Crossbow
68h Long Bow
69h Short Bow
6Ah Darts
6Bh Sling
6Ch Blackjack
6Dh Gun
6Eh Martial Arts
6Fh Two-Handed Weapon Skill
70h Sword and Shield Skill
71h Single Weapon Skill
72h Two Weapon skill
73h Club
74h Extra Proficiency 2
75h Extra Proficiency 3
76h Extra Proficiency 4
77h Extra Proficiency 5
78h Extra Proficiency 6
79h Extra Proficiency 7
7Ah Extra Proficiency 8
7Bh Extra Proficiency 9
7Ch Extra Proficiency 10
7Dh Extra Proficiency 11
7Eh Extra Proficiency 12
7Fh Extra Proficiency 13
80h Extra Proficiency 14
81h Extra Proficiency 15
82h Extra Proficiency 16
83h Extra Proficiency 17
84h Extra Proficiency 18
85h Extra Proficiency 19
86h Extra Proficiency 20

Extended Header MeleeAnimation

Value Word 1 Value Word 2 Value Word 3 Data
00h 14h 50h Dagger
0Ah 19h 41h Short Sword
32h 32h 00h Long Sword, Bastard Sword, Scimitar, Battle Axe, Warhammer, Club, Mace, Flail, Morning Star
3Ch 28h 00h Two-Handed Sword
00h 23h 41h Halberd
00h 00h 64h Spear
0Ah 46h 14h Staff
00h 00h 00h Any Missile Weapon (Bow, Arrow, CrossBow, Bolt, Sling, Bullet, Throwing Axe, Dart, Throwing Dagger, etc.)
22h 21h 21h Any Non-Weapon Item (Amulets, Rings, Wands, etc.)

Extension Header Flags

Bit Byte 1 Byte 2 Byte 3 Byte 4
0 Add strength bonus Unknown Unknown Unknown
1 Breakable Breaks Sanctuary / Invisibility (EE games) Unknown ToBEx: Toggle backstab
2 Damage strength bonus (BGEE split bit 0) Hostile Unknown EE/ToBEx: Cannot target invisible
3 THAC0 strength bonus (BGEE split bit 0) Recharge after resting Unknown Unknown
4 Unknown Unknown Unknown Unknown
5 Unknown Unknown Unknown Unknown
6 Unknown Unknown Unknown Unknown
7 Unknown Unknown Unknown Unknown