Manual:DIL Manual/max endurance
Jump to navigation
Jump to search
Contents
max_endurance
Field (integer, read-only; units: characters).
ch.max_endurance : integer
The most endurance the character can have. The server works it out each time it is read: Constitution × 2 + 150. For a mortal player that is then scaled by age against the player's lifespan: it peaks at 130% a sixth of the way through the lifespan, falls to 20% at its end and to 0 beyond it. Immortals always get the full amount.
The current endurance is the endurance field; nothing stops a script from setting it above this maximum, so cap it yourself.
Notes
- Read-only: vmc refuses an assignment ("Illegal lvalue"). Change Constitution (or the age) to change it.
- On an object, a room or null the field fails.
Example
dilbegin rest_up(ch : unitptr, amount : integer);
code
{
if ((ch.type != UNIT_ST_PC) and (ch.type != UNIT_ST_NPC))
return;
ch.endurance := ch.endurance + amount;
if (ch.endurance > ch.max_endurance)
ch.endurance := ch.max_endurance;
return;
}
dilend
Gives a character some endurance without going over the maximum, as in basis.zon.