Manual:DIL Manual/baseweight

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

baseweight

Field (integer, read-only; units: all).

u.baseweight : integer

The weight of the unit itself, in pounds, without anything it carries or contains: an empty bag, a character's body. It is the weight line of the unit in the zone file. The total, with contents, is the weight field, so u.weight - u.baseweight is what the unit holds.

Notes

  • Read-only: vmc refuses an assignment ("Illegal lvalue"). Use set_weight_base(), which also changes the weight of the unit and of everything it is in.
  • On null it fails.

Example

dilbegin size_part(part : unitptr, corpse : unitptr);
var
   w : integer;
code
{
   w := corpse.baseweight / 30;
   if (w > 100)
      w := 100;
   if (w < 1)
      w := 1;
   set_weight_base(part, w);
   return;
}
dilend

Makes a body part weigh a thirtieth of the corpse it was cut from, between 1 and 100 pounds, as in death.zon.

See also