Item state flags
ItemRuntimeFlags · 1 byte, offset 2 of ItemRuntime
Items · The engine in ten minutes
Every item in play carries a flag byte. One bit marks the item as identified, which makes the game use the item's identified name; others mark weapons conjured by spells, cursed items and magical items.1 For a wand, the six low bits hold its charges instead.
That 0x20 marks a cursed item is inferred from Remove Curse and from
the refusals it causes. No code tests bits 0x01 to 0x04 except as the charges of a wand, so
they have no effect on other items; in the original
ITEM.DAT only wands have them.
typedef enum ItemRuntimeFlags {
ITEM_RUNTIME_WAND_CHARGES_MASK = 0x3f, /* Wands only: the number of charges, overlapping the next three bits. */
ITEM_RUNTIME_DRAINS_HIT_POINTS = 0x08, /* A hit gives the wielder as many hit points as it deals (Vampiric Touch). */
ITEM_RUNTIME_VANISHES_AFTER_HIT = 0x10, /* The item leaves the hand after a hit that deals damage (Shocking Grasp). */
ITEM_RUNTIME_CURSED = 0x20, /* Cannot leave a hand; cleared by Remove Curse; set on every conjured weapon; the name is inferred. */
ITEM_RUNTIME_IDENTIFIED = 0x40, /* Set when the item is identified; selects its second (identified) name. */
ITEM_RUNTIME_MAGICAL = 0x80 /* Drawn with other colours in the hand while the party has SPELL_EFFECT_DETECT_MAGIC. */
} ItemRuntimeFlags;
Where it is used
- Identify items sets the bit on items; see scripted identification.
- Create an item can overwrite the whole byte; see item creation overrides.
- Item properties in conditions can test an item's identified or unidentified name.
- A weapon hit applies
ITEM_RUNTIME_DRAINS_HIT_POINTSandITEM_RUNTIME_VANISHES_AFTER_HIT; the conjured weapons of Vampiric Touch get both, that of Shocking Grasp the second; see using a weapon. - A hand item with
ITEM_RUNTIME_CURSEDcannot be taken out, replaced or dropped and thrown with the keyboard; see moving and equipping items. - A wand loses a charge,
ITEM_RUNTIME_WAND_CHARGES_MASK, each time it is used and disappears with its last one; see wands. - The pointer shows an item with
ITEM_RUNTIME_MAGICALin other colours while the party hasSPELL_EFFECT_DETECT_MAGIC. - Improved Identify sets
ITEM_RUNTIME_IDENTIFIEDon the caster's hand items, and Remove Curse clearsITEM_RUNTIME_CURSEDand setsITEM_RUNTIME_IDENTIFIED; see what each spell does.
Values in the original file
The values of the whole byte in the 434 records of the original ITEM.DAT are listed with the kinds, slots and records.
Sources
Locations refer to the game executable reference.