for the benefit of all our comrades that would like to have an unbinding script to go together with this wonderful mod, i would like to share to you my script for unbinding bound items.
function script unbind {
set .id, 22007; // or any item id that would correspond to your item/scroll that you wish to use.
setarray .itemid[0],0;
setarray .name$[0],"";
setarray .identify[0],0;
setarray .attrib[0],0;
setarray .refine[0],0;
setarray .card1[0],0;
setarray .card2[0],0;
setarray .card3[0],0;
setarray .card4[0],0;
getinventorylist;
set @count,0;
for(set @i, 0; @i <@inventorylist_count; set @i, @i + 1)
{
if(@inventorylist_bound[@i] && @inventorylist_equip[@i]==0)
{
set .itemid[@count], @inventorylist_id[@i];
set .name$[@count], getitemname(@inventorylist_id[@i]);
set .identify[@count], @inventorylist_identify[@i];
set .attrib[@count], @inventorylist_attribute[@i];
set .refine[@count], @inventorylist_refine[@i];
set .card1[@count], @inventorylist_card1[@i];
set .card2[@count], @inventorylist_card2[@i];
set .card3[@count], @inventorylist_card3[@i];
set .card4[@count], @inventorylist_card4[@i];
set @count,@count+1;
}
}
if(getarraysize(.itemid)==0)
{
message strcharinfo(0), "No unbindable item found in the inventory.";
end;
}
else
{
set @id, select(implode(.name$,":"));
delitem2 .itemid[@id-1],1,.identify[@id-1],.refine[@id-1],.attrib[@id-1],.card1[@id-1],.card2[@id-1],.card3[@id-1],.card4[@id-1];
getitem2 .itemid[@id-1],1,.identify[@id-1],.refine[@id-1],.attrib[@id-1],.card1[@id-1],.card2[@id-1],.card3[@id-1],.card4[@id-1];
delitem .id,1;
message strcharinfo(0), "Item has been unbinded.";
close;
}
}
and for the item,
25001,Scroll_of_Unbinding,Scroll of Unbinding,11,2,,10,,,,,0xFFFFFFFF,7,2,,,,,,{ callfunc("unbind"); },{},{}
Notice that the item type should be 11, and not 2 because the script is the one that handles the actual consumption of the item. known issues: - if multiple account-bind items are identical, like, multiple pcs of +10 Knife[3] (one or more binded and one not binded), the script will fail because it would be confused which item would be deleted because it has the same typical parameters.
other than this issue, everything works fine..
we may be needing a 'getitemuniqueid' script command to fix this issue.
If you find some parts of the script wrong, please let me know, and please do share your thoughts about it. am not really a pro scripter so pardon me if I have some bugs on it. Thanks.