Manual:DIL Manual/ability costs

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

ability_costs

Field (integer, read-only; units: PC).

pc.ability_costs[i] : integer

The player's racial modifier for training ability i: the race line for the player's race in vme/etc/abilities.def, for example 2 for an elf's magic and -3 for a dwarf's. Added to the profession's modifier it sets how much training the ability costs: the higher the sum, the cheaper, and below 1 the player can train it only once per level. It is not the cost itself. i is an ABIL_ constant from vme.h, ABIL_MAG (0) to ABIL_HP (7).

Notes

  • Players only. On an NPC, an object, a room or null it fails, and also when i is outside 0 to 7.
  • It is 0 when the player's race is outside the table (100 or more).
  • vmc accepts an assignment, but it never works: at run time the program logs "DIL SERIOUS: ... Type error in lvalue assignemt" and stops.

Example

dilbegin string race_bonus(pc : unitptr, i : integer);
var
   n : integer;
code
{
   n := pc.ability_costs[i];
   if (n > 0)
      return ("+" + itoa(n));
   return (itoa(n));
}
dilend

Shows a player's racial modifier for an ability, with its sign.

See also