Equip, unequip
Equip, unequip
How might i create 2 commands, one that unequips all tiems(.unequip) and one that equips the items you unequiped last?(.equip)
.unequip
Code: Select all
use uo;
use os;
include "include/client";
program unequip(me, text)
set_critical(1);
if (me.dead)
return;
endif
case (lower(text))
"jewel":
foreach thing in ListEquippedItems(me)
if (RemoveJewl( me, thing))
MoveItemToContainer(thing, me.backpack);
endif
endforeach
"jewelry":
foreach thing in ListEquippedItems(me)
var jewl := 0;
if (RemoveIt(me,thing,jewl))
MoveItemToContainer(thing, me.backpack);
endif
endforeach
default:
foreach thing in ListEquippedItems(me)
var jewl := 1;
if (RemoveIt(me,thing,jewl))
MoveItemToContainer(thing, me.backpack);
endif
endforeach
endcase
endprogram
function RemoveIt(me, it, jewl)
var ring := GetEquipmentByLayer( me, LAYER_RING );
if (it.serial == ring.serial)
return jewl;
endif
var bracelet := GetEquipmentByLayer( me, LAYER_WRIST );
if (it.serial == bracelet.serial)
return jewl;
endif
var earrings := GetEquipmentByLayer( me, LAYER_EARS );
if (it.serial == earrings.serial)
return jewl;
endif
var neck := GetEquipmentByLayer( me, LAYER_NECK );
if (it.serial == neck.serial)
if (IsNecklace(it))
return jewl;
endif
endif
var beard := GetEquipmentByLayer( me, LAYER_BEARD );
if (it.serial == beard.serial)
return 0;
endif
var hair := GetEquipmentByLayer( me, LAYER_HAIR );
if (it.serial == hair.serial)
return 0;
endif
var mount := GetEquipmentByLayer( me, LAYER_MOUNT );
if (it.serial == mount.serial)
return 0;
endif
if (it.objtype == 0x204e)
return;
endif
var mypack := me.backpack;
if (it.serial == mypack.serial)
return 0;
endif
return 1;
endfunction
function RemoveJewl(me, it)
if (it.objtype == 0x204e)
return;
endif
var ring := GetEquipmentByLayer( me, LAYER_RING );
if (it.serial == ring.serial)
return 1;
endif
var bracelet := GetEquipmentByLayer( me, LAYER_WRIST );
if (it.serial == bracelet.serial)
return 1;
endif
var earrings := GetEquipmentByLayer( me, LAYER_EARS );
if (it.serial == earrings.serial)
return 1;
endif
var neck := GetEquipmentByLayer( me, LAYER_NECK );
if (it.serial == neck.serial)
if (IsNecklace(it))
return 1;
endif
endif
endfunction
function IsNecklace(item)
case (item.graphic)
0x1085:
return 1;
0x1088:
return 1;
0x1089:
return 1;
0x1f05:
return 1;
0x1f08:
return 1;
0x1f0a:
return 1;
default:
return 0;
endcase
return;
endfunction
Here are the arm and disarm scripts from World of Dreams. These are basically what you are asking for. They provide three sets of equip and unequip user defined items. There is even a text file with user instructions included. I cannot provide support for them. They may need tweaking to compile under POL 96.
Use at your own risk. Not responsible for damage from fire, flood or power supply explosions etc.
Use at your own risk. Not responsible for damage from fire, flood or power supply explosions etc.