Using items
Items · Potions, scrolls and wands · ItemKind
In brief
A character uses the item in one of its hands. The character must be able to act, the hand usable and the item allowed to its class; the item's kind then decides what happens: an attack, a spell, a potion, a text, food, a sound, or nothing. Whatever the kind, the block in front of the party then receives an item-used event, which level scripts can test.
What each kind does
Which level scripts react to an item being used is described with the level scripts, not here.
A character uses the item in one of its hands by clicking that hand on its portrait with the other mouse button than the one that exchanges items (inferred), or with the keyboard. Nothing happens unless the character is present, conscious and neither paralyzed nor petrified, and unless the hand can be used: a hand recovering from its last use waits for its recovery timer, and a hand whose item the character's class may not use is refused, without a message. An empty hand counts as a melee weapon and attacks with the fist.1
What happens then depends on the item's ItemKind:
| Kind | Using it | Item afterwards |
|---|---|---|
ITEM_KIND_WORN, ITEM_KIND_RING | "This item automatically used when worn." | Kept |
ITEM_KIND_MELEE, ITEM_KIND_THROWN, ITEM_KIND_LAUNCHER | An attack; see using a weapon and throwing. | Kept, or thrown |
ITEM_KIND_MISC, ITEM_KIND_BONES, ITEM_KIND_STONE, ITEM_KIND_KEY, ITEM_KIND_GEM | "This item is not used in this way." | Kept |
ITEM_KIND_SPELLBOOK, ITEM_KIND_HOLY_SYMBOL | Opens the mage or the cleric spell book, at the entry the character last used. | Kept |
ITEM_KIND_FOOD | Eaten, in keyboard control only; see food. | Eaten |
ITEM_KIND_MAGE_SCROLL, ITEM_KIND_CLERIC_SCROLL | Casts the spell whose definition number is the item's value. | Used up |
ITEM_KIND_TEXT | Shows a text, or a part of the map. | Kept |
ITEM_KIND_POTION | The value selects the potion. | Used up |
ITEM_KIND_WAND | Casts the wand's spell. | One charge used |
ITEM_KIND_HORN | A sound and a message that depend on its value. | Kept |
ITEM_KIND_LIFE_DEATH_AMULET | Value 1 deals 200 points of damage to the user; any other value casts Raise Dead. | Used up |
ITEM_KIND_UNKNOWN_17 and values above 20 | Nothing. | Kept |
None of these uses requires the item to be identified. Whatever the kind,
the game then sends BLOCK_EVENT_ITEM_USED to the block in front of the
party, so a level script can react.
The only exception is a melee weapon used by a character who stands in the
back rows. In the original levels, 62 blocks of levels 1, 2, 5, 6, 7, 8, 9,
11, 12 and 13 react to this event. Most of them test that the item used is
of ITEM_KIND_MELEE — a weapon or the empty hand striking a wall; level 5
tests the horns, by their value, and level 6 the Crystal Hammer. Keys, gems,
stones, bones, lock picks and the other objects that open walls are not
used this way: the scripts test them as the
held item
when the player clicks the wall that holds them.2
While a character's inventory page is open, weapons, spell books, scrolls and
wands do nothing, but the event is still sent and a hand's recovery is not
checked.1
Food and other uses
- Food. Only rations are eaten: "You may only eat food!" otherwise. A ration adds its value to the character's food, up to 100, and is used up; rotten food, of value −1, is refused with "That food is rotten! You don't want to eat that!". The character must be present and conscious. Using a ration from a hand eats it only in keyboard control; with the mouse, the item carried on the pointer is eaten by clicking the plate icon of the inventory page.3
- Spell books. The spellbook opens the mage book, a holy symbol the cleric book, on the entry the character last selected, or on the first ready spell of that page; see casting a spell.4
- Parchments and tomes. A value of 0 or more shows text value + 1 of
TEXT.DATin the dialogue window; −1, −2 and −3 show one of three parts of the map imageMAP.CPS.5 The parchments of the game are listed with their values. - Horn. Values 1 to 4 print one of four messages (bellowing, hollow, melodious, eerie) and play one of four sounds; the level scripts react to the item-used event.6 The horns of the game have these values.
The value of a horn, potion, wand or parchment is used as an index without any check. A horn of value 0 or above 4, a potion of value 8 or more, a wand of value 8 or more or a parchment below −3 reads its message, sound, spell or map entry past the end of its table, and a wand with no charge left whose value is neither 0 nor 5 has its whole flag byte decremented. In the original data only template 44, a horn of value 0, has such a value, and no script or monster copies it; no item that the original scripts create has one. A faithful reimplementation reproduces the same reads only if it supports such data.
Sources
Locations refer to the game executable reference; comparative sources are listed in the technical references.