• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua Clones Dungeon [Quest]

Carlitos Flow

Developer (lvl*1)
Joined
Mar 2, 2011
Messages
156
Solutions
4
Reaction score
10
Good day guys, well, im working on a script and need some help please... like this video (of course i will do for tibia):


*Im Using T.F.S 0.3.6
*When someone dead the team is kicked from the quest, and the team need wait 24hrs to try again.
*I will try use "boxes" because tibia doesn't have that "green containers.
*When the team kill all monsters (all boxes break) they finish the quest and add exp, and ofc the reward.
*If the team done the quest, they must wait 30 days for do the quest again.
*The "entrance" can be like an anihilator (4 tiles) and a lever, i have already added this on the script than im editing.
*From the boxes (green containers) when you broke the box will born a monster random [2nd script]. If im wrong you can say me please.
*When the team kill all monsters and they done the quest, this quest must reset automatically for another team than want to do. (Create the boxes again on the map). [I don't know how i can do this on the script]


*I Know, i don't have a good english and im new trying to learn lua, but this is than i did done of the script, and i really hope your help guys, thank guy.

actions/lever.lua
Code:
local playerA={
    {x=1154, y=1582, z=7},
    {x=1154, y=1581, z=7},
    {x=1154, y=1580, z=7},
    {x=1154, y=1579, z=7},
}
local playerB={
    {x=1154, y=1582, z=8},
    {x=1153, y=1582, z=8},
    {x=1152, y=1582, z=8},
    {x=1151, y=1582, z=8},
}
 local c = {
    Storage = 10540, -- Number Storage
    Tiempo = 30, -- Days for next quest
    Premio = { -- {ID item, how many items},
        {8309, 3}, -- Nail x3
        {10570, 2}, -- Which Hat x2
    },
  }

  local globalExhaust = {
    get = function (storage)
      local exhaust = getGlobalStorageValue(storage)
        if(exhaust > 0) then
          local left = exhaust - os.time()
            if(left >= 0) then
              return left
            end
        end
      return false
    end,
    set = function (storage, time)
        setGlobalStorageValue(storage, os.time() + time)
    end
  }

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local t = {}
    if item.itemid == 1945 then
        for i = 1, 4 do
            t[i]=getTopCreature(playerA[i]).uid
            if t[i] == 0 or not isPlayer(t[i]) then
                return doPlayerSendCancel(cid, 'You need 4 players for this quest.')
            elseif getPlayerLevel(t[i]) < 100 then
                return doPlayerSendCancel(cid, 'All players need to have level 100 or higher.')
            end
        end
 
    ---- When someone team is doing
          starting={x=58, y=1112, z=7, stackpos=253}
          checking={x=starting.x, y=starting.y, z=starting.z, stackpos=starting.stackpos}
          ending={x=142, y=1288, z=7, stackpos=253}
          players=0
          checking.x=checking.x+1
          if checking.x>ending.x then
          checking.x=starting.x
          checking.y=checking.y+1
       end

       local accID, nIP = getPlayerAccountId(cid), getPlayerIp(cid)
       local Belero = {
       [c.Storage+1] = {accID},
       [c.Storage+2] = {nIP},
       }
  
      ---- When start Quest
        for i = 1, #t do
            doTeleportThing(t[i], playerB[i])
            doSendMagicEffect(playerA[i], CONST_ME_POFF)
            doSendMagicEffect(playerB[i], CONST_ME_ENERGYAREA)
        end
    elseif players > 0 then
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Please wait for the team currently fighting to finish.')
     return false
     end
    elseif accID == getGlobalStorageValue(c.Storage+1) or nIP == getGlobalStorageValue(c.Storage+2) then
      doPlayerSendCancel(cid, (globalExhaust.get(c.Storage) > 0 and "You must wait " .. timeString(globalExhaust.get(c.Storage)) .. " days to do this quest again." or nil))
          return true
       elseif
        for k, v in pairs(Belero) do
            setGlobalStorageValue(k, v[1])
            globalExhaust.set(c.Storage, c.Tiempo * 24 * 60 * 60)
            addEvent(setGlobalStorageValue, c.Tiempo * 24 * 60 * 60 * 1000, k, -1)
        end
        for _, v in ipairs(c.Premio) do
            doPlayerAddItem(cid, v[1], v[2])
        end
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have already done your quest this month.!")
        return true
    end

action/box.lua
Code:
local summon={
    {'Dragon'},
    {'Demon'},
    {'Dragon Lord'},
    {'Fury'}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if item.itemid == xxxx then --- item from the box
    for i = 1, 4 #summon do
            doCreateMonster[math.random(unpack(summon[i]))]
            doRemoveItem(xxxx.uid, 1)  --- remove the box
        end
     end
 end
King Regards!
 
Last edited:

This will make the box disapear and summon 1 random monster from the summon table
I did also add item.actionid so it would need to be added to the "boxes" you want this to work at
Lua:
local summon={
    {'Dragon'},
    {'Demon'},
    {'Dragon Lord'},
    {'Fury'}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
   if (item.itemid == xxxx and item.actionid == xxxx) then --- item from the box
   local i = math.random(#summon)   -- select an random monster from the summon table
       doCreateMonster(summon[i], toPosition)   -- summon the monster
       doRemoveItem(item.uid, 1)  --- remove the box
   end
   return true
end

Edit:
I didnt check the other part of the script, im to tierd to do it right now.

It would also requier some more scripts, since you need something to keep track of the player kills/death (creatureevents) plain action scripts would not do it
 
Last edited:
This will make the box disapear and summon 1 random monster from the summon table
I did also add item.actionid so it would need to be added to the "boxes" you want this to work at
Lua:
local summon={
    {'Dragon'},
    {'Demon'},
    {'Dragon Lord'},
    {'Fury'}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
   if (item.itemid == xxxx and item.actionid == xxxx) then --- item from the box
   local i = math.random(#summon)   -- select an random monster from the summon table
       doCreateMonster(summon[i], toPosition)   -- summon the monster
       doRemoveItem(item.uid, 1)  --- remove the box
   end
   return true
end

Edit:
I didnt check the other part of the script, im to tierd to do it right now.

It would also requier some more scripts, since you need something to keep track of the player kills/death (creatureevents) plain action scripts would not do it
Sorry , i wasn't at home, well now i test the part of the script and didnt work, i used coal basin and this script don't show me any error on consola.
And for the other script yep i know, i need a storage, and something like on this... creaturescripts: (What do u think? @Up
Code:
     local CoalBasin = {
   [1] = {x=1154, y=1102, z=11, stackpos=1},
   [2] = {x=1145, y=1106, z=11, stackpos=1},
   [3] = {x=1148, y=1110, z=11, stackpos=1},
   [4] = {x=1149, y=1110, z=11, stackpos=1},
   [5] = {x=1150, y=1110, z=11, stackpos=1},
   [6] = {x=1151, y=1110, z=11, stackpos=1}
}

 ----- Reset quest
  function resetQuest()
    local coalBasinId = xxxx
    if players <= 0 and getTileItemById(coalBasin[i],coalBasinId, 1) then  
    doRemoveItem(coalBasinid[i],uid, 1)
    end
    for i = 1, 6 do
        doCreateItemEx(getThingfromPos(coalBasin[i],coalBasinId, 1)
        end
     end
    return true
  end


function onDeath(cid, corpse)
 
 local strFail = 10540
 
   areaPosition =
{
    {x = xxx, y = xxx, z = x, stackpos = 255},
    {x = xxx, y = xxx, z = x, stackpos = 255}
}

if getCreatureStorage(cid, strFail) > 0 and getCreatureStorage(cid, strFail) < 1 then
local creatures = getCreaturesInQuestArea(TYPE_MONSTER, questAreaPosition[1], questAreaPosition[2], GET_UID)
if creatures and #creatures > 0 then
for _, it in ipairs(creatures) do
doRemoveCreature(it)
end
end
doCreatureSetStorage(cid, strFail, 0)
doresetQuest() -- reset the quest, add the items on the map again
addEvent -- [24 hrs to try again]
end
return true
end
 
Last edited:
Sorry , i wasn't at home, well now i test the part of the script and didnt work, i used coal basin and this script don't show me any error on consola.
And for the other script yep i know, i need a storage, and something like on this... creaturescripts: (What do u think? @Up
Code:
     local CoalBasin = {
   [1] = {x=1154, y=1102, z=11, stackpos=1},
   [2] = {x=1145, y=1106, z=11, stackpos=1},
   [3] = {x=1148, y=1110, z=11, stackpos=1},
   [4] = {x=1149, y=1110, z=11, stackpos=1},
   [5] = {x=1150, y=1110, z=11, stackpos=1},
   [6] = {x=1151, y=1110, z=11, stackpos=1}
}

 ----- Reset quest
  function resetQuest()
    local coalBasinId = xxxx
    if players <= 0 and getTileItemById(coalBasin[i],coalBasinId, 1) then
    doRemoveItem(coalBasinid[i],uid, 1)
    end
    for i = 1, 6 do
        doCreateItemEx(getThingfromPos(coalBasin[i],coalBasinId, 1)
        end
     end
    return true
  end


function onDeath(cid, corpse)
 
 local strFail = 10540
 
   areaPosition =
{
    {x = xxx, y = xxx, z = x, stackpos = 255},
    {x = xxx, y = xxx, z = x, stackpos = 255}
}

if getCreatureStorage(cid, strFail) > 0 and getCreatureStorage(cid, strFail) < 1 then
local creatures = getCreaturesInQuestArea(TYPE_MONSTER, questAreaPosition[1], questAreaPosition[2], GET_UID)
if creatures and #creatures > 0 then
for _, it in ipairs(creatures) do
doRemoveCreature(it)
end
end
doCreatureSetStorage(cid, strFail, 0)
doresetQuest() -- reset the quest, add the items on the map again
addEvent -- [24 hrs to try again]
end
return true
end
Sorry, but that script dont make sense. i will try to help you out as soon i got time.

an about the summon monster script i provided test this one

Lua:
local summon={
    {'Dragon'},
    {'Demon'},
    {'Dragon Lord'},
    {'Fury'}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
   if (item.itemid == xxxx and item.actionid == xxxx) then --- item from the box
   local i = math.random(1, #summon)   -- select an random monster from the summon table
       doCreateMonster(summon[i], getCreaturePosition(cid))   -- summon the monster
       doRemoveItem(item.uid, 1)  --- remove the box
   end
   return true
end
 
Sorry, but that script dont make sense. i will try to help you out as soon i got time.

an about the summon monster script i provided test this one

Lua:
local summon={
    {'Dragon'},
    {'Demon'},
    {'Dragon Lord'},
    {'Fury'}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
   if (item.itemid == xxxx and item.actionid == xxxx) then --- item from the box
   local i = math.random(1, #summon)   -- select an random monster from the summon table
       doCreateMonster(summon[i], getCreaturePosition(cid))   -- summon the monster
       doRemoveItem(item.uid, 1)  --- remove the box
   end
   return true
end
It didn't work... :/ and the other script i think should be at creaturescripts if someplayer dead all team will be kicked from the quest and add event with storage for try on 24 hours again, and ofc, the quest must be reseted and remove monster of the quest and the coal basin for other team than want try.

@Edit: maybe its the pos? Idk..
 
It didn't work... :/ and the other script i think should be at creaturescripts if someplayer dead all team will be kicked from the quest and add event with storage for try on 24 hours again, and ofc, the quest must be reseted and remove monster of the quest and the coal basin for other team than want try.

@Edit: maybe its the pos? Idk..
It was returning an empty string (didnt know what monster to summon), but this script will now work for the summon part. The other scripts have to wait for now since i have some other requests im working on.

Lua:
local summon={
    {'Dragon'},
    {'Demon'},
    {'Dragon Lord'},
    {'Fury'}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
   if (item.itemid == xxxx and item.actionid == xxxx) then -- Change itemid and actionid
   local i = math.random(#summon)
       doRemoveItem(item.uid, 1)
      doCreateMonster(summon[i][1], toPosition)
      doSendMagicEffect(toPosition, CONST_ME_TELEPORT)
   end
   return true
end
 
It was returning an empty string (didnt know what monster to summon), but this script will now work for the summon part. The other scripts have to wait for now since i have some other requests im working on.

Lua:
local summon={
    {'Dragon'},
    {'Demon'},
    {'Dragon Lord'},
    {'Fury'}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
   if (item.itemid == xxxx and item.actionid == xxxx) then -- Change itemid and actionid
   local i = math.random(#summon)
       doRemoveItem(item.uid, 1)
      doCreateMonster(summon[i][1], toPosition)
      doSendMagicEffect(toPosition, CONST_ME_TELEPORT)
   end
   return true
end

Well idk what was the problem but i fix it with unique Ids, and now i need to create the others scripts, could you help me please?:

Lua:
local summon={
    {'Dragon'},
    {'Demon'},
    {'Dragon Lord'},
    {'Fury'}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
   if item.uid == 43600 then 
   local i = math.random(#summon)
      doRemoveItem(item.uid, 1)
      doCreateMonster(summon[i][1], toPosition)
      doSendMagicEffect(toPosition, CONST_ME_TELEPORT)
   end
   return true
end
 
It was returning an empty string (didnt know what monster to summon), but this script will now work for the summon part. The other scripts have to wait for now since i have some other requests im working on.

Lua:
local summon={
    {'Dragon'},
    {'Demon'},
    {'Dragon Lord'},
    {'Fury'}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
   if (item.itemid == xxxx and item.actionid == xxxx) then -- Change itemid and actionid
   local i = math.random(#summon)
       doRemoveItem(item.uid, 1)
      doCreateMonster(summon[i][1], toPosition)
      doSendMagicEffect(toPosition, CONST_ME_TELEPORT)
   end
   return true
end

I create the entrance, but it doesn't work, i wan't set a unique id to the items than will create monsters.
Lua:
local config ={

level = 1,
storage = 30015,
lampId = 2344,
   
entry ={
{x=1075, y=992, z=7, stackpos=253},
{x=1075, y=994, z=7, stackpos=253},
{x=1077, y=992, z=7, stackpos=253},
{x=1077, y=994, z=7, stackpos=253}
},

destination ={
{x=1097, y=989, z=7, stackpos= 253},
{x=1099, y=989, z=7, stackpos= 253},
{x=1101, y=989, z=7, stackpos= 253},
{x=1103, y=989, z=7, stackpos= 253}
},

lampPos ={
{x=1095, y=994, z=5, stackpos=1},
{x=1097, y=998, z=5, stackpos=1},
{x=1100, y=1005, z=5, stackpos=1}
},
}




function onUse(cid, item, fromPosition, itemEx, toPosition)
starting={x=1090, y=987, z=7, stackpos=253}
checking={x=starting.x, y=starting.y, z=starting.z, stackpos=starting.stackpos}
ending={x=1109, y=1012, z=7, stackpos=253}
players=0
checking.x=checking.x+1
 if checking.x>ending.x then
 checking.x=starting.x
 checking.y=checking.y+1
 end

if(item.itemid == 1946 and players > 0) then
return TRUE,doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Please wait for the other team leave the room currently fighting to finish.')
end

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

local function appear(pos)
if getThingFromPos(pos).itemid ~= Config.lampId then
doCreateItem(Config.lampId,1,pos)
doSendMagicEffect(pos,CONST_ME_SMALLPLANTS)
end
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)   
        addEvent(appear, config.lampPos)
        doSetItemUniqueId(appear, 43600)
        end
   
    doTransformItem(item.uid, item.itemid + 1)
    return true
end
 
Well idk what was the problem but i fix it with unique Ids, and now i need to create the others scripts, could you help me please?:

Lua:
local summon={
    {'Dragon'},
    {'Demon'},
    {'Dragon Lord'},
    {'Fury'}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
   if item.uid == 43600 then
   local i = math.random(#summon)
      doRemoveItem(item.uid, 1)
      doCreateMonster(summon[i][1], toPosition)
      doSendMagicEffect(toPosition, CONST_ME_TELEPORT)
   end
   return true
end

I recommend not to use unique id. Use action id instead, since you will use the script on more than one item.

This code should do the job
Lua:
local summon={
    {'Dragon'},
    {'Demon'},
    {'Dragon Lord'},
    {'Fury'}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
   if item.actionid == 43600 then
   local i = math.random(#summon)
      doRemoveItem(item.uid)
      doCreateMonster(summon[i][1], toPosition)
      doSendMagicEffect(toPosition, CONST_ME_TELEPORT)
   end
   return true
end

I will help you whit the other scripts when i got time for it.
Right now im busy helping some guy whit a CTF event
 
I recommend not to use unique id. Use action id instead, since you will use the script on more than one item.

This code should do the job
Lua:
local summon={
    {'Dragon'},
    {'Demon'},
    {'Dragon Lord'},
    {'Fury'}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
   if item.actionid == 43600 then
   local i = math.random(#summon)
      doRemoveItem(item.uid)
      doCreateMonster(summon[i][1], toPosition)
      doSendMagicEffect(toPosition, CONST_ME_TELEPORT)
   end
   return true
end

I will help you whit the other scripts when i got time for it.
Right now im busy helping some guy whit a CTF event
Well bro, but seeing my Last post of begin of The quest what do u think of my code? Also it will be need a creaturescripts for when player death and globalevents maybe for reset The quest right? Btw thank you so much for all help and i hope we might finish the quest
 
Well bro, but seeing my Last post of begin of The quest what do u think of my code? Also it will be need a creaturescripts for when player death and globalevents maybe for reset The quest right? Btw thank you so much for all help and i hope we might finish the quest

Its a good start but need some more edits, it also need a creaturescript, and a globalevent might be good aswell.
But as i said im busy whit an other script/mod, well its almost done. When im done whit that ill help you out.
 
Its a good start but need some more edits, it also need a creaturescript, and a globalevent might be good aswell.
But as i said im busy whit an other script/mod, well its almost done. When im done whit that ill help you out.
Sup bro, how are u? U will help me?
 
BUMP! please i don't know how i can create this, and the most hard 4 players wth storages if someone dead all team is kicked from the quest...

Bump!
 
Last edited by a moderator:
To achieve 'all playes kicked from quest' put
Lua:
registerCreatureEvent(cid, kickondeath)
for each player in whatever script initiates the quest then
XML:
    <event type="death" name="kickondeath" script="kickondeath.lua" />
then in kickondeath.lua
Lua:
dofile('data/xxxevents/scripts/quest.lua')
local pos = {x=1000,y=1000,z=7}
function onDeath(cid, corpse, killer, mostDamageKiller, unjustified, mostDamageUnjustified)
    doTeleportThing(PLAYER1CID, pos)
    doTeleportThing(PLAYER2CID, pos)
    doTeleportThing(PLAYER3CID, pos)
    doTeleportThing(PLAYER4CID, pos)
    doPlayerSendTextMessage(PLAYER1CID,MESSAGE_INFO_DESCR, ""..cid.." has died and you have all been ejected!")
    doPlayerSendTextMessage(PLAYER2CID,MESSAGE_INFO_DESCR, ""..cid.." has died and you have all been ejected!")
    doPlayerSendTextMessage(PLAYER3CID,MESSAGE_INFO_DESCR, ""..cid.." has died and you have all been ejected!")
    doPlayerSendTextMessage(PLAYER4CID,MESSAGE_INFO_DESCR, ""..cid.." has died and you have all been ejected!")
    return true
end
 
To achieve 'all playes kicked from quest' put
Lua:
registerCreatureEvent(cid, kickondeath)
for each player in whatever script initiates the quest then
XML:
    <event type="death" name="kickondeath" script="kickondeath.lua" />
then in kickondeath.lua
Lua:
dofile('data/xxxevents/scripts/quest.lua')
local pos = {x=1000,y=1000,z=7}
function onDeath(cid, corpse, killer, mostDamageKiller, unjustified, mostDamageUnjustified)
    doTeleportThing(PLAYER1CID, pos)
    doTeleportThing(PLAYER2CID, pos)
    doTeleportThing(PLAYER3CID, pos)
    doTeleportThing(PLAYER4CID, pos)
    doPlayerSendTextMessage(PLAYER1CID,MESSAGE_INFO_DESCR, ""..cid.." has died and you have all been ejected!")
    doPlayerSendTextMessage(PLAYER2CID,MESSAGE_INFO_DESCR, ""..cid.." has died and you have all been ejected!")
    doPlayerSendTextMessage(PLAYER3CID,MESSAGE_INFO_DESCR, ""..cid.." has died and you have all been ejected!")
    doPlayerSendTextMessage(PLAYER4CID,MESSAGE_INFO_DESCR, ""..cid.." has died and you have all been ejected!")
    return true
end
Well it could works for that part, thanks you. Also it need a storage for 4 players and reset The quest if some one dead, I dont have the knowledge for exemple, if team open 3/10 boxes and someone dead it will need reset to 0/10 and when the team isInArea set 30 min for end or will be kicked. Bump
 
Change
Lua:
for k, v in pairs(Belero) do
            setGlobalStorageValue(k, v[1])
            globalExhaust.set(c.Storage, c.Tiempo * 24 * 60 * 60)
            addEvent(setGlobalStorageValue, c.Tiempo * 24 * 60 * 60 * 1000, k, -1)
        end
To
Lua:
for k, v in pairs(Belero) do
    setGlobalStorageValue(k, v[1])
    globalExhaust.set(c.Storage,30*60*1000)
    addEvent(setGlobalStorageValue, 30*60*1000, k, -1)
end
for i=1,#t do
    registerCreatureEvent(t[i], 'kickondeath')
    addEvent(function()
        if t[i] then
            doPlayerSendTextMessage(t[i], MESSAGE_INFO_DESCR, "You have 5 minutes left to complete the quest!")
        end
    end, 25*60*1000)
    addEvent(function()
        if t[i] then
            doTeleportThing(t[i], playerA[i])
            doPlayerSendTextMessage(t[i], MESSAGE_INFO_DESCR, "Your 30 minutes is up, better luck next time.")
            unregisterCreatureEvent(t[i], 'kickondeath')
        end
    end, 30*60*1000)
end
and in kickondeath.lua:
Lua:
dofile('data/actions/lever.lua')
function onDeath(cid, corpse, killer, mostDamageKiller, unjustified, mostDamageUnjustified)
    for i=1,#t do 
        unregisterCreatureEvent(t[i], 'kickondeath')
        doTeleportThing(t[i], playerA[i])
        doPlayerSendTextMessage(t[i],MESSAGE_INFO_DESCR, ""..cid.." has died and you have all been ejected!")
    end
    setGlobalStorageValue(c.Storage+1,-1)
    setGlobalStorageValue(c.Storage+2,-1)
    return true
end
 
Last edited:
Change
Lua:
for k, v in pairs(Belero) do
            setGlobalStorageValue(k, v[1])
            globalExhaust.set(c.Storage, c.Tiempo * 24 * 60 * 60)
            addEvent(setGlobalStorageValue, c.Tiempo * 24 * 60 * 60 * 1000, k, -1)
        end
To
Lua:
for k, v in pairs(Belero) do
    setGlobalStorageValue(k, v[1])
    globalExhaust.set(c.Storage,30*60*1000)
    addEvent(setGlobalStorageValue, 30*60*1000, k, -1)
end
for i=1,#t do
    registerCreatureEvent(t[i], 'kickondeath')
    addEvent(function()
        if t[i] then
            doPlayerSendTextMessage(t[i], MESSAGE_INFO_DESCR, "You have 5 minutes left to complete the quest!")
        end
    end, 25*60*1000)
    addEvent(function()
        if t[i] then
            doTeleportThing(t[i], playerA[i])
            doPlayerSendTextMessage(t[i], MESSAGE_INFO_DESCR, "Your 30 minutes is up, better luck next time.")
            unregisterCreatureEvent(t[i], 'kickondeath')
        end
    end, 30*60*1000)
end
and in kickondeath.lua:
Lua:
dofile('data/actions/lever.lua')
function onDeath(cid, corpse, killer, mostDamageKiller, unjustified, mostDamageUnjustified)
    for i=1,#t do
        unregisterCreatureEvent(t[i], 'kickondeath')
        doTeleportThing(t[i], playerA[i])
        doPlayerSendTextMessage(t[i],MESSAGE_INFO_DESCR, ""..cid.." has died and you have all been ejected!")
    end
    setGlobalStorageValue(c.Storage+1,-1)
    setGlobalStorageValue(c.Storage+2,-1)
    return true
end
Nice Aled, but the most hard for me its thats the part if someone dead and they already broke 5/10 boxes, the team is kicked [OK] and reset all box of the quest (create it again(the 5 brokes of 10)) if they done, the team is teleported and create the box again for next team.

Kind:
Lua:
dofile('data/actions/lever.lua')
function resetQuest()  --- Like this?

local box = {
{ x = x, y = y, z = z, stackpos = 1 },
{ x = x, y = y, z = z, stackpos = 1 },
{ x = x, y = y, z = z, stackpos = 1 },
{ x = x, y = y, z = z, stackpos = 1 },
{ x = x, y = y, z = z, stackpos = 1 }
}
local boxid = xxxx
for i = 1, #box
        if getGlobalStorageValue(c.Storage+1,-1) and getGlobalStorageValue(c.Storage+2,-1) and getThingfromPos(boxid).itemid ~= 0 then
       box = getThingFromPos(#box)
        doSetItemActionId(box.uid,1000)
         doCreateItem(boxid, #box)
end
    return TRUE
end
 

function onDeath(cid, corpse, killer, mostDamageKiller, unjustified, mostDamageUnjustified)
    for i=1,#t do
        unregisterCreatureEvent(t[i], 'kickondeath')
        doTeleportThing(t[i], playerA[i])
        doPlayerSendTextMessage(t[i],MESSAGE_INFO_DESCR, ""..cid.." has died and you have all been ejected!")
   resetQuest()
    end
    setGlobalStorageValue(c.Storage+1,-1)
    setGlobalStorageValue(c.Storage+2,-1)
    return true
end
[/QUOTE]
 
Last edited:
What happens exactly when the boxes are 'destroyed'? You use an item to transform them to trash or something? or is it just a storage value somewhere?
 
What happens exactly when the boxes are 'destroyed'? You use an item to transform them to trash or something? or is it just a storage value somewhere?
Yep on Pokemon you broke containers of mewtwo, born a pokemon randomly and the container transform to item broke (on my case box cuz is tibia and it could be trash or just remove) and the quest have as 50 containers, when all containers are broked, (and killed all Pokemons of the containers(on my case monster)) the team(4 players) are teleported out of the quest, and got the reward automatically (5kk exp, 5 boost stones, and tokens of pokemon for held items) but the reward i could edit. Also you can see the video at top of the post to know how it is. Did u understand?
When done the quest, the players only can do that quest again on 1 month.
If someone dead the playes only can try again on 24 hours.
 
Back
Top