I'm working on a 8.54 Open Tibia Server using The Forgotten Server - Version 0.2.7 (Mystic Spirit).
I've made the following script but I keep getting errors when I try to change an item on a different location then the item I'm using.
Server\data\actions\actions.xml
Server\data\actions\scripts\quests\Ice Change.lua
When i use it i get the following error:
Console
After the delay I get the next error:
Console
If someone could look at this, that would be great
Thanks in advance.
I've made the following script but I keep getting errors when I try to change an item on a different location then the item I'm using.
Server\data\actions\actions.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<actions>
<!-- Quests -->
<action uniqueid="65535" script="quests/Ice Change.lua"/>
</actions>
Server\data\actions\scripts\quests\Ice Change.lua
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local function doTransformBack(Position, itemid, transformid)
return doTransformItem(getTileItemById(Position, transformid).uid, itemid)
end
if itemEx.itemid == 1945 and item.actionid == 65535 then
local rand = math.random(1, 1)
if rand == 1 then
doSendMagicEffect(toPosition,CONST_ME_ICEAREA)
doTargetCombatHealth(0, cid, COMBAT_ICEDAMAGE, -1000, -1000, CONST_ME_ICEAREA)
doTransformItem(itemEx.uid, 7021)
doTransformItem({x = toPosition.x-1, y = toPosition.y, z = toPosition.z}, 7017, 7025)
addEvent(doTransformBack, 1*20*1000, toPosition, itemEx.itemid, 7021)
addEvent(doTransformBack, 1*20*1000, {x = toPosition.x-1, y = toPosition.y, z = toPosition.z}, 7017, 7025)
end
end
return TRUE
end
When i use it i get the following error:
Console
Code:
[17/06/2015 11:57:04] Lua Script Error: [Action Interface]
[17/06/2015 11:57:04] data/actions/scripts/quests/Ice Change.lua:onUse
[17/06/2015 11:57:04] luaDoTransformItem(). Item not found
After the delay I get the next error:
Console
Code:
[17/06/2015 11:57:24] Lua Script Error: [Action Interface]
[17/06/2015 11:57:24] in a timer event called from:
[17/06/2015 11:57:24] data/actions/scripts/quests/Ice Change.lua:onUse
[17/06/2015 11:57:24] luaDoTransformItem(). Item not found
Thanks in advance.