Saving-throw categories
ScriptSavingThrowType · signed byte, sign-extended to 16 bits; fifth damage operand of
Damage characters
Scripts · Saving-throw effects
Scripted damage, such as a trap, can give each character a saving throw. This operand says which kind of saving throw applies, or that there is none. Any value other than "none" is passed to the saving-throw routine as a category index.1
No text of the game names the categories; this page lists where each is used. The thresholds are given under a character's saving throw.
typedef enum ScriptSavingThrowType {
SCRIPT_SAVING_THROW_TYPE_0 = 0, /* Poison: monster melee poison, poison potion. */
SCRIPT_SAVING_THROW_TYPE_1 = 1, /* Monster mind blast and monster explosions. */
SCRIPT_SAVING_THROW_TYPE_2 = 2, /* Paralysis and petrification by a monster's melee attack. */
SCRIPT_SAVING_THROW_TYPE_3 = 3, /* Has a table column; no use found. */
SCRIPT_SAVING_THROW_TYPE_4 = 4, /* Spells and the reference scripts' traps. */
SCRIPT_SAVING_THROW_NONE = 5 /* No saving throw is attempted. */
} ScriptSavingThrowType;
How the saving throw is rolled
When the category is not SCRIPT_SAVING_THROW_NONE, the character rolls
one twenty-sided die, with no modifier, and saves when the roll is at least
a threshold set by its class group, its first level, the category and, for
some races, its constitution; see
a character's saving throw.
On a save, the saving-throw effect is
applied to the damage. The category is not checked: the threshold is the byte
at index level step + category × row length of the group's table, an index
kept to a signed byte, so a value other than 0 to 5 reads a byte from 128
bytes before the start of that table to 127 bytes after it. No reference
script does this.12
Bug. ANOMALY-23 — When damage allows a saving throw, the race test reads the
whole race_and_sex byte instead of the race shifted out of it, as
conditions and rays do. The values it compares with then name a female elf
(3), a male half-elf (4) and a female half-elf (5). On this path, female
elves and female half-elves get the
constitution adjustment in
categories 0, 1 and 4, and male half-elves in categories 1 and 4; dwarves,
gnomes and halflings never get it. The path serves scripted traps, spells and
objects that strike the party, and monster explosions. A faithful
reimplementation compares the unshifted byte there.
Other uses of the categories
| Category | Saving throws that use it |
|---|---|
| 0 | Poison from a monster's melee attack and from a poison potion |
| 1 | A monster's mind blast; the explosion of a monster that dies on any hit |
| 2 | Paralysis and petrification by a monster's melee attack |
| 3 | No use found |
| 4 | Hold Person cast on the party, monster rays (misread), spell objects striking the party, monsters' saves against spells, the reference scripts' traps |
Conditions and rays go through the
character's saving throw, which passes
the race shifted out of race_and_sex; see
effects on characters.
Damage goes through the damage routines,
with the anomaly above. Monsters save with the warriors' table and their
type's level, and never get the adjustment.3
Use in the reference files
The reference scripts use only SCRIPT_SAVING_THROW_NONE (137 of 164 damage
instructions) and category 4 (27 instructions). The routine also accepts values
0 to 3, which no examined script uses.
Sources
Locations refer to the game executable reference.