In this version you can set items needed with ActionID, recipes (writeable items with ActionID) and create much modified items.
FUSION/UPGRADE SCRIPT
Configurable item upgrades/changes:
rest.. = value (number, it will add this value to default value of created item, like normal club has 7 attack, if you set attack=6 new item will have 13 attack, if you set attack=-6 new will have 1 attack)
Example config informations:
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Player must put in bag 2 items with ID 2154 (yellow gem) and script create 2 items:
Player must put in bag 1 item with ID 2154 (yellow gem) and this item must have ActionID 130 (you can add few fusion recipes with same item id, but different actionid [if you want add like me Yellow Gem without ActionID and other recipe with Yellow Gem (with action id 130) always first paste config with actionid]) - script create 1 item:
Player must put in bag 1 item with ID 2154 (yellow gem) and script create 1 item:
Player must put in bag 'recipe' (recipe is writeable item with any text inside and actionid) with actionID 120 (from script below) and item 2154 (yellow gem) - script create 1 item:
actions.xml:
fusion.lua:
map editor/script use:
------------------------------------------------
------------------------------------------------
------------------------------------------------
RECIPE QUESTS SCRIPT
actions.xml:
recipequests.lua:
recipe quests config in map editor:
FUSION/UPGRADE SCRIPT
Configurable item upgrades/changes:
name, description = 'text'actionid
name
description
attack
extraAttack
defense
extraDefense
armor
hitChance
shootRange
rest.. = value (number, it will add this value to default value of created item, like normal club has 7 attack, if you set attack=6 new item will have 13 attack, if you set attack=-6 new will have 1 attack)
Example config informations:
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
PHP:
{{{2197,999,actionid=125,name="Test"}, {2197,999,actionid=103,description="Desc of item\nSecond line"}}, {{2154,0},{2154,0}}}
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\19:29 You see a stone skin amulet (protection physical +80%, death +80%) that has 999 charges left.
It weighs 7.60 oz.
Desc of item
Second line
ItemID: [2197], ActionID: [103].
19:30 You see a Test (protection physical +80%, death +80%) that has 999 charges left.
It weighs 7.60 oz.
ItemID: [2197], ActionID: [125].
PHP:
{{{2382,0,name="Super Club",description="Upgraded club",attack=5,extraAttack=10,defense=3,extraDefense=4}}, {{2154,0,actionid=130}}}
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\19:31 You see a Super Club (Atk:12 +10, Def:10 +4).
It weighs 25.00 oz.
Upgraded club
ItemID: [2382].
PHP:
{{{2650,0,name="Super Jacket",description="Upgraded jacket",armor=-5}}, {{2154,0}}}
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\19:30 You see a Super Jacket (Arm:-4).
It weighs 24.00 oz.
Upgraded jacket
ItemID: [2650].
PHP:
{{{2382,0,name="Super Mega Club",attack=50,defense=3}}, {{2154,0},{recipe=120}}}
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\19:32 You see a Super Mega Club (Atk:57, Def:10).
It weighs 25.00 oz.
ItemID: [2382].
actions.xml:
PHP:
<action actionid="8000" event="script" value="quests/fusion.lua"/>
PHP:
-- Script by Gesior --
-- Fusion/Upgrade Script ver. 2 --
local item_config = {
{{{2197,999,actionid=125,name="Test"}, {2197,999,actionid=103,description="Desc of item\nSecond line"}}, {{2154,0},{2154,0}}},
{{{2382,0,name="Super Club",description="Upgraded club",attack=5,extraAttack=10,defense=3,extraDefense=4}}, {{2154,0,actionid=130}}},
{{{2650,0,name="Super Jacket",description="Upgraded jacket",armor=-5}}, {{2154,0}}},
{{{2382,0,name="Super Mega Club",attack=50,defense=3}}, {{2154,0},{recipe=120}}}
}
local pos_1 = {x = 479, y = 1470, z = 13}
local pos_2 = {x = 481, y = 1470, z = 13}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local create_item_pos = pos_2
local container = getTileItemByType(pos_1, ITEM_TYPE_CONTAINER)
if(container.uid == 0 or not(isContainer(container.uid))) then
create_item_pos = pos_1
container = getTileItemByType(pos_2, ITEM_TYPE_CONTAINER)
end
if(container.uid == 0 or not(isContainer(container.uid))) then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "Put bag or backpack with items to fusion.")
return FALSE
end
items_in_container = {}
item_slot = 0
while(true) do
item_in = getContainerItem(container.uid, item_slot)
if item_in.itemid > 0 then
table.insert(items_in_container, item_in)
else
break
end
item_slot = item_slot+1
end
local fusion_id = 0
for i = 1, table.getn(item_config) do
fusion_items = item_config[i]
items_create = fusion_items[1]
items_required = fusion_items[2]
local tmp_items_required = {}
for s = 1, table.getn(items_required) do
table.insert(tmp_items_required, items_required[s])
end
if(table.getn(items_in_container) == table.getn(tmp_items_required)) then
for c = 1, table.getn(items_in_container) do
local item_in_container = items_in_container[c]
for r = 1, table.getn(tmp_items_required) do
local item_required = tmp_items_required[r]
if(item_in_container.itemid == item_required[1] and item_in_container.type == item_required[2] and (item_required["actionid"] == nil or item_required["actionid"] == item_in_container.actionid)) or (item_required["recipe"] ~= nil and item_required["recipe"] == item_in_container.actionid and getItemDescriptions(item_in_container.uid).text ~= '') then
table.remove(tmp_items_required, r)
break
end
end
end
if(table.getn(tmp_items_required) == 0) then
fusion_id = i
break
end
end
end
if(fusion_id > 0) then
while(true) do
item_in = getContainerItem(container.uid, 0)
if item_in.uid > 0 then
doRemoveItem(item_in.uid)
else
break
end
end
for u = 1, table.getn(items_create) do
local item_to_create = items_create[u]
local new_item_uid = doCreateItemEx(item_to_create[1], item_to_create[2])
doTileAddItemEx(create_item_pos, new_item_uid)
if(item_to_create["actionid"] ~= nil) then
doSetItemActionId(new_item_uid, item_to_create["actionid"])
end
if(item_to_create["name"] ~= nil) then
setItemName(new_item_uid, item_to_create["name"])
end
if(item_to_create["description"] ~= nil) then
doSetItemSpecialDescription(new_item_uid, item_to_create["description"])
end
if(item_to_create["attack"] ~= nil) then
setItemAttack(new_item_uid, getItemAttack(new_item_uid)+item_to_create["attack"])
end
if(item_to_create["extraAttack"] ~= nil) then
setItemExtraAttack(new_item_uid, getItemExtraAttack(new_item_uid)+item_to_create["extraAttack"])
end
if(item_to_create["defense"] ~= nil) then
setItemDefense(new_item_uid, getItemDefense(new_item_uid)+item_to_create["defense"])
end
if(item_to_create["extraDefense"] ~= nil) then
setItemExtraDefense(new_item_uid, getItemExtraDefense(new_item_uid)+item_to_create["extraDefense"])
end
if(item_to_create["armor"] ~= nil) then
setItemArmor(new_item_uid, getItemArmor(new_item_uid)+item_to_create["armor"])
end
--if(item_to_create["attackSpeed"] ~= nil) then
-- setItemAttackSpeed(new_item_uid, getItemAttackSpeed(new_item_uid)+item_to_create["attackSpeed"])
--end
if(item_to_create["hitChance"] ~= nil) then
setItemHitChance(new_item_uid, getItemHitChance(new_item_uid)+item_to_create["hitChance"])
end
if(item_to_create["shootRange"] ~= nil) then
setItemShootRange(new_item_uid, getItemShootRange(new_item_uid)+item_to_create["shootRange"])
end
end
doSendMagicEffect(pos_1,CONST_ME_GREEN_RINGS)
doSendMagicEffect(pos_2,CONST_ME_GREEN_RINGS)
doSendMagicEffect(getPlayerPosition(cid),CONST_ME_MAGIC_GREEN)
else
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "Unknown recipe.")
end
if(item.itemid == 1945) then
doTransformItem(item.uid,item.itemid+1)
elseif(item.itemid == 1946) then
doTransformItem(item.uid,item.itemid-1)
end
return TRUE
end
------------------------------------------------
------------------------------------------------
------------------------------------------------
RECIPE QUESTS SCRIPT
actions.xml:
PHP:
<action actionid="1750" event="script" value="quests/recipequests.lua"/>
PHP:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerStorageValue(cid, item.uid) ~= 1 and isContainer(item.uid) == TRUE then
local item_in = getContainerItem(item.uid, 0)
local uid = doPlayerAddItem(cid, item_in.itemid, 0, 1)
doSetItemText(uid, getItemDescriptions(item_in.uid).text)
doSetItemActionId(uid, item_in.actionid)
setPlayerStorageValue(cid, item.uid, 1)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You have found some interesting informations.')
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'The chest is empty.')
end
return TRUE
end