Manual:DIL Manual/max hp

From DikuMUD Wiki
Jump to navigation Jump to search

max hp

Field (integer, read/write; units: all; on players writable only from access-0 zones).

u.max_hp : integer

The unit's maximum hit points; hp holds the current ones. Characters have it from their HP ability: 3 * HP + 20 for a player (1 for a mortal past their lifespan), 3 * HP + 10 for an NPC. Objects have hit points too: weapons, shields and armour get them from their craftsmanship (1000 for an ordinary one).

Notes

  • On a player, only a program in a zone with access level 0 (the fourth column of vme/etc/zonelist) can assign it. Elsewhere vmc accepts the assignment, but at run time the program logs "DIL SERIOUS: ... Type error in lvalue assignemt" and stops. On NPCs, objects and rooms any zone can assign it, and every zone can read it.
  • The game sets a character's maximum again from the HP ability whenever that ability changes (training, an affect on it), so a change made in DIL lasts only until then. To change it for good, change the ability with an affect (APF_ABILITY on ABIL_HP).
  • Assigning it doesn't change hp at once: after lowering the maximum, the current hit points can be above it for a while.
  • On null it fails.

Example

dilbegin full_heal(u : unitptr);
code
{
   if ((u.type != UNIT_ST_PC) and (u.type != UNIT_ST_NPC))
      return;
   u.hp := u.max_hp;
   act("You feel completely healed.", A_ALWAYS, u, null, null, TO_CHAR);
   return;
}
dilend

Heals a character fully.

See also