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

From DikuMUD Wiki
Jump to navigation Jump to search
(XML import)
(checked against the compiler and the interpreter; example compiles)
 
Line 1: Line 1:
−
<span id="bpuneq"></span>
+
= unequip() =
−
  unequip ( u : unitptr )
+
'''Procedure.''' Takes off an object a character is wearing.
−
    u : Unit to unequip.
+
 
−
    result: Unequipes unit presumed to be in equipment of PC/NPC.
+
  unequip(u : unitptr)
−
<span id="bpuneq"></span>
+
 
−
unequip ( u : unitptr )
+
The object stays in the character's inventory but is no longer worn: its light stops counting for the wearer and its transfer affects come off the wearer. Like [[Manual:DIL Manual/addequip()|addequip()]] it is silent: no messages, and it isn't the <code>remove</code> command.
−
    u : Unit to unequip.
+
 
−
    result: Unequipes unit presumed to be in equipment of PC/NPC.
+
== Parameters ==
 +
{| class="wikitable"
 +
! Name !! Type !! Meaning
 +
|-
 +
| u || unitptr || The worn object.
 +
|}
 +
 
 +
== Notes ==
 +
* Nothing happens when <code>u</code> is null, isn't an object, or isn't worn. So <code>unequip(equipment(ch, WEAR_WIELD))</code> is safe when nothing is wielded.
 +
* To take the object away from the character as well, [[Manual:DIL Manual/link()|link()]] it somewhere after unequipping it.
 +
 
 +
== Example ==
 +
<pre>
 +
dilbegin disarm(victim : unitptr);
 +
var
 +
  wpn : unitptr;
 +
code
 +
{
 +
  wpn := equipment(victim, WEAR_WIELD);
 +
  if (wpn == null)
 +
      return;
 +
  unequip(wpn);
 +
  link(wpn, victim.outside);
 +
  act("$1n knocks $2n out of $3n's hands.", A_ALWAYS, self, wpn, victim, TO_ROOM);
 +
  act("$1n knocks $2n out of your hands.", A_ALWAYS, self, wpn, victim, TO_VICT);
 +
}
 +
dilend
 +
</pre>
 +
Takes the wielded weapon from a character and drops it on the floor.
 +
 
 +
== See also ==
 +
* [[Manual:DIL Manual/addequip()|addequip()]]
 +
* [[Manual:DIL Manual/equipment()|equipment()]]
 +
* [[Manual:DIL Manual/equip|equip]]

Latest revision as of 23:16, 14 November 2026

unequip()

Procedure. Takes off an object a character is wearing.

unequip(u : unitptr)

The object stays in the character's inventory but is no longer worn: its light stops counting for the wearer and its transfer affects come off the wearer. Like addequip() it is silent: no messages, and it isn't the remove command.

Parameters

Name Type Meaning
u unitptr The worn object.

Notes

  • Nothing happens when u is null, isn't an object, or isn't worn. So unequip(equipment(ch, WEAR_WIELD)) is safe when nothing is wielded.
  • To take the object away from the character as well, link() it somewhere after unequipping it.

Example

dilbegin disarm(victim : unitptr);
var
   wpn : unitptr;
code
{
   wpn := equipment(victim, WEAR_WIELD);
   if (wpn == null)
      return;
   unequip(wpn);
   link(wpn, victim.outside);
   act("$1n knocks $2n out of $3n's hands.", A_ALWAYS, self, wpn, victim, TO_ROOM);
   act("$1n knocks $2n out of your hands.", A_ALWAYS, self, wpn, victim, TO_VICT);
}
dilend

Takes the wielded weapon from a character and drops it on the floor.

See also