//-----------------------------------------------------------------------------
// Script_ItemCombining
// Copyright (c) SolarFlare Productions, Inc.
//-----------------------------------------------------------------------------
function serverCmdcombine(%client, %slot1, %slot2)
{
%slot1--;
%slot2--;
if(!isFile("Add-Ons/ItemCombos.txt"))
{
error("ItemCombos.txt not found!");
return;
}
%file = new FileObject();
%file.openForRead("Add-Ons/ItemCombos.txt");
while(!%file.isEOF())
{
%readItem = %file.readLine();
%readItem1 = getWord(%readItem, 0);
%readItem2 = getWord(%readItem, 1);
%readItem3 = getWord(%readItem, 2);
if(%readItem1 $= %client.player.tool[%slot1].getName() && %readItem2 $= %client.player.tool[%slot2].getName())
{
%client.player.tool[%slot1] = %readItem3.getID();
%client.player.tool[%slot2] = 0;
messageClient(%client, 'MsgItemPickup', '', %slot1, nametoID(%readItem3));
messageClient(%client, 'MsgItemPickup', '', %slot2, 0);
messageClient(%client, '', "\c3You've created a new item!");
return;
}
}
messageClient(%client, '', "\c3Nothing was created.");
%file.close();
%file.delete();
}
Item Combining system. Simply use /combine <slot1> <slot2> to combine the items in the two slots. Item combinations are defined in ItemCombos.txt in the Add-Ons folder, so be sure to make that text file or else you'll get errors. The format goes as follows:
<firstItemDatablock> <secondItemDatablock> <resultItemDatablock>
With one per line. So, for example:
heGrenadeItem heGrenadeItem gunItem
So if you combined two heGrenade items in your inventory, it'll result in a Gun being created. To find the names of the item datablocks, look through the weapon script until you find:
datablock ItemData
Within the brackets that follow will be the name of the item datablock.
datablock ItemData(swordItem)