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

From DikuMUD Wiki
Jump to navigation Jump to search
(XML import)
 
(4 intermediate revisions by one other user not shown)
Line 1: Line 1:
= setweight( u : unitptr, i : integer ) =
+
<span id="bpsetweight"></span>
 +
setweight( u : unitptr, i : integer )
 +
    u : the unit on which you wish to alter the weight.
 +
    i : the new weight
  
''' Parameters '''
+
    This is needed on for example drink-containers. I.e. if you wish to
  u : the unit on which you wish to alter the weight.
+
    remove or add some liquid, you must also adjust the weight of the
  i : the new weight
+
    container, or you will mess up things.
  
''' Description '''
+
---~---~---~---~---~---~---~---~---
Use this procedure on for example drink-containers if you wish to
+
<span id="bpsetweight"></span>
remove or add some liquid. This function will ensure the base-weight
+
setweight( u : unitptr, i : integer )
is unchanged, and that the weight of the unit is altered according to
+
    u : the unit on which you wish to alter the weight.
the integer i (positive or negative). To ensure weight consistency this
+
    i : the new weight
procedure also adjusts the weight of all units outside the altered unit.
 
  
For example in this hierarchy
+
    This is needed on for example drink-containers. I.e. if you wish to
 +
    remove or add some liquid, you must also adjust the weight of the
 +
    container, or you will mess up things.
  
  room
+
---~---~---~---~---~---~---~---~---
    npc
 
    pc
 
      bottle
 
 
 
Filling the bottle with 5 lbs of water will add 5 to the pc and the room as well.
 

Latest revision as of 22:38, 4 December 2025

setweight( u : unitptr, i : integer )
   u : the unit on which you wish to alter the weight.
   i : the new weight
   This is needed on for example drink-containers. I.e. if you wish to
   remove or add some liquid, you must also adjust the weight of the
   container, or you will mess up things.
---~---~---~---~---~---~---~---~---

setweight( u : unitptr, i : integer )
   u : the unit on which you wish to alter the weight.
   i : the new weight
   This is needed on for example drink-containers. I.e. if you wish to
   remove or add some liquid, you must also adjust the weight of the
   container, or you will mess up things.
---~---~---~---~---~---~---~---~---