My annihilator script refuses to teleport the players, nothing happens when i use the lever, except the lever switching side.. what have I done wrong?
Ingame
Actions.xml
\scripts\quests\fire instance.lua
Ingame
Code:
Changed uniqueID to lever:
ItemID: [1945], UniqueID: [8007].
Position: [X: 1126] [Y: 820] [Z: 6].
Actions.xml
Code:
<action uniqueid="8007" event="script" value="quests/fire instance.lua"/>
\scripts\quests\fire instance.lua
Code:
local config = {
daily = "no", -- allow only one enter per day? (like in global Tibia)
level = 400,
storage = 30015
}
local playerPosition =
{
{x = 1125, y = 820, z = 6},
{x = 1125, y = 821, z = 6}
}
local newPosition =
{
{x = 557, y = 1012, z = 4},
{x = 557, y = 1013, z = 4}
}
config.daily = getBooleanFromString(config.daily)
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(item.itemid == 1946) then
if(config.daily) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You can only run this instance once a day!")
else
doTransformItem(item.uid, item.itemid - 1)
end
return true
end
if(item.itemid ~= 1945) then
return true
end
local players = {}
for _, pos in ipairs(playerPosition) do
local pid = getTopCreature(pos).uid
if(pid == 0 or not isPlayer(pid) or getPlayerStorageValue(pid, config.storage) > 0 or getPlayerLevel(pid) < config.level) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
return true
end
players[i] = pid
end
for i, pid in ipairs(players) do
doSendMagicEffect(playerPosition[i], CONST_ME_POFF)
doTeleportThing(pid, newPosition[i], false)
doSendMagicEffect(newPosition[i], CONST_ME_ENERGYAREA)
end
doTransformItem(item.uid, item.itemid + 1)
return true
end