Manual:DIL Manual/race

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

race

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

ch.race : integer

The character's race, a RACE_ constant from values.h. The player races are RACE_HUMAN (0) to RACE_DARK_ELF (10); monster races start at 110 (RACE_KINGRAITH, RACE_GOBLIN, ...), and plant.h adds a few more. A zone file sets it with race in an NPC. wmacros.h has tests such as RACE_IS_HUMANOID(race) and RACE_IS_UNDEAD(race).

For a player the race decides the starting height, weight and lifespan (vme/etc/races.def) and the racial modifiers to training costs (abilities.def and the other .def files).

Notes

  • On an object, a room or null it fails.
  • Stored as an unsigned 16-bit number: values outside 0 to 65535 wrap around. No access level is needed to assign it.
  • Assigning a player's race changes only the race. reset_race() then rolls height, weight, lifespan and age for the new race.

Example

dilbegin string race_greeting(pc : unitptr);
code
{
   if (pc.race == RACE_DWARF)
      return ("Hail, son of the mountain!");
   if ((pc.race == RACE_ELF) or (pc.race == RACE_HALF_ELF))
      return ("Well met, child of the woods.");
   if (RACE_IS_HUMANOID(pc.race))
      return ("Welcome, traveller.");
   return ("What manner of beast are you?");
}
dilend

Greets a character by race, as the guild masters in guilds.zon pick words by race.

See also