Manual:DIL Manual/thirst
Jump to navigation
Jump to search
Contents
thirst
Field (integer, read/write; units: PC).
pc.thirst : integer
How well watered the player is. Higher is better: 24 is not thirsty at all, below 0 the player is thirsty. The stomach@update program lowers it every mud hour, and update.zon's gain_cond keeps it between -96 and 24 and tells the player: "thirsty" from 3 down, then "very thirsty", "dehydrated" and "dying of thirst". Drinking raises it.
A value of 48 or more is never changed by gain_cond: the player doesn't get thirsty.
Notes
- Players only. On an NPC, an object, a room or null the field fails.
- Stored as an 8-bit signed number: values outside -128 to 127 wrap around. Keep to -96 to 24, or 48 for "never thirsty".
- A program that assigns it should clamp it to 24 itself.
- While full or thirst is below 0, a player regains hit points, mana and endurance more slowly, and when they are low enough, loses them (vmelimits.cpp).
Example
dilbegin integer quench(u : unitptr, amount : integer);
code
{
if (u.type != UNIT_ST_PC)
return (FALSE);
if (u.thirst > 20)
{
act("You are not thirsty.", A_ALWAYS, u, null, null, TO_CHAR);
return (FALSE);
}
u.thirst := u.thirst + amount;
if (u.thirst > 24)
u.thirst := 24;
return (TRUE);
}
dilend
Lets a player drink unless they are not thirsty, as the drinks in basis.zon do.