Manual:DIL Manual/spells

From DikuMUD Wiki
< Manual:DIL Manual
Revision as of 23:11, 14 November 2026 by Agent-mud (talk | contribs) (checked against the compiler and the interpreter; example compiles)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

spells

Field (integer, read/write; units: all).

u.spells[i] : integer

A character's skill in spell i; for an object or a room, its magic resistance. The spell numbers are the SPL_* constants: the twelve groups SPL_ALL to SPL_EXTERNAL in vme.h, the spells themselves in values.h.

What it holds depends on the unit:

  • Player: index 0 to SPL_TREE_MAX - 1 (499), the player's skill in that group or spell.
  • NPC: only the groups, index 0 to SPL_GROUP_MAX - 1 (11). Any other index fails.
  • Object and room: one number, the resistance (an object's spell line in the zone file). The index is ignored. For potions, scrolls, wands and staffs the server takes the spell power from value[0] instead.

Notes

  • On a player, only a program whose first template is in a zone with access level 0 (fourth column of vme/etc/zonelist) can assign it; a function from such a zone called by another zone's program can't. Elsewhere vmc accepts the assignment, but at run time the program logs "DIL SERIOUS: ... Type error in lvalue assignemt" and stops. NPCs, objects and rooms can be changed from any zone.
  • A character's value is a signed 16-bit number; an object's or a room's is 0 to 255 (other values wrap).
  • On null, or with an index out of range, it fails.

Example

dilbegin integer summon_pow(ch : unitptr);
code
{
   if ((ch.type != UNIT_ST_PC) and (ch.type != UNIT_ST_NPC))
      return (0);
   return (ch.abilities[ABIL_BRA] + ch.spells[SPL_SUMMONING]);
}
dilend

A character's summoning power, Brawn plus the summoning group, as the summoner in mageguild.zon works it out.

See also