Difference between revisions of "Manual:DIL Manual/setweight()"

From DikuMUD Wiki
Jump to navigation Jump to search
Line 19: Line 19:
 
       bottle
 
       bottle
  
Filling the bottle with 5 lbs of water will add 5 to the pc and the room as well.
+
Filling the bottle with 5 lbs of water will add 5 to the bottle, the pc
 +
and the room as well (npc remains unchanged)

Revision as of 17:09, 28 November 2020

setweight( u : unitptr, i : integer )

Parameters

 u : the unit on which you wish to alter the weight.
 i : the new weight

Description Use this procedure on for example drink-containers if you wish to remove or add some liquid. This function will ensure the base-weight is unchanged, and that the weight of the unit is altered according to the integer i (positive or negative). To ensure weight consistency this procedure also adjusts the weight of all units outside the altered unit.

For example in this hierarchy

 room
   npc
   pc
     bottle

Filling the bottle with 5 lbs of water will add 5 to the bottle, the pc and the room as well (npc remains unchanged)