• TibiaFace

    Tibiaface | Una comunidad Open Tibia donde encontras : mapas, scripts, Otserver, npc y amigos etc ...

    .
    demo menumenu

    Afiliados



    Votar:

    task storage

    Compartir:

    Ver el tema anterior Ver el tema siguiente Ir abajo  Mensaje (Página 1 de 1.)

    1task storage Empty task storage Miér Ago 25, 2021 4:07 am

    ioke

    ioke
    Miembro
    Miembro
    Descripcion escribió:veran tengo un mod de task que va genial el problema viene que he hecho un movements para Boss room pero quiero que me reconozca la storage de cuando completo una task pero no hay manera de que coja la storage y no hay errores en consola.

    task mod

    Código:
    <?xml version="1.0" encoding="UTF-8"?>  

    <mod name="Simple Task" version="3.0" author="Vodkart" contact="tibiaking.com" enabled="yes">  

    <config name="task_func"><![CDATA[


    tasktabble = {

    ["troll"] = {monster_race={"troll","frost troll","furious troll","island troll","swamp troll","troll champion","troll legionnaire"}, storage_start = 200201, storage = 91001, count = 40,exp = 2000,money = 2000},

    ["rotworm"] = {monster_race={"rotworm","carrion worm","rotworm queen"}, storage_start = 200202, storage = 91002,count = 50,exp = 2500,money = 3000},

    ["green djinn"] = {monster_race={"green djinn","efreet"}, storage_start = 200203, storage = 91003,count = 80,exp = 10000,money = 5000},

    ["cyclops"] = {monster_race={"cyclops","cyclops smith","cyclops drone"}, storage_start = 200204, storage = 91004,count = 60,exp = 3000,money = 3000},

    ["blue djinn"] = {monster_race={"blue djinn","marid"}, storage_start = 200205, storage = 91005,count = 80,exp = 10000,money = 5000},

    ["pirates"] = {monster_race={"Pirate Marauder","Pirate Cutthroat","Pirate Buccaneer","Pirate Corsair"}, storage_start = 200206, storage = 91006,count = 120,exp = 10000,money = 5000},

    ["stone golem"] = {monster_race={"stone golem"}, storage_start = 200207, storage = 91007,count = 130,exp = 12000,money = 7000},

    ["carniphila"] = {monster_race={"carniphila"}, storage_start = 200208, storage = 91008,count = 135,exp = 8000,money = 8000},

    ["serpent spawn"] = {monster_race={"serpent spawn"}, storage_start = 200209, storage = 91009,count = 720,exp = 50000,money = 45000},

    ["ice golem"] = {monster_race={"ice golem"}, storage_start = 200210, storage = 91010,count = 150,exp = 12000,money = 8200},

    ["crystal spider"] = {monster_race={"crystal spider"}, storage_start = 200211, storage = 91011,count = 250,exp = 25000,money = 11000},

    ["mutated rat"] = {monster_race={"mutated rat"}, storage_start = 200212, storage = 91012,count = 170,exp = 8000,money = 8500},

    ["necromancer"] = {monster_race={"necromancer"}, storage_start = 200213, storage = 91013,count = 200,exp = 20000,money = 15000},

    ["hellhound"] = {monster_race={"hellhound"}, storage_start = 200214, storage = 91014,count= 650, exp = 30000,money = 35000},

    ["demon"] = {monster_race={"demon"}, storage_start = 200215, storage = 91016,count = 666, exp = 66600, money = 66000},

    ["orc"] = {monster_race={"Orc Berserker","Orc Rider","Orc Leader","Orc Warlord"}, storage_start = 200216, storage = 91017,count = 100, exp = 5000, money = 10000},

    ["tarantula"] = {monster_race={"tarantula"}, storage_start = 200217, storage = 91018,count = 120, exp = 9000, money = 12000},

    ["wyvern"] = {monster_race={"wyvern"}, storage_start = 200218, storage = 91019,count = 125, exp = 9000, money = 15000},

    ["dragon"] = {monster_race={"dragon","dragon hatchling"}, storage_start = 200219, storage = 91020,count = 150, exp = 2000, money = 10000},

    ["wailing widow"] = {monster_race={"wailing widow"}, storage_start = 200220, storage = 91021,count = 200, exp = 20000, money = 25000},

    ["ancient scarab"] = {monster_race={"ancient scarab"}, storage_start = 200221, storage = 91022,count = 180, exp = 22000, money = 18000},

    ["high class lizards"] = {monster_race={"Corrupted Soul","Eternal Guardian","Lizard Chosen","Lizard Dragon Priest","Lizard High Guard","Lizard Legionnaire","Lizard Magistratus","Lizard Noble","Lizard Zaogun"}, storage_start = 200222, storage = 91023,count = 300, exp = 50000, money = 60000},

    ["giant spider"] = {monster_race={"giant spider"}, storage_start = 200223, storage = 91024,count = 350, exp = 60000, money = 70000},

    ["mutated bat"] = {monster_race={"mutated bat"}, storage_start = 200224, storage = 91025,count = 260, exp = 40000, money = 55000},

    ["undead dragon"] = {monster_race={"undead dragon"}, storage_start = 200225, storage = 91026,count = 500, exp = 90000, money = 120000, reward = {2173,1}},

    ["hydra"] = {monster_race={"hydra"}, storage_start = 200226, storage = 91027,count = 600, exp = 100000, money = 160000, reward = {2173,1}},

    ["ghastly dragon"] = {monster_race={"ghastly dragon"}, storage_start = 200227, storage = 91028,count = 700, exp = 130000, money = 200000},

    ["underwater quaras"] = {monster_race={"quara predator","quara constrictor","quara hydromancer","quara mantassin","quara pincher"}, storage_start = 200233, storage = 91033,count = 550,exp = 22000,money = 15000},

    ["underwater quaras scout"] = {monster_race={"quara predator scout","quara constrictor scout","quara hydromancer scout","quara mantassin scout","quara pincher scout"}, storage_start = 200229, storage = 91006,count = 600,exp = 25000,money = 18000},

    ["hellspawn"] = {monster_race={"hellspawn"}, storage_start = 200230, storage = 91006,count = 600,exp = 28000,money = 26000},

    ["dragon lord"] = {monster_race={"dragon lord"}, storage_start = 200231, storage = 91006,count = 650,exp = 30000,money = 35000},

    ["lizard dragon"] = {monster_race={"Lizard Chosen","Lizard Dragon Priest","Lizard High Guard","Lizard Legionnaire", "Lizard Zaogun"}, storage_start = 200232, storage = 91006,count = 600,exp = 28000,money = 26000},

    ["nightmare"] = {monster_race={"nightmare","nightmare scion"}, storage_start = 200234, storage = 91034,count = 650,exp = 30000,money = 35000},

    }



    configbosses_task = {

    {race = "cave rat",Playerpos = {x = 32356, y = 32209, z = 7}, FromPosToPos = {{x = 32356, y = 32208, z = 5},{x = 32360, y = 32212, z = 7}},time = 5},

    }


    function CheckTask(cid)

    for k, v in pairs(tasktabble) do

    if getPlayerStorageValue(cid,v.storage_start) >= 1 then return true end

    end

    return false

    end

    function finisheAllTask(cid)

    local config = {

    exp = {true,100000},

    money = {true,200000},

    items ={false,{{2124,2},{2173,1}}},

    premium ={true,5}

    }

    local x = true

    for k, v in pairs(tasktabble) do

    if tonumber(getPlayerStorageValue(cid,v.storage)) then

    x = false

    end

    end

    if x == true then

    setPlayerStorageValue(cid, 521456, 0)

    local b = getGlobalStorageValue(63005) if b == -1 then b = 1 end

    if b < 11 then

    setGlobalStorageValue(63005,b+1)

    doBroadcastMessage('[Task Mission Complete] '..getCreatureName(cid)..' was the '..b..' to finish the task!.')

    doPlayerAddPremiumDays(cid, config.premium[1] == true and config.premium[2] or 0)

    doPlayerAddExp(cid, config.exp[1] == true and config.exp[2] or 0)

    doPlayerAddMoney(cid, config.money[1] == true and config.money[2] or 0)

    if config.items[1] == true then doAddItemsFromList(cid,config.items[2]) end

    doItemSetAttribute(doPlayerAddItem(cid, 7369), "name", "trophy "..getCreatureName(cid).." completed all the task.")

    end

    end

    end

    function HavePlayerPosition(cid, from, to)

        return isInRange(getPlayerPosition(cid), from, to) and true or false

    end

    function getRankStorage(cid, value, max, RankName) -- by vodka

    local str =""

    str = "--[".. (RankName == nil and "RANK STORAGE" or ""..RankName.."") .."]--\n\n"

    local query = db.getResult("SELECT `player_id`, `value` FROM `player_storage` WHERE `key` = "..value.." ORDER BY cast(value as INTEGER) DESC;")

    if (query:getID() ~= -1) then k = 1 repeat if k > max then break end

    str = str .. "\n " .. k .. ". "..getPlayerNameByGUID(query:getDataString("player_id")).." - [" .. query:getDataInt("value") .. "]"

    k = k + 1 until not query:next() end return doShowTextDialog(cid, 2529, str)

    end

    function getItemsInContainerById(container, itemid) -- Function By Kydrai

                local items = {}

                if isContainer(container) and getContainerSize(container) > 0 then

                                for slot=0, (getContainerSize(container)-1) do

                                                local item = getContainerItem(container, slot)

                                                if isContainer(item.uid) then

                                                                local itemsbag = getItemsInContainerById(item.uid, itemid)

                                                                for i=0, #itemsbag do

                                                                                table.insert(items, itemsbag[i])

                                                                end

                                                else

                                                                if itemid == item.itemid then

                                                                                table.insert(items, item.uid)

                                                                end

                                                end

                                end

                end

                return items

    end

    function doPlayerAddItemStacking(cid, itemid, quant) -- by mkalo

        local item = getItemsInContainerById(getPlayerSlotItem(cid, 3).uid, itemid)

        local piles = 0

        if #item > 0 then

                for i,x in pairs(item) do

                        if getThing(x).type < 100 then

                                local it = getThing(x)

                                doTransformItem(it.uid, itemid, it.type+quant)

                                if it.type+quant > 100 then

                                        doPlayerAddItem(cid, itemid, it.type+quant-100)

                                end

                        else

                               piles = piles+1

                        end

                end

        else

                return doPlayerAddItem(cid, itemid, quant)

        end

        if piles == #item then

                doPlayerAddItem(cid, itemid, quant)

        end

    end

    function getItemsFromList(items) -- by vodka

    local str = ''

    if table.maxn(items) > 0 then

    for i = 1, table.maxn(items) do

    str = str .. items[i][2] .. ' ' .. getItemNameById(items[i][1])

    if i ~= table.maxn(items) then str = str .. ', ' end end end

    return str

    end

    function doAddItemsFromList(cid,items) -- by vodka

    if table.maxn(items) > 0 then

    for i = 1, table.maxn(items) do

    local count = items[i][2]

    while count > 0 do

    if isItemStackable(items[i][1]) then

    doPlayerAddItemStacking(cid, items[i][1], 1)

    else

    doPlayerAddItem(cid, items[i][1],1)

    end

    count = count - 1

    end

    end

    end

    end

            function pairsByKeys(t, f)

              local a = {}

              for n in pairs(t) do table.insert(a, n) end

              table.sort(a, f)

              local i = 0

              local iter = function ()

                    i = i + 1

                    if a[i] == nil then return nil

                    else return a[i], t[a[i]]

                    end

              end

              return iter

            end

    ]]></config>

    <event type="login" name="TaskLogin" event="script"><![CDATA[

    function onLogin(cid)

    registerCreatureEvent(cid, "KillTask")

    return true

    end]]></event>    

    <talkaction words="!task" event="buffer"><![CDATA[
    domodlib('task_func')
    local param = string.lower(param)
    if param == "rank" then
    getRankStorage(cid, 521456, 20, "Task Rank Ended") return true
    end
    local str = ""
    str = str .. "Example Task: Hi, Task, Troll, Yes\n\nTask Creatures Info:\n\n"
    for k, v in pairsByKeys(tasktabble) do
    local contagem = getPlayerStorageValue(cid, v.storage)
    if (contagem == -1) then contagem = 1 end
    str = str..k.." = ".. (not tonumber(contagem) and "["..contagem.."]" or "["..((contagem)-1).."/"..v.count.."]") .."\n"
    end
    str = str .. ""
    return doShowTextDialog(cid, 8983, str)
    ]]></talkaction>

    <event type="kill" name="KillTask" event="script"><![CDATA[

    domodlib('task_func')

    function onKill(cid, target, lastHit)

    if(isMonster(target) == true) then

    local n = string.lower(getCreatureName(target))

    for race, mob in pairs(tasktabble) do

    if getPlayerStorageValue(cid,mob .storage_start) >= 1 then

    for i = 1,#mob.monster_race do

    if n == mob.monster_race[i] then

    local contagem = getPlayerStorageValue(cid, mob.storage)

    if (contagem == -1) then contagem = 1 end

    if not tonumber(contagem) then return true end

    if contagem > mob.count then return true end

    if contagem > mob.count then return true end

    setPlayerStorageValue(cid, mob.storage, contagem+1)

    doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE,""..(contagem == mob.count and "Congratulations! You finished the task of "..race.."." or "[Task System] defeated total [" .. contagem .. "/" .. mob.count .. "] " .. race .. ".").."")

    end

    end

    end

    end

    end

    return true

    end]]></event>

    </mod>

    movement

    Código:
    local spawnboss = {x=32357,y=32210,z=5}
    local spawnplayer = {x=32358,y=32211,z=5}
    local NWcorner = {x=32356,y=32208,z=5, stackpos = 255} -- north west corner of arena
    local SEcorner = {x=32360,y=32212,z=5, stackpos = 255} -- south east corner of arena
    local deny = {x=32356, y=32209, z=7}

    local storage = {15000,2} -- storage required to enter
    local keyafter = -1 -- key that will be set to storage above when player enters arena
    local boss = "troll" -- monster name
    local fighttime = 10 * 60 * 1000 -- ten minutes
    local delayglobal = 95000 -- enterance counter storage returning remaining time of current user

    function getCreaturesInQuestArea(type, fromPos, toPos, get, countSummon)
    -- function taken from demon oak quest made by Darkhaos
       local types =
       {
          [TYPE_PLAYER] = isPlayer,
          [TYPE_MONSTER] = isMonster,
          [TYPE_NPC] = isNpc,
          [TYPE_ALL] = isCreature
       }
     
       local tmp = {}
       local t = types[type]
       if not t then
          return print("[!] --> [Warning - Function::getCreaturesInQuestArea] Unknown type " .. (type or "(nil value)"))
       end
     
       local thing
       local pos
       for x = fromPos.x, toPos.x do
          for y = fromPos.y, toPos.y do
             for z = fromPos.z, toPos.z do
                pos = {x = x, y = y, z = z}
                thing = getTopCreature(pos)
                if t(thing.uid) then
                   table.insert(tmp, thing.uid)
                   if not countSummon and isSummon(thing.uid) then
                      for i = 1, #tmp do
                         if tmp[i] == thing.uid then
                            table.remove(tmp, i)
                            break
                         end
                      end
                   end
                end
             end
          end
       end
       return (get == GET_COUNT and #tmp or get == GET_UID and tmp or print("[Warning - Function::getCreaturesInQuestArea] Unknown type to get " .. (get or "(nil value)")))
    end

    function kickEvent(cid, item, position, fromPosition)
        if getCreaturesInQuestArea(TYPE_PLAYER, NWcorner, SEcorner, GET_COUNT) > 0 then
          doTeleportThing(cid, deny)
          doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
            doCreatureSay(cid, "You have been kicked out from hunting room.", TALKTYPE_ORANGE_1)
        end
    end

    function onStepIn(cid, item, pos)
        if getPlayerStorageValue (cid, storage[1]) == storage[2] then
          if getCreaturesInQuestArea(TYPE_PLAYER, NWcorner, SEcorner, GET_COUNT) > 0 then
             doTeleportThing(cid,deny)
             doCreatureSay(cid, 'Someone is still in this room. Please wait for your turn(max ' .. getGlobalStorageValue(delayglobal)-os.time() .. ' seconds left).', TALKTYPE_ORANGE_1)
             doSendMagicEffect(getThingPos(cid), CONST_ME_FIREAREA)
          else
             doTeleportThing(cid,spawnplayer)
             doSendMagicEffect(getCreaturePosition(cid),10)
             doCreatureSay(cid, 'You have ten minutes to slain your enemy, otherwise you will be kicked out.', TALKTYPE_ORANGE_1)
             setGlobalStorageValue(delayglobal, os.time() + (fighttime / 1000))
             setPlayerStorageValue(cid,storage[1],keyafter)
             doSummonCreature(boss, spawnboss)
             demodras = addEvent(kickEvent, fighttime, cid)
          end
       else
          doTeleportThing(cid,deny)
          doCreatureSay(cid, 'You are not allowed to enter here!', TALKTYPE_ORANGE_1)
          doSendMagicEffect(getThingPos(cid), CONST_ME_FIREAREA)
       end
       doSendMagicEffect(getThingPos(item.uid), CONST_ME_PURPLEENERGY)
        return true
    end

    he probado con el Task del troll pero no reconoce ningun storage :200210, 91001 tambien puse otros storages que vi en el task pa probar pero nada inicie la task mate los trolls la.complete la volvi hacer la volvi a completar asi con cada storage del mod para ver si me cogia alguno pero nada ayudenme porfabor
    Captura del Error escribió:Imagen del error: task storage Empty
    El error radica en: Otro Problema



    creo el problema viene del movements porque he probado un storage que si deberia funcionar y no sirve

    2 participantes
    http://baiakciteron.sytes.net

    2task storage Empty Re: task storage Miér Ago 25, 2021 8:20 am

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    esto es con lo que tienes que trabajar

    Código:
    setPlayerStorageValue(cid, mob.storage, contagem+1)

    mob.storage

    contagem+1


    para verificar si llego hasta el punto de termino



    task storage YNU5B25
    2 participantes
    http://www.tibiaface.com

    3task storage Empty Re: task storage Miér Ago 25, 2021 9:34 am

    ioke

    ioke
    Miembro
    Miembro
    ya pero es el.movements que no me sirve ademas como hago cuando completo los trolls acceda solo si he completado esa task y no cualquiera

    2 participantes
    http://baiakciteron.sytes.net

    4task storage Empty Re: task storage Miér Ago 25, 2021 9:45 am

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    ioke escribió:ya pero es el.movements que no me sirve ademas como hago cuando completo los trolls acceda solo si he completado esa task y no cualquiera

    use getplayerstorage y el count que muestra la tabla task



    task storage YNU5B25
    2 participantes
    http://www.tibiaface.com

    5task storage Empty Re: task storage Miér Ago 25, 2021 3:39 pm

    ioke

    ioke
    Miembro
    Miembro
    vale ya lo he conseguido que funcione, ahora tengo 2 problemas

    1. m gustaria que el storage se eliminara al matar o salir de la sala

    2. me da un error y no me echa de la sala pasado el tiempo

    Código:
    [21:24:57.520] [Error - MoveEvents Interface]
    [21:24:57.535] data/movements/scripts/boss/demodras.lua:onStepIn
    [21:24:57.535] Description:
    [21:24:57.535] data/movements/scripts/boss/demodras.lua:37: attempt to call global 'isSummon' (a nil value)
    [21:24:57.551] stack traceback:
    [21:24:57.551]  data/movements/scripts/boss/demodras.lua:37: in function 'getCreaturesInQuestArea'
    [21:24:57.566]  data/movements/scripts/boss/demodras.lua:62: in function <data/movements/scripts/boss/demodras.lua:60>


    El script:

    Código:
    local spawnboss = {x=32357,y=32210,z=5}
    local spawnplayer = {x=32358,y=32211,z=5}
    local NWcorner = {x=32356,y=32208,z=5, stackpos = 255} -- north west corner of arena
    local SEcorner = {x=32360,y=32212,z=5, stackpos = 255} -- south east corner of arena
    local deny = {x=32356, y=32209, z=7}

    local storage = 91001 -- storage required to enter
    local boss = "troll" -- monster name
    local fighttime = 1 * 60 * 1000 -- ten minutes
    local delayglobal = 95000 -- enterance counter storage returning remaining time of current user

    function getCreaturesInQuestArea(type, fromPos, toPos, get, countSummon)
    -- function taken from demon oak quest made by Darkhaos
      local types =
      {
          [TYPE_PLAYER] = isPlayer,
          [TYPE_MONSTER] = isMonster,
          [TYPE_NPC] = isNpc,
          [TYPE_ALL] = isCreature
      }
     
      local tmp = {}
      local t = types[type]
      if not t then
          return print("[!] --> [Warning - Function::getCreaturesInQuestArea] Unknown type " .. (type or "(nil value)"))
      end
     
      local thing
      local pos
      for x = fromPos.x, toPos.x do
          for y = fromPos.y, toPos.y do
            for z = fromPos.z, toPos.z do
                pos = {x = x, y = y, z = z}
                thing = getTopCreature(pos)
                if t(thing.uid) then
                  table.insert(tmp, thing.uid)
                  if not countSummon and isSummon(thing.uid) then
                      for i = 1, #tmp do
                        if tmp[i] == thing.uid then
                            table.remove(tmp, i)
                            break
                        end
                      end
                  end
                end
            end
          end
      end
      return (get == GET_COUNT and #tmp or get == GET_UID and tmp or print("[Warning - Function::getCreaturesInQuestArea] Unknown type to get " .. (get or "(nil value)")))
    end

    function kickEvent(cid, item, position, fromPosition)
        if getCreaturesInQuestArea(TYPE_PLAYER, NWcorner, SEcorner, GET_COUNT) > 0 then
          doTeleportThing(cid, deny)
          doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
            doCreatureSay(cid, "You have been kicked out from hunting room.", TALKTYPE_ORANGE_1)
        end
    end

    function onStepIn(cid, item, pos)
        if getPlayerStorageValue(cid, storage) == -1 then
          if getCreaturesInQuestArea(TYPE_PLAYER, NWcorner, SEcorner, GET_COUNT) > 0 then
            doTeleportThing(cid,deny)
            doCreatureSay(cid, 'Someone is still in this room. Please wait for your turn(max ' .. getGlobalStorageValue(delayglobal)-os.time() .. ' seconds left).', TALKTYPE_ORANGE_1)
            doSendMagicEffect(getThingPos(cid), CONST_ME_FIREAREA)
          else
            doTeleportThing(cid,spawnplayer)
            doSendMagicEffect(getCreaturePosition(cid),10)
            doCreatureSay(cid, 'You have ten minutes to slain your enemy, otherwise you will be kicked out.', TALKTYPE_ORANGE_1)
            setGlobalStorageValue(delayglobal, os.time() + (fighttime / 1000))
            setPlayerStorageValue(cid, storage)
            doSummonCreature(boss, spawnboss)
            demodras = addEvent(kickEvent, fighttime, cid)
          end
      else
          doTeleportThing(cid,deny)
          doCreatureSay(cid, 'You are not allowed to enter here!', TALKTYPE_ORANGE_1)
          doSendMagicEffect(getThingPos(cid), CONST_ME_FIREAREA)
      end
      doSendMagicEffect(getThingPos(item.uid), CONST_ME_PURPLEENERGY)
        return true
    end

    2 participantes
    http://baiakciteron.sytes.net

    6task storage Empty Re: task storage Miér Ago 25, 2021 5:04 pm

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    para que usar esto

    demodras = addEvent(kickEvent, fighttime, cid)


    explicame



    task storage YNU5B25
    2 participantes
    http://www.tibiaface.com

    7task storage Empty Re: task storage Miér Ago 25, 2021 5:12 pm

    ioke

    ioke
    Miembro
    Miembro
    no se venia asi el script yo solo busco un boss room para 0.4 con tiempo para matar el boss y storage y que cuando slaga del.room tengas que volver hacer la task para entrar

    2 participantes
    http://baiakciteron.sytes.net

    8task storage Empty Re: task storage Jue Ago 26, 2021 8:49 am

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    1. m gustaria que el storage se eliminara al matar o salir de la sala

    primero identificame donde esta el storage


    2. me da un error y no me echa de la sala pasado el tiempo

    ok eso verificaremos primero veremos lo del sotrage



    task storage YNU5B25
    2 participantes
    http://www.tibiaface.com

    9task storage Empty Re: task storage Jue Ago 26, 2021 9:47 am

    ioke

    ioke
    Miembro
    Miembro
    pues aqui
    Código:
    local storage = 91001 -- storage required to enter

    lo he modificao un poco raro pero bueno mira como lo he puesto

    Código:
    local spawnboss = {x=32357,y=32210,z=5}
    local spawnplayer = {x=32358,y=32211,z=5}
    local NWcorner = {x=32356,y=32208,z=5, stackpos = 255} -- north west corner of arena
    local SEcorner = {x=32360,y=32212,z=5, stackpos = 255} -- south east corner of arena
    local deny = {x=32356, y=32209, z=7}

    local storage = 91001 -- storage required to enter
    local boss = "troll" -- monster name
    local fighttime = 1 * 60 * 1000 -- ten minutes
    local delayglobal = 95000 -- enterance counter storage returning remaining time of current user

    function getCreaturesInQuestArea(type, fromPos, toPos, get, countSummon)
    -- function taken from demon oak quest made by Darkhaos
      local types =
      {
          [TYPE_PLAYER] = isPlayer,
          [TYPE_MONSTER] = isMonster,
          [TYPE_NPC] = isNpc,
          [TYPE_ALL] = isCreature
      }
     
      local tmp = {}
      local t = types[type]
      if not t then
          return print("[!] --> [Warning - Function::getCreaturesInQuestArea] Unknown type " .. (type or "(nil value)"))
      end
     
      local thing
      local pos
      for x = fromPos.x, toPos.x do
          for y = fromPos.y, toPos.y do
            for z = fromPos.z, toPos.z do
                pos = {x = x, y = y, z = z}
                thing = getTopCreature(pos)
                if t(thing.uid) then
                  table.insert(tmp, thing.uid)
                  if not countSummon and isSummon(thing.uid) then
                      for i = 1, #tmp do
                        if tmp[i] == thing.uid then
                            table.remove(tmp, i)
                            break
                        end
                      end
                  end
                end
            end
          end
      end
      return (get == GET_COUNT and #tmp or get == GET_UID and tmp or print("[Warning - Function::getCreaturesInQuestArea] Unknown type to get " .. (get or "(nil value)")))
    end

    function kickEvent(cid, item, position, fromPosition)
        if getCreaturesInQuestArea(TYPE_PLAYER, NWcorner, SEcorner, GET_COUNT) > 0 then
          doTeleportThing(cid, deny)
          doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
            doCreatureSay(cid, "You have been kicked out from hunting room.", TALKTYPE_ORANGE_1)
        end
    end

    function onStepIn(cid, item, pos)
        if getPlayerStorageValue(cid, storage) == 41 then
          if getCreaturesInQuestArea(TYPE_PLAYER, NWcorner, SEcorner, GET_COUNT) > 0 then
            doTeleportThing(cid,deny)
            doCreatureSay(cid, 'Someone is still in this room. Please wait for your turn(max ' .. getGlobalStorageValue(delayglobal)-os.time() .. ' seconds left).', TALKTYPE_ORANGE_1)
            doSendMagicEffect(getThingPos(cid), CONST_ME_FIREAREA)
          else
            doTeleportThing(cid,spawnplayer)
            doSendMagicEffect(getCreaturePosition(cid),10)
            doCreatureSay(cid, 'You have ten minutes to slain your enemy, otherwise you will be kicked out.', TALKTYPE_ORANGE_1)
            setGlobalStorageValue(delayglobal, os.time() + (fighttime / 1000))
            setPlayerStorageValue(cid, storage)
            doSummonCreature(boss, spawnboss)
            troll = addEvent(kickEvent, fighttime, cid)
          end
      else
          doTeleportThing(cid,deny)
          doCreatureSay(cid, 'You are not allowed to enter here!', TALKTYPE_ORANGE_1)
          doSendMagicEffect(getThingPos(cid), CONST_ME_FIREAREA)
      end
      doSendMagicEffect(getThingPos(item.uid), CONST_ME_PURPLEENERGY)
        return true
    end



    esta la he puesto asi

    Código:
        if getPlayerStorageValue(cid, storage) == 41 then

    y esta asi

    Código:
            setPlayerStorageValue(cid, storage)

    se que no van asi pero al matar los 40 trolls me deja entrar al tp y vuelve el storage a 0 no secomo es que funciona pero funciona a lo chapuzas me gustaria configurarlo bien pero no se y el error es para ke me kicke a pasar el tiempo

    2 participantes
    http://baiakciteron.sytes.net

    10task storage Empty Re: task storage Jue Ago 26, 2021 10:26 am

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    prueba

    Código:


    local spawnboss = {x=32357,y=32210,z=5}
    local spawnplayer = {x=32358,y=32211,z=5}
    local NWcorner = {x=32356,y=32208,z=5, stackpos = 255} -- north west corner of arena
    local SEcorner = {x=32360,y=32212,z=5, stackpos = 255} -- south east corner of arena
    local deny = {x=32356, y=32209, z=7}

    local storage = 91001 -- storage required to enter
    local boss = "troll" -- monster name
    local fighttime = 1 * 60 * 1000 -- ten minutes
    local delayglobal = 95000 -- enterance counter storage returning remaining time of current user

    function getCreaturesInQuestArea(type, fromPos, toPos, get, countSummon)
    -- function taken from demon oak quest made by Darkhaos
      local types =
      {
          [TYPE_PLAYER] = isPlayer,
          [TYPE_MONSTER] = isMonster,
          [TYPE_NPC] = isNpc,
          [TYPE_ALL] = isCreature
      }
     
      local tmp = {}
      local t = types[type]
      if not t then
          return print("[!] --> [Warning - Function::getCreaturesInQuestArea] Unknown type " .. (type or "(nil value)"))
      end
     
      local thing
      local pos
      for x = fromPos.x, toPos.x do
          for y = fromPos.y, toPos.y do
            for z = fromPos.z, toPos.z do
                pos = {x = x, y = y, z = z}
                thing = getTopCreature(pos)
                if t(thing.uid) then
                  table.insert(tmp, thing.uid)
                  if not countSummon and isSummon(thing.uid) then
                      for i = 1, #tmp do
                        if tmp[i] == thing.uid then
                            table.remove(tmp, i)
                            break
                        end
                      end
                  end
                end
            end
          end
      end
      return (get == GET_COUNT and #tmp or get == GET_UID and tmp or print("[Warning - Function::getCreaturesInQuestArea] Unknown type to get " .. (get or "(nil value)")))
    end

    local time = 30 ------- tiempo en segundos que durara en la sala
    local pos = {x=666, y=666, z=7}  ------ donde sera kickeado

    function onStepIn(cid, item, pos)
        if getPlayerStorageValue(cid, storage) == 41 then
          if getCreaturesInQuestArea(TYPE_PLAYER, NWcorner, SEcorner, GET_COUNT) > 0 then
            doTeleportThing(cid,deny)
            doCreatureSay(cid, 'Someone is still in this room. Please wait for your turn(max ' .. getGlobalStorageValue(delayglobal)-os.time() .. ' seconds left).', TALKTYPE_ORANGE_1)
            doSendMagicEffect(getThingPos(cid), CONST_ME_FIREAREA)
          else
            doTeleportThing(cid,spawnplayer)
            doSendMagicEffect(getCreaturePosition(cid),10)
            doCreatureSay(cid, 'You have ten minutes to slain your enemy, otherwise you will be kicked out.', TALKTYPE_ORANGE_1)
            setGlobalStorageValue(delayglobal, os.time() + (fighttime / 1000))
            setPlayerStorageValue(cid, storage)
            doSummonCreature(boss, spawnboss)
          
           addEvent(doTeleportThing,time * 1000,cid,pos,false)
           
          end
      else
          doTeleportThing(cid,deny)
          doCreatureSay(cid, 'You are not allowed to enter here!', TALKTYPE_ORANGE_1)
          doSendMagicEffect(getThingPos(cid), CONST_ME_FIREAREA)
      end
      doSendMagicEffect(getThingPos(item.uid), CONST_ME_PURPLEENERGY)
        return true
    end




    task storage YNU5B25
    2 participantes
    http://www.tibiaface.com

    11task storage Empty Re: task storage Jue Ago 26, 2021 10:36 am

    ioke

    ioke
    Miembro
    Miembro
    va bien te echa de la sala pero se queda el boss eso es lo malo y es posible que elimine el storage?

    2 participantes
    http://baiakciteron.sytes.net

    12task storage Empty Re: task storage Jue Ago 26, 2021 10:50 am

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    prueba

    Código:


    local spawnboss = {x=32357,y=32210,z=5}
    local spawnplayer = {x=32358,y=32211,z=5}
    local NWcorner = {x=32356,y=32208,z=5, stackpos = 255} -- north west corner of arena
    local SEcorner = {x=32360,y=32212,z=5, stackpos = 255} -- south east corner of arena
    local deny = {x=32356, y=32209, z=7}

    local storage = 91001 -- storage required to enter
    local boss = "troll" -- monster name
    local fighttime = 1 * 60 * 1000 -- ten minutes
    local delayglobal = 95000 -- enterance counter storage returning remaining time of current user

    function getCreaturesInQuestArea(type, fromPos, toPos, get, countSummon)
    -- function taken from demon oak quest made by Darkhaos
      local types =
      {
          [TYPE_PLAYER] = isPlayer,
          [TYPE_MONSTER] = isMonster,
          [TYPE_NPC] = isNpc,
          [TYPE_ALL] = isCreature
      }
     
      local tmp = {}
      local t = types[type]
      if not t then
          return print("[!] --> [Warning - Function::getCreaturesInQuestArea] Unknown type " .. (type or "(nil value)"))
      end
     
      local thing
      local pos
      for x = fromPos.x, toPos.x do
          for y = fromPos.y, toPos.y do
            for z = fromPos.z, toPos.z do
                pos = {x = x, y = y, z = z}
                thing = getTopCreature(pos)
                if t(thing.uid) then
                  table.insert(tmp, thing.uid)
                  if not countSummon and isSummon(thing.uid) then
                      for i = 1, #tmp do
                        if tmp[i] == thing.uid then
                            table.remove(tmp, i)
                            break
                        end
                      end
                  end
                end
            end
          end
      end
      return (get == GET_COUNT and #tmp or get == GET_UID and tmp or print("[Warning - Function::getCreaturesInQuestArea] Unknown type to get " .. (get or "(nil value)")))
    end

    local time = 30 ------- tiempo en segundos que durara en la sala
    local pos = {x=666, y=666, z=7}  ------ donde sera kickeado

    function onStepIn(cid, item, pos)
        if getPlayerStorageValue(cid, storage) == 41 then
          if getCreaturesInQuestArea(TYPE_PLAYER, NWcorner, SEcorner, GET_COUNT) > 0 then
            doTeleportThing(cid,deny)
            doCreatureSay(cid, 'Someone is still in this room. Please wait for your turn(max ' .. getGlobalStorageValue(delayglobal)-os.time() .. ' seconds left).', TALKTYPE_ORANGE_1)
            doSendMagicEffect(getThingPos(cid), CONST_ME_FIREAREA)
          else
            doTeleportThing(cid,spawnplayer)
            doSendMagicEffect(getCreaturePosition(cid),10)
            doCreatureSay(cid, 'You have ten minutes to slain your enemy, otherwise you will be kicked out.', TALKTYPE_ORANGE_1)
            setGlobalStorageValue(delayglobal, os.time() + (fighttime / 1000))
            setPlayerStorageValue(cid, storage)
            doSummonCreature(boss, spawnboss)
          
           addEvent(doTeleportThing,time * 1000,cid,pos,false)
          
          
           ------------------------------------------------------------------------
            --------------------para eliminar al monster al entrar--------------------------
            ------------------------------------------------------------------------
           
          
           for x = 31208, 31231 do  -------------- posicion esquina superior derecha
          for y = 32479, 32499 do  -------------- posicion esquina inferior izquierda
             local a = getTopCreature({x=x, y=y, z=6}).uid  --------6 es el subsuelo o floor de la room
             if a ~= 0 and isMonster(a) then
                doRemoveCreature(a)
             end
             
          end
       end
          
           ------------------------------------------------------------------------
            --------------------para eliminar al monster al entrar--------------------------
            ------------------------------------------------------------------------
          
          
          end
      else
          doTeleportThing(cid,deny)
          doCreatureSay(cid, 'You are not allowed to enter here!', TALKTYPE_ORANGE_1)
          doSendMagicEffect(getThingPos(cid), CONST_ME_FIREAREA)
      end
      doSendMagicEffect(getThingPos(item.uid), CONST_ME_PURPLEENERGY)
        return true
    end





    task storage YNU5B25
    2 participantes
    http://www.tibiaface.com

    13task storage Empty Re: task storage Jue Ago 26, 2021 11:04 am

    ioke

    ioke
    Miembro
    Miembro
    no da error pero el monster sigue estando queria decirte tmb que al abandonar la sala cuando pasa el tiempo te teleransporta



    bueno mira lo he apañado asi solo me falta que no me teletransporte una vez salga de la sala

    Código:
    local spawnboss = {x=32357,y=32210,z=5}
    local spawnplayer = {x=32358,y=32211,z=5}
    local NWcorner = {x=32356,y=32208,z=5, stackpos = 255} -- north west corner of arena
    local SEcorner = {x=32360,y=32212,z=5, stackpos = 255} -- south east corner of arena
    local deny = {x=32356, y=32209, z=7}

    local storage = 91001 -- storage required to enter
    local boss = "troll" -- monster name
    local fighttime = 1 * 60 * 1000 -- ten minutes
    local delayglobal = 95000 -- enterance counter storage returning remaining time of current user

    function getCreaturesInQuestArea(type, fromPos, toPos, get, countSummon)
    -- function taken from demon oak quest made by Darkhaos
      local types =
      {
          [TYPE_PLAYER] = isPlayer,
          [TYPE_MONSTER] = isMonster,
          [TYPE_NPC] = isNpc,
          [TYPE_ALL] = isCreature
      }
     
      local tmp = {}
      local t = types[type]
      if not t then
          return print("[!] --> [Warning - Function::getCreaturesInQuestArea] Unknown type " .. (type or "(nil value)"))
      end
     
      local thing
      local pos
      for x = fromPos.x, toPos.x do
          for y = fromPos.y, toPos.y do
            for z = fromPos.z, toPos.z do
                pos = {x = x, y = y, z = z}
                thing = getTopCreature(pos)
                if t(thing.uid) then
                  table.insert(tmp, thing.uid)
                  if not countSummon and isSummon(thing.uid) then
                      for i = 1, #tmp do
                        if tmp[i] == thing.uid then
                            table.remove(tmp, i)
                            break
                        end
                      end
                  end
                end
            end
          end
      end
      return (get == GET_COUNT and #tmp or get == GET_UID and tmp or print("[Warning - Function::getCreaturesInQuestArea] Unknown type to get " .. (get or "(nil value)")))
    end

    local time = 30 ------- tiempo en segundos que durara en la sala
    local pos = {x=666, y=666, z=7}  ------ donde sera kickeado

    function onStepIn(cid, item, pos)
        if getPlayerStorageValue(cid, storage) == 41 then
          if getCreaturesInQuestArea(TYPE_PLAYER, NWcorner, SEcorner, GET_COUNT) > 0 then
            doTeleportThing(cid,deny)
            doCreatureSay(cid, 'Someone is still in this room. Please wait for your turn(max ' .. getGlobalStorageValue(delayglobal)-os.time() .. ' seconds left).', TALKTYPE_ORANGE_1)
            doSendMagicEffect(getThingPos(cid), CONST_ME_FIREAREA)
          else
            doTeleportThing(cid,spawnplayer)
            doSendMagicEffect(getCreaturePosition(cid),10)
            doCreatureSay(cid, 'You have ten minutes to kill your enemy, if you leave or you run out of time you will have to restart the task.', TALKTYPE_ORANGE_1)
            setGlobalStorageValue(delayglobal, os.time() + (fighttime / 1000))
            setPlayerStorageValue(cid, storage)
            doSummonCreature(boss, spawnboss)
         
          addEvent(doTeleportThing,time * 1000,cid,pos,false) 
          end
      else
          ------------------------------------------------------------------------
            --------------------para eliminar al monster al entrar--------------------------
            ------------------------------------------------------------------------
           
    local spec = getSpectators({x=32358, y=32210, z=5}, 10, 10)
    if spec ~= nil then
        for _, s in pairs(spec) do
            if isMonster(s) then
                doRemoveCreature(s)
            end
        end
    end


          ------------------------------------------------------------------------
            --------------------para eliminar al monster al entrar--------------------------
            -----------------------------------------------------------------------
      doTeleportThing(cid,deny)
          doCreatureSay(cid, 'You have not completed the task or your time is up.', TALKTYPE_ORANGE_1)
          doSendMagicEffect(getThingPos(cid), CONST_ME_FIREAREA)
      end
      doSendMagicEffect(getThingPos(item.uid), CONST_ME_PURPLEENERGY)
        return true
    end

    2 participantes
    http://baiakciteron.sytes.net

    14task storage Empty Re: task storage Vie Ago 27, 2021 9:49 am

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    esto seria asi


    Código:



    local c = {
        limit = 1, -- Límite de jugadores que podrán entrar.
        msgCancel = 'TEM 1 ESPERA SUA TURNO.', -- 'Mensaje' cuando ya se haya llenado el límite de jugadores anterior.
     
        area = {
          From = {x = 486, y = 1827, z = 7}, -- Coordenada de la ESQUINA SUPERIOR IZQUIERDA del área al que son teletransportados.
          To = {x = 502, y = 1838, z = 7}, -- Coordenada de la ESQUINA INFERIOR DERECHA del área al que son teletransportados.
        },
     
        pos = {x = 494, y = 1837, z = 7}, -- Coordenada del lugar donde será teletransportado el jugador (Dentro del área anterior)
      monster = "Tiny",
      }
     
    local function getPlayersInArea(fromPos, toPos)
      local t = {}
     
        for _, cid in ipairs(getPlayersOnline()) do
            if isInRange(getThingPos(cid), fromPos, toPos) then
                table.insert(t, cid)
            end
        end
     
      return t
    end

    local count = 50
     
    local itemx= 2328

     local time =
    {
      sec = 5
    }


    local time = 30 ------- tiempo en segundos que durara en la sala




    local function Godmaya()
          doTeleportThing(cid, {x=666, y=666, z=7})
     return TRUE
    end

     
    function onStepIn(cid, item, fromPos, toPos)

    local function funcSummonWarlock()
          doSummonCreature("Warlock", {x = 494, y = 1837, z = 7})
     return TRUE
    end
        if isPlayer(cid) then

      if table.getn(getPlayersInArea(c.area.From, c.area.To)) < c.limit then
     
    if getPlayerItemCount(cid, itemx) >= count then
    doPlayerRemoveItem(cid,2328,50)
                doSendMagicEffect(fromPos, CONST_ME_TELEPORT)
                doTeleportThing(cid, c.pos)
                doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
            ------------------doSummonCreature(c.monster, c.pos)  -------------- no usar
          
           -------------------------------kick----------------------------
           kickOutEvent = addEvent(Godmaya, time * 1000, cid)
          
            -------------------------------kick----------------------------
         
          addEvent(funcSummonWarlock, time.sec * 1000)
         
    local spec = getSpectators({x=467, y=1827, z=7}, 20, 20)
    if spec ~= nil then
    for _, s in pairs(spec) do
    if isMonster(s) then
    doRemoveCreature(s)
    end
    end
    end     
         
         
         
    else
    doPlayerSendCancel(cid, "You dont have 50 ONLINE PONTOS pra ter access!")
    doTeleportThing(cid, toPos, false)
    end
            else
              doPlayerSendCancel(cid, c.msgCancel)
              doTeleportThing(cid, toPos, false)
            end
     
        end
     
      return true
    end


    y en el mismo scripts crear otra funcion

    Código:


    function onStepOut(cid, item, position, fromPosition)
       stopEvent(kickOutEvent)
       return true
    end


    asi seria



    task storage YNU5B25
    2 participantes
    http://www.tibiaface.com

    Contenido patrocinado


    2 participantes

    Ver el tema anterior Ver el tema siguiente Volver arriba  Mensaje (Página 1 de 1.)

    Permisos de este foro:
    No puedes responder a temas en este foro.

     

    BienvenidosTibiaFace es una comunidad de Open Tibia. Para participar debes estar registrado (click para Regístrate).