Hello, could someone explain to me how this scripts works, I am new to this. I downloaded a data pack that had this anihilator quest script but don't know how to make it work.
What do I need to put on lever action and unique ID?
Does storage has to be the same as unique id from lever and unique id from actions.xml?
I would really appreciate if someone could help me.
Thanks.
data/actions/actions.xml
actions/scripts/quests/annihilator.lua
What do I need to put on lever action and unique ID?
Does storage has to be the same as unique id from lever and unique id from actions.xml?
I would really appreciate if someone could help me.
Thanks.
data/actions/actions.xml
XML:
<action uniqueid="30015" event="script" value="quests/annihilator.lua"/>
actions/scripts/quests/annihilator.lua
Lua:
local config = {
daily = "no", -- allow only one enter per day? (like in global Tibia)
level = 100,
storage = 30015,
entry =
{
{x = 782, y = 1461, z = 7},
{x = 781, y = 1461, z = 7},
{x = 780, y = 1461, z = 7},
{x = 779, y = 1461, z = 7}
},
destination =
{
{x = 782, y = 1461, z = 8},
{x = 781, y = 1461, z = 8},
{x = 780, y = 1461, z = 8},
{x = 779, y = 1461, z = 8}
}
}
config.daily = getBooleanFromString(config.daily)
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(item.itemid == 1946) then
if(config.daily) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
else
doTransformItem(item.uid, item.itemid - 1)
end
return true
end
if(item.itemid ~= 1945) then
return true
end
local players = {}
for _, position in ipairs(config.entry) do
local pid = getTopCreature(position).uid
if(pid == 0 or not isPlayer(pid) or getCreatureStorage(pid, config.storage) > 0 or getPlayerLevel(pid) < config.level) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
return true
end
table.insert(players, pid)
end
for i, pid in ipairs(players) do
doSendMagicEffect(config.entry[i], CONST_ME_POFF)
doTeleportThing(pid, config.destination[i], false)
doSendMagicEffect(config.destination[i], CONST_ME_ENERGYAREA)
end
doTransformItem(item.uid, item.itemid + 1)
return true
end