I made a crafting system where you can combine items and get another one
here is the script for now
so please suggest some recipes
here is the script for now
Lua:
--!craft
--to create workbench(1738) and to use it
local craftingtable = {}
function insertsequence(...) --last four items in the sequence are the result's itemid, count, text and description
local args = {...}
local v = craftingtable
for t=1,#args-5 do
if not v[args[t]] then
v[args[t]] = {}
end
v=v[args[t]]
end
if not v[args[#args-4]] then
v[args[#args-4]] = {}
end
v[args[#args-4]].itemid=args[#args-3]
v[args[#args-4]].count=args[#args-2]
v[args[#args-4]].text=args[#args-1]
v[args[#args-4]].description=args[#args]
end
--insertsequence(5901,5901,5901,5901,1738,1,"","") --workbench
insertsequence(5901,5901,2401,1,"","") --stick poe count 4 dps
insertsequence(5901,2401,2401,2554,1,"w","It is made of wood.") --wooden shovel
insertsequence(5901,5901,2401,2376,1,"w","It is made of wood.") --wooden sword
insertsequence(5901,5901,5901,2401,2401,2386,1,"w","It is made of wood.") --wooden axe
insertsequence(5901,5901,5901,5901,2401,2401,2553,1,"w","It is made of wood.") --wooden pick
insertsequence(1294,2401,2401,2554,1,"s","It is made of stone.") --stone shovel
insertsequence(1294,1294,2401,2376,1,"s","It is made of stone.") --stone sword
insertsequence(1294,1294,1294,2401,2401,2386,1,"s","It is made of stone.") --stone axe
insertsequence(1294,1294,1294,1294,2401,2401,2553,1,"s","It is made of stone.") --stone pick
insertsequence(5880,2401,2401,2554,1,"i","It is made of iron.") --iron shovel --usando iron ore, mudar pra ingot depois
insertsequence(5880,5880,2401,2376,1,"i","It is made of iron.") --iron sword
insertsequence(5880,5880,5880,2401,2401,2386,1,"i","It is made of iron.") --iron axe
insertsequence(5880,5880,5880,5880,2401,2401,2553,1,"i","It is made of iron.") --iron pick
insertsequence(2157,2401,2401,2554,1,"g","It is made of gold.") --gold shovel --usando gold ore/nugget, mudar pra ingot depois
insertsequence(2157,2157,2401,2376,1,"g","It is made of gold.") --gold sword
insertsequence(2157,2157,2157,2401,2401,2386,1,"g","It is made of gold.") --gold axe
insertsequence(2157,2157,2157,2157,2401,2401,2553,1,"g","It is made of gold.") --gold pick
insertsequence(2145,2401,2401,2554,1,"d","It is made of diamond.") --diamond shovel
insertsequence(2145,2145,2401,2376,1,"d","It is made of diamond.") --diamond sword
insertsequence(2145,2145,2145,2401,2401,2386,1,"d","It is made of diamond.") --diamond axe
insertsequence(2145,2145,2145,2145,2401,2401,2553,1,"d","It is made of diamond.") --diamond pick
insertsequence(5901,5901,5901,5901,3909,1,"w","It is a kit for a wooden wall.")
insertsequence(1294,1294,1294,1294,3909,1,"s","It is a kit for a stone wall.") --stone wall construction kit, dps mudo a quantidade de stones
insertsequence(5880,5880,5880,5880,3909,"i","It is a kit for a iron wall.")
--insertsequence(brickid,brickid,brickid,brickid,3909,"b","It is a kit for a brick wall.") --nao existe no 8.1
insertsequence(5901,5901,5901,5901,5901,5901,3909,1,"door","It is a kit for a wooden door.")
function removecount(thing,count)
if thing.type > count then
doChangeTypeItem(thing.uid,thing.type-count)
return true
elseif thing.type == count or thing.type == 0 then
doRemoveItem(thing.uid)
return true
end
return false
end
function useBench(bench,pos)
local t = {}
for slot=0,15 do
local item = getContainerItem(bench.uid, slot)
if item.itemid > 0 then
table.insert(t,item)
else
break
end
end
local v = craftingtable
for x=1,#t do
v=v[t[x].itemid]
if not v then
return
--elseif type(v.itemid) == "number" and x<#t then
-- return
end
end
if type(v.itemid) == "number" then
for x=1,#t do
removecount(t[x],1)
end
--doRemoveItem(bench.uid)
--local bench2uid = doCreateItem(1738,1,pos)
local crafted = doAddContainerItem(bench.uid, v.itemid,v.count)
if #v.text > 0 then doSetItemText(crafted, v.text) end
if #v.description > 0 then doSetItemSpecialDescription(crafted, v.description) end
end
end
function onSay(cid, words, param)
local left = getPlayerSlotItem(cid, CONST_SLOT_LEFT)
local right = getPlayerSlotItem(cid, CONST_SLOT_RIGHT)
if right.itemid == 5901 and left.itemid == 5901 then
if right.type>=2 and left.type>=2 then
removecount(right,2)
removecount(left,2)
doPlayerAddItem(cid,1738)
return
end
end
local pos = getThingPos(cid)
local bench = getTileItemById(pos,1738)
if bench.itemid > 0 then
useBench(bench,pos)
end
end
so please suggest some recipes