Manual:DIL Manual/reset race()

From DikuMUD Wiki
< Manual:DIL Manual
Revision as of 23:07, 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

reset race()

Procedure. Rolls a player's body again from the race's values: weight, height, lifespan and age.

reset_race(pc : unitptr)

The player keeps their race and sex. The server takes that race's entry in races.def (the male or female values, by the player's sex) and rolls the numbers again with its dice, the same way as when a character is made:

  • weight and base weight: the race's weight plus its weight dice;
  • height: the race's height plus its height dice;
  • lifespan: the race's lifespan plus its lifespan dice;
  • birth: the character's creation time minus the race's starting age plus its age dice, in mud years. The player's age is counted from that.

Use it after changing pc.race, or in a reroll together with reset level() and reset vlevel().

Parameters

Name Type Meaning
pc unitptr The player to roll again.

Notes

  • Only a program in a zone with access level 0 or 1 (the fourth column of vme/etc/zonelist) may call it. Elsewhere it writes "DIL '...' attempt to reset race w/o access." to the zone log and the program stops.
  • Players only. On an NPC, an object or a room it does nothing.
  • A unitptr variable that is null writes "reset_race with no unit." to the zone log and does nothing. vmc refuses a literal null.
  • It does not change the race, abilities, skills, training costs or level. (The old page said it also reset training costs: it doesn't.)
  • The player's race must be one of the races (0 to 99). With a larger value in pc.race the server stops on an assertion.

Example

dilbegin reroll_body(pc : unitptr);
code
{
   if (pc.type != UNIT_ST_PC)
      return;
   reset_race(pc);
   sendtext("Your body changes. You are now " + itoa(pc.height) + " cm tall and weigh " +
            itoa(pc.weight) + " pounds.<br/>", pc);
}
dilend

Rolls a player's body again and tells them their new height and weight.

See also