Bag of weight
Posted: Tue Nov 25, 2008 11:29 pm
Welcome! I have seen some requests for a script which would create a bag with 0 or 1 weight which could hold items and wouldn't add to weight, well, here it is
feel free to change and edit it any way you want. BTW make sure you create a new storage area for the kids to hold their items
Code: Select all
use basic;
use uo;
include "include/others";
include "util/bankbag";
include "util/bank";
program use_bankingBag ( who, bag )
if(GetObjProperty(bag, "Created"))
SendSysMessage(who, "There is something wrong with this bag", FONT_NORMAL, RED_COLOR);
// just to ensure GM created bags won't be used
return;
endif
if(!GetObjProperty(bag, "Owner"))
SendSysMessage(who, "This bag is connected with you from now on", FONT_NORMAL, BLUE_COLOR);
SetObjProperty(bag, "Owner", who.serial);
return;
endif
SetObjProperty(bag, "SpecialUses", CInt(GetObjProperty(bag, "SpecialUses"))-1);
if(CInt(GetObjProperty(bag, "SpecialUses")) < 0)
MoveAllItemsToBank( bag, who ); // we've ran out of uses
else
OpenBagBank (bag, who); // we're good on uses still
endif
SetName(bag, bag.name); // just to refresh the tooltip
endprogram
function MoveAllItemsToBank ( bag, who )
var b := FindBBankBox(CInt(GetObjProperty(bag, "Owner")));
var bbox := FindBankBox(who);
foreach itm in ListRootItemsInContainer(b);
MoveItemToContainer(itm, bbox);
endforeach
WipeBBankBox(b);
SendSysMessage(who, "The bag disappears in thin air moving all your items to the bank", FONT_NORMAL, BLUE_COLOR);
DestroyItem(bag);
endfunction
function OpenBagBank (bag, who )
var b := FindBBankBox(CInt(GetObjProperty(bag, "Owner")));
if(b)
SendOpenSpecialContainer(who, b);
endif
endfunction