I'm getting this error:
i tried Tile(position) aswell, but didnt work obviously.
script.
Thanks in advance.
Code:
Lua Script Error: [Action Interface]
data/actions/scripts/quests/demon helmet.lua:onUse
data/actions/scripts/quests/demon helmet.lua:9: attempt to call method 'getTile' (a nil value)
stack traceback:
[C]: in function 'getTile'
data/actions/scripts/quests/demon helmet.lua:9: in function <data/actions/scripts/quests/demon helmet.lua:7>
i tried Tile(position) aswell, but didnt work obviously.
script.
Code:
local t = {
Position(1222, 897, 10), -- stone position
Position(1224, 896, 10), -- teleport creation position
Position(1230, 914, 9) -- where the teleport takes you
}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if item.itemid == 1945 then
local tile = t[1]:getTile()
if tile then
local stone = tile:getItemById(1355)
if stone then
stone:remove()
end
end
local teleport = Game.createItem(1387, 1, t[2])
if teleport then
teleport:setDestination(t[3])
t[2]:sendMagicEffect(CONST_ME_TELEPORT)
end
elseif item.itemid == 1946 then
local tile = t[2]:getTile()
if tile then
local teleport = tile:getItemById(1387)
if teleport and teleport:isTeleport() then
teleport:remove()
end
end
t[2]:sendMagicEffect(CONST_ME_POFF)
Game.createItem(1355, 1, t[1])
end
return item:transform(item.itemid == 1945 and 1946 or 1945)
end
Thanks in advance.