I posted this on otfans but was not successful with getting it to work, so I'll try here.
The Forgotten Server - Version 0.2 <Mystic Spitit>.
Tibia 8.4
I want a script that transforms boots of haste + Soft boots + Steel boots into Golden boots when a lever is hit.
Here is a picture of how it could work out:
This is what somebody gave me to use:
This is the errors I recieve:
Somebody told me to add:
in global.lua but then I recieve:
I tried adding it into functions.lua, but it won't work either.
The Forgotten Server - Version 0.2 <Mystic Spitit>.
Tibia 8.4
I want a script that transforms boots of haste + Soft boots + Steel boots into Golden boots when a lever is hit.
Here is a picture of how it could work out:
This is what somebody gave me to use:
-- CONFIG --
local itemID = 2358 -- Item ID1 required on coal basin
local itemId = 2646 -- Item ID2 required on coal basin
local item_ID = 6132 -- Item ID3 required on coal basin
local newItem = 5462 -- Item ID of the new item
local itemPOS = {x=135, y=763, z=12, stackpos=1} -- Item position1 on coal basin
local itemPos = {x=136, y=763, z=12, stackpos=1} -- Item position2 on coal basin
local itemPos = {x=137, y=763, z=12, stackpos=1} -- Item position3 on coal basin
local newPos = {x=136, y=762, z=12} -- Position of where the new item comes
local backTime = 1 -- How many minutes till the switch gets back by itself
-- CONFIG END --
function onUse(cid, item, frompos, item2, topos)
if item.itemid == 1945 and item.uid == 10010 then
local item_one = getTileItemById(itemPOS, itemID)
local item_two = getTileItemById(itemPos, itemId)
local item_three = getTileItemById(item_POS, item_ID)
if item_one.uid > 0 and item_two.uid > 0 and item_three.uid > 0 then
doSendMagicEffect(itemPOS, 13)
doSendMagicEffect(itemPos, 13)
doSendMagicEffect(item_POS, 13)
doRemoveItem(item_one.uid, 1)
doRemoveItem(item_two.uid, 1)
doRemoveItem(item_three.uid, 1)
doCreateItem(newItem,1,newPos)
doSendMagicEffect(newPos, 14)
doPlayerSendTextMessage(cid,22,"You have transformed all the boots into ultimate boots!")
doSendMagicEffect(getPlayerPosition(cid), 13)
doTransformItem(item.uid, 1946)
addEvent(switchBack, backTime * 60 * 1000, frompos)
else
doPlayerSendCancel(cid,"You have to put the item on the basin.")
end
end
return TRUE
end
function wallBack(x)
doTransformItem(3000, 1945)
end
This is the errors I recieve:
[27/02/2009 15:13:37] Lua Script Error: [Action Interface]
[27/02/2009 15:13:37] data/actions/scripts/boots.luanUse
[27/02/2009 15:13:37] attempt to index a nil value
[27/02/2009 15:13:37] stack traceback:
[27/02/2009 15:13:37] [C]: in function 'getTileItemById'
[27/02/2009 15:13:37] data/actions/scripts/boots.lua:18: in function <data/actions/scripts/boots.lua:13>
Somebody told me to add:
function getTileItemById(pos, itemid)
pos.stackpos = 0
local thing = getThingfromPos(pos)
while thing.uid > 0 and thing.itemid ~= itemid do
pos.stackpos = pos.stackpos + 1
thing = getThingfromPos(pos)
end
return thing
end
in global.lua but then I recieve:
[27/02/2009 16:53:35] Lua Script Error: [Action Interface]
[27/02/2009 16:53:35] data/actions/scripts/transformboots.luanUse
[27/02/2009 16:53:35] data/global.lua:532: attempt to index local 'pos' (a nil value)
[27/02/2009 16:53:35] stack traceback:
[27/02/2009 16:53:35] data/global.lua:532: in function 'getTileItemById'
[27/02/2009 16:53:35] data/actions/scripts/transformboots.lua:18: in function <data/actions/scripts/transformboots.lua:13>
I tried adding it into functions.lua, but it won't work either.