Manual:DIL Manual/spell costs
Jump to navigation
Jump to search
Contents
spell_costs
Field (integer, read-only; units: PC).
pc.spell_costs[i] : integer
How easy spell i is for the player's race to learn: the race line for that race in the spell's entry in vme/etc/spells.def, from -3 (extremely hard) to +3 (extremely easy), 0 when the file gives none. Guild teachers use it in the price of a practice. It depends only on the race, not on the player.
Notes
- Read-only, although vmc accepts an assignment: at run time the program logs "DIL SERIOUS: ... Type error in lvalue assignemt" and stops.
- Players only. On an NPC, an object, a room or null, or with an index outside 0 to
SPL_TREE_MAX- 1, the field fails.
Example
dilbegin string spl_ease(pc : unitptr, spl : integer);
code
{
if (pc.type != UNIT_ST_PC)
return ("");
if (pc.spell_costs[spl] > 0)
return ("easier than usual");
else if (pc.spell_costs[spl] < 0)
return ("harder than usual");
return ("normal");
}
dilend
Tells a player whether a spell comes easier or harder to their race.