Manual:DIL Manual/abilities

From DikuMUD Wiki
< Manual:DIL Manual
Revision as of 23:14, 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

abilities

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

ch.abilities[i] : integer

One of the character's abilities. i is an ABIL_ constant from vme.h: ABIL_MAG (0), ABIL_DIV, ABIL_STR, ABIL_DEX, ABIL_CON, ABIL_CHA, ABIL_BRA, ABIL_HP (7). Players raise them by training. In an NPC the zone file gives a share for each (MSET_ABILITY in wmacros.h; vmc wants them to add up to 100), and vmc turns the shares into values for the NPC's level.

The zones use them as the ability half of skill checks, and for things like carrying capacity (baseget.zon: 2 * pc.abilities[ABIL_STR]).

Notes

  • It fails when i is outside 0 to 7, and on an object, a room or null.
  • On an NPC any program can assign it. On a player only a program in a zone with access level 0 (the fourth column of vme/etc/zonelist) can; what counts is the zone of the program running on the unit, not that of a function it calls. Elsewhere vmc accepts the assignment, but at run time the program logs "DIL SERIOUS: ... Type error in lvalue assignemt" and stops. Reading works in every zone.
  • Stored as a 16-bit number. Bonuses from equipment and spells are affects (APF_ABILITY, see addaff()) that change this value while they last. Such an affect on ABIL_HP also recomputes max_hp; assigning the field does not.

Example

dilbegin integer carry_capacity(pc : unitptr);
code
{
   return (100 + ((pc.baseweight - 100) / 2) + (2 * pc.abilities[ABIL_STR]));
}
dilend

How much weight a character can carry, as in baseget.zon.

See also