Skip to main content

Transfer: spells and items

The party · Transferring a party · ItemType

In brief​

A transferred character keeps no spell slot. Its known mage spells, and the values of its scrolls, go through a conversion table that drops some spells. Each item is converted on its own: a filter by type drops keys, gems, quest items and other types, the value is adjusted for scrolls, potions and wands, and the item takes the names of a matching item of this game. Five anomalies of the conversion are recorded on this page.

How an item of a transferred character is converted. If its type does not pass the filter, it is dropped. Otherwise a copy of item 1 takes the flags, icon, type and value of the old item; the value is converted for scrolls, potions and wands; if an item of this game matches it, the item is carried with that item's names; if none does, a matching failure message is shown and the item is dropped.
An item survives the transfer only if its type passes the filter and it matches an item of this game.

Spells​

The spell names are those of this game's mage and cleric spells; which spells the numbers denoted in the first game is not established here.

The transferred characters keep no spell slot: a caster must memorize or pray and rest before casting, and a cleric or paladin gets Turn undead only when the pray menu writes it. The known mage spells and the scrolls go through one table: a number of 0 means the spell is dropped, from the mask or with its scroll.1

for i in 0 .. 24:
if bit i of the old known-spell mask is set:
n = table[i + 1]
if n != 0: set bit n - 1 of known_mage_spells
Number readKnown mage spell or mage scrollCleric scroll
1ArmorBless
2Burning HandsCure Light Wnds
3Detect MagicCause Light Wnds
4Magic MissileDetect Magic
5droppedProtect-Evil
6ShieldAid
7Shocking GraspFlame Blade
8InvisibilityHold Person
9droppedSlow Poison
10M's Acid ArrowCreate Food
11droppedDispel Magic
12Dispel MagicMagical Vestment
13FireballPrayer
14droppedRemove Paralysis
15HasteCure Serious
16Hold PersonCause Serious
17Invisibility 10'Neutral-Poison
18Lightning BoltProtect-Evil 10'
19Vampiric Touchdropped
20FearCure Critical
21Ice StormCause Critical
22droppedFlame Strike
23droppedRaise Dead
24Cone of Colddropped
25Hold Monsterdropped

A mage scroll's value n reads entry n of the table, a cleric scroll's value n entry n + 25; the result is the scroll's new value, the definition number of the spell. The table has 64 entries and the index is not checked.

Items​

The item table the conversion searches is the initial ITEM.DAT, which the game loads before showing the start menu.

Each item of the four characters is converted on its own; the quiver's items are converted one by one along the old chain and put back in the quiver. An item that is not converted leaves its slot empty:2

convert(old):
if old.type has 0 in the transfer filter: drop
new = copy of item 1 of the item table
new.flags = old.flags | ITEM_RUNTIME_IDENTIFIED
new.icon, new.type = old.icon, old.type
new.value = old.value, except:
ITEM_TYPE_MAGE_SCROLL: table[old.value] (0: drop)
ITEM_TYPE_CLERIC_SCROLL: table[old.value + 25] (0: drop)
ITEM_TYPE_POTION: old.value - 1
ITEM_TYPE_WAND: value 5: drop; else new.flags = (old.flags & 0x3f) + 3
ITEM_TYPE_ROCK: new.icon = 19
if the item kind is ITEM_KIND_MELEE, ITEM_KIND_THROWN or ITEM_KIND_LAUNCHER
and new.value != 0, or ITEM_KIND_SPELLBOOK, ITEM_KIND_HOLY_SYMBOL,
ITEM_KIND_MAGE_SCROLL, ITEM_KIND_CLERIC_SCROLL, ITEM_KIND_POTION,
ITEM_KIND_RING or ITEM_KIND_WAND:
new.flags |= ITEM_RUNTIME_MAGICAL
names = those of the first item 1-599 of the item table, except 60, 62,
63 and 83, of level 0 and not in a quiver, with the same type and
icon; else with the same type
if none: show "Item conversion matching failure" with the type, icon,
value and flags; drop
new is carried: level 0

The type number is kept and read with this game's item types. The filter keeps types 0, 1, 2, 4, 5, 7, 9 to 16, 18 to 22, 24, 25, 27 to 32, 34, 35, 39, 41 to 44, 47, 48 and 50: in this game's item table these are weapons and ammunition, armour, shields, helmets, bracers and boots, lock picks, spell books and holy symbols, rations, scrolls, potions, robes and cloaks, amulets and necklaces, rings and wands. Among the types it drops are those of keys, gems, stone items, quest items, parchments and tomes, bones, skulls and femurs, the horn, the trident, the two-handed sword and the spell sphere. The item's name in the first game is not read: the converted item takes the two names of a matching item of this game and, being marked identified, shows the second one. A potion of value 0 would become −1, which no potion has; nothing checks the converted values.

Khelben's Coin keeps its template value, 4. When no character has an empty backpack slot, the coin replaces the item in slot 2 of the first character; see the anomaly.

Anomalies of the transfer​

Anomaly

ANOMALY-74 — A transferred wand is not identified. Every converted item receives ITEM_RUNTIME_IDENTIFIED, but for a wand the conversion then replaces the whole flag byte with the old charge count plus three, which drops that bit (it keeps ITEM_RUNTIME_MAGICAL, added afterwards). The wand therefore shows its unidentified name until it is identified in play. The sum is not limited to six bits either: an old count of 61 to 63 sets the identified bit and leaves 0 to 2 charges. A faithful reimplementation writes (old flags & 0x3f) + 3, then the magical bit.2

Anomaly

ANOMALY-75 — The transfer filter keeps item type 4, but the item table the conversion searches has no item of type 4. Such an item, if a transferred inventory held one, would always fail both name searches: the game would show its "Item conversion matching failure" message with the item's numbers and delete it. A faithful reimplementation keeps the filter and the message.2

Anomaly

ANOMALY-76 — When none of the four characters has an empty backpack slot, the game empties slot 2 of the first character by writing 0 into it and gives Khelben's Coin there. The item that was in that slot is not dropped, deleted or freed: it leaves the party, and its entry of the item table stays in use, carried by no one, whereas the conversion frees the entry of every item it drops. A faithful reimplementation loses that item and, to keep the same free entries, keeps its entry reserved.3

Anomaly

ANOMALY-91 (bug) — The chooser has eight entries, the six characters, CANCEL and OK, and every other rule wraps at eight, but keypad 2 on CANCEL moves to a ninth entry that does not exist; keypad 4 or 6 then moves to a tenth. Choosing either acts as OK. It first flashes a button box beyond the right edge of the screen (x 540 or 808) and, with a mouse, asks for a button label at x 6103 or 11030 whose text is data read past the two-label table. Neither display driver draws any of this: the text routine returns at once for an x of 320 or more, without reading the text, the box's fill is cancelled and its lines lie wholly outside the line clipping rectangle. On screen, with a mouse, the highlight only leaves the CANCEL label. A faithful reimplementation keeps the two extra entries, both acting as OK, and draws nothing for them; one that corrects the bug wraps keypad 2 at eight, as the other rules do.4

Anomaly

ANOMALY-92 — Without a mouse, the transfer screen never shows which character or button is selected, although the keypad moves the selection; the save and load menus show it whatever the input. A faithful reimplementation hides the selection when no mouse is present.4

Sources​

Locations refer to the game executable reference; comparative sources are listed in the technical references. The figures are drawn by make_party_figures.py.

Footnotes​

  1. Convert the characters, convert the items and the spell conversion table. Comparative source: REF-SCUMM-017, TransferPartyWiz::convertStats and convertItem. ↩

  2. Convert the items, with the transfer filter, the failure message, duplicate an item, the item chain insertion and the ITEM.DAT loader run before the start menu. Comparative source: REF-SCUMM-017, TransferPartyWiz::convertInventory and convertItem. ↩ ↩2 ↩3

  3. Transfer a party, called by the start menu, with choose the four characters, clear a character record and give an item, with the screen texts and the questions. Comparative source: REF-SCUMM-017, TransferPartyWiz::start, selectCharactersMenu and giveKhelbensCoin. ↩

  4. Choose the four characters, which proves ANOMALY-91 and ANOMALY-92, with move the selection highlight, find the entry under a click, the box frame highlight, the mouse state, the input queue and the key numbers; for what is drawn, the framed box and the drivers' text, fill and line routines (VGA, EGA; VGA, EGA; VGA, EGA). Comparative source: REF-SCUMM-017, TransferPartyWiz::selectCharactersMenu and updateHighlight. ↩ ↩2