MadMOOK
Hoo
- Joined
- Apr 20, 2011
- Messages
- 802
- Reaction score
- 44
Mad Mooks crafting script.
Lets add this to actions.xml
Now lets create crafting.lua in actions/tools.
Make sure to add the unique id to the lever in map editor, and change the position to where your crafting tile is.
The table labeled material with itemId 2225, is iron ore. Change it if you like.
If you add new items to local craftTable, be sure to use commas to separate them!
You can change the second numbet to change quantities such as changing the one below to a two

Lets add this to actions.xml
Code:
<action uniqueid="41242" event="script" value="tools/crafting.lua"/>
Now lets create crafting.lua in actions/tools.
Code:
local config = {
material = 2225
}
local craftTable = {
{2195, 1},
{2149, 5},
{2160, 1},
{2063, 1},
{2127, 1},
{2160, 2},
{2160, 3},
{2477, 1},
{2476, 1}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local pos = {x = 1934, y = 1989, z = 8}
local rnd = craftTable[math.random(1,#craftTable)]
if getTileItemById(pos, config.material).uid > 0 then
if doRemoveItem(getTileItemById(pos,config.material).uid, 1) then
if item.itemid == 9825 then
doTransformItem(item.uid, 9826)
elseif item.itemid == 9826 then
doTransformItem(item.uid, 9825)
end
doPlayerAddItem(cid, rnd[1], rnd[2])
return true
end
end
doPlayerSendTextMessage(cid,MESSAGE_EVENT_ORANGE,"Wrong item on table.")
return true
end
Make sure to add the unique id to the lever in map editor, and change the position to where your crafting tile is.
The table labeled material with itemId 2225, is iron ore. Change it if you like.
If you add new items to local craftTable, be sure to use commas to separate them!
You can change the second numbet to change quantities such as changing the one below to a two
Code:
{2160, 1},
Last edited: