• TibiaFace

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

    .
    demo menumenu

    Afiliados



    Votar:

    [Actions] [AYUDA]BOSS LEVER

    Compartir:

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

    1[Actions] [AYUDA]BOSS LEVER Empty [Actions] [AYUDA]BOSS LEVER Jue Mar 03, 2022 3:48 pm

    Dfsuno

    Dfsuno
    Miembro
    Miembro
    Descripcion escribió:La lever funcioan perfecto cuando un player que ya hizo el boss quiere volver a jalar la palanca le pone que tiene que esperar 20 hrs, pero si un player que no la a hecho la jala y el otro player se pone atras si lo teletrasporta al boss, me podrian ayudar proporciono el script.


    Código:
    local config = {
        cooldown = 60 * 60 * 20, -- in seconds - (Make it 'seconds * minutes * hours' - its will be '60 * 60 * 20' for 20 hours) (player cooldown)
        cooldown_storage = 808868,
        duration = 1, -- time till reset, in minutes (lever cooldown)
        level_req = 50, -- minimum level to do quest
        min_players = 1, -- minimum players to join quest
        lever_id = 1945, -- id of lever before pulled
        pulled_id = 1946, -- id of lever after pulled
    }

    local player_positions = {
        [1] = {fromPos = Position(579, 390, 5), toPos = Position(589, 394, 7)},
        [2] = {fromPos = Position(580, 390, 5), toPos = Position(589, 394, 7)},
        [3] = {fromPos = Position(581, 390, 5), toPos = Position(589, 394, 7)},
        [4] = {fromPos = Position(582, 390, 5), toPos = Position(589, 394, 7)}
    }

    local monsters = {
        [1] = {pos = Position(601, 396, 7), name = "dragon lord"}
    }
    local quest_range = {fromPos = Position(583, 388, 7), toPos = Position(605, 403, 7)} -- see image in thread for explanation

    local exit_position = Position(584, 390, 6) -- Position completely outside the quest area

    local theUnwelcome = Action()

    function doResetTheBossDukeKrule(position, cid_array)
     
        local tile = Tile(position)
     
        local item = tile and tile:getItemById(config.pulled_id)
        if not item then
            return
        end
     
        local monster_names = {}
        for key, value in pairs(monsters) do
            if not isInArray(monster_names, value.name) then
                monster_names[#monster_names + 1] = value.name
            end
        end
     
        for i = 1, #monsters do
            local creatures = Tile(monsters[i].pos):getCreatures()
            for key, creature in pairs(creatures) do
                if isInArray(monster_names, creature:getName()) then
                    creature:remove()
                end
            end
        end
     
        for i = 1, #player_positions do
            local creatures = Tile(player_positions[i].toPos):getCreatures()
            for key, creature in pairs(creatures) do
                if isInArray(monster_names, creature:getName()) then
                    creature:remove()
                end
            end
        end
     
        for key, cid in pairs(cid_array) do
            local participant = Player(cid)
        if participant and isInRange(participant:getPosition(), quest_range.fromPos, quest_range.toPos) then
                participant:teleportTo(exit_position)
                exit_position:sendMagicEffect(CONST_ME_TELEPORT)
            end
        end
     
        item:transform(config.lever_id)
    end

    local function removeBoss()
    local specs, spec = Game.getSpectators(Position(595, 396, 7), false, false, 10, 10, 10, 10)
        for j = 1, #specs do
            spec = specs[j]
            if spec:getName():lower() == 'dragon lord' then
                spec:remove()
            end
        end
    end

    function theUnwelcome.onUse(player, item, fromPosition, target, toPosition, isHotkey)
        if player:getStorageValue(config.cooldown_storage) >= os.time() then
            player:sendTextMessage(MESSAGE_INFO_DESCR, "Try Again in 20 Hours.")
            return true
        end
     
     
        local participants, pull_player = {}, false
        for i = 1, #player_positions do
            local fromPos = player_positions[i].fromPos
            local tile = Tile(fromPos)
            if not tile then
                print(">> ERROR: Soul Quest tile does not exist for Position(" .. fromPos.x .. ", " .. fromPos.y .. ", " .. fromPos.z .. ").")
                return player:sendCancelMessage("There is an issue with this quest. Please contact an administrator.")
            end
     
            local creature = tile:getBottomCreature()
            if creature then
                local participant = creature:getPlayer()
                if not participant then
                    return player:sendCancelMessage(participant:getName() .. " is not a valid participant.")
                end
     
                if participant:getLevel() < config.level_req then
                    return player:sendCancelMessage(participant:getName() .. " is not the required level.")
                end
     
                if participant.uid == player.uid then
                    pull_player = true
                end
     
                participants[#participants + 1] = {participant = participant, toPos = player_positions[i].toPos}
            end
        end
     
        if #participants < config.min_players then
            return player:sendCancelMessage("You do not have the required amount of participants.")
        end
     
        if not pull_player then
            return player:sendCancelMessage("You are in the wrong position.")
        end
     
        for i = 1, #monsters do
            local toPos = monsters[i].pos
            if not Tile(toPos) then
                print(">> ERROR: Soul Quest tile does not exist for Position(" .. toPos.x .. ", " .. toPos.y .. ", " .. toPos.z .. ").")
                return player:sendCancelMessage("There is an issue with this quest. Please contact an administrator.")
            end
            removeBoss()
            Game.createMonster(monsters[i].name, monsters[i].pos, false, true)
        end
     
        local cid_array = {}
        for i = 1, #participants do
            participants[i].participant:teleportTo(participants[i].toPos)
            participants[i].toPos:sendMagicEffect(CONST_ME_TELEPORT)
            cid_array[#cid_array + 1] = participants[i].participant.uid
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have 10 minutes to kill and loot this boss. Otherwise you will lose that chance and will be kicked out.")
        end
     
        item:transform(config.pulled_id)
        players:setStorageValue(config.cooldown_storage, os.time() + config.cooldown)
        addEvent(doResetTheBossDukeKrule, config.duration * 60 * 2000,  toPosition, cid_array)
        return true
    end

    theUnwelcome:uid(42606)
    theUnwelcome:register()
    Captura del Error escribió:Imagen del error: [Actions] [AYUDA]BOSS LEVER Empty
    La config. radica en: Actions

    2 participantes

    2[Actions] [AYUDA]BOSS LEVER Empty Re: [Actions] [AYUDA]BOSS LEVER Vie Mar 04, 2022 11:21 am

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    ahi lo tienes editado

    Código:

    local config = {
        cooldown = 60 * 60 * 20, -- in seconds - (Make it 'seconds * minutes * hours' - its will be '60 * 60 * 20' for 20 hours) (player cooldown)
        cooldown_storage = 808868,
        duration = 1, -- time till reset, in minutes (lever cooldown)
        level_req = 50, -- minimum level to do quest
        min_players = 1, -- minimum players to join quest
        lever_id = 1945, -- id of lever before pulled
        pulled_id = 1946, -- id of lever after pulled
    }

    local player_positions = {
        [1] = {fromPos = Position(579, 390, 5), toPos = Position(589, 394, 7)},
        [2] = {fromPos = Position(580, 390, 5), toPos = Position(589, 394, 7)},
        [3] = {fromPos = Position(581, 390, 5), toPos = Position(589, 394, 7)},
        [4] = {fromPos = Position(582, 390, 5), toPos = Position(589, 394, 7)}
    }

    local monsters = {
        [1] = {pos = Position(601, 396, 7), name = "dragon lord"}
    }
    local quest_range = {fromPos = Position(583, 388, 7), toPos = Position(605, 403, 7)} -- see image in thread for explanation

    local exit_position = Position(584, 390, 6) -- Position completely outside the quest area

    local theUnwelcome = Action()

    function doResetTheBossDukeKrule(position, cid_array)
     
        local tile = Tile(position)
     
        local item = tile and tile:getItemById(config.pulled_id)
        if not item then
            return
        end
     
        local monster_names = {}
        for key, value in pairs(monsters) do
            if not isInArray(monster_names, value.name) then
                monster_names[#monster_names + 1] = value.name
            end
        end
     
        for i = 1, #monsters do
            local creatures = Tile(monsters[i].pos):getCreatures()
            for key, creature in pairs(creatures) do
                if isInArray(monster_names, creature:getName()) then
                    creature:remove()
                end
            end
        end
     
        for i = 1, #player_positions do
            local creatures = Tile(player_positions[i].toPos):getCreatures()
            for key, creature in pairs(creatures) do
                if isInArray(monster_names, creature:getName()) then
                    creature:remove()
                end
            end
        end
     
        for key, cid in pairs(cid_array) do
            local participant = Player(cid)
        if participant and isInRange(participant:getPosition(), quest_range.fromPos, quest_range.toPos) then
                participant:teleportTo(exit_position)
                exit_position:sendMagicEffect(CONST_ME_TELEPORT)
            end
        end
     
        item:transform(config.lever_id)
    end

    local function removeBoss()
    local specs, spec = Game.getSpectators(Position(595, 396, 7), false, false, 10, 10, 10, 10)
        for j = 1, #specs do
            spec = specs[j]
            if spec:getName():lower() == 'dragon lord' then
                spec:remove()
            end
        end
    end

    function theUnwelcome.onUse(player, item, fromPosition, target, toPosition, isHotkey)
       
     
     
        local participants, pull_player = {}, false
        for i = 1, #player_positions do
            local fromPos = player_positions[i].fromPos
            local tile = Tile(fromPos)
            if not tile then
                print(">> ERROR: Soul Quest tile does not exist for Position(" .. fromPos.x .. ", " .. fromPos.y .. ", " .. fromPos.z .. ").")
                return player:sendCancelMessage("There is an issue with this quest. Please contact an administrator.")
            end
     
            local creature = tile:getBottomCreature()
            if creature then
                local participant = creature:getPlayer()
                if not participant then
                    return player:sendCancelMessage(participant:getName() .. " is not a valid participant.")
                end
     
                if participant:getLevel() < config.level_req then
                    return player:sendCancelMessage(participant:getName() .. " is not the required level.")
                end
             
             
             if participant:getStorageValue(config.cooldown_storage) >= os.time() then
           
            return player:sendCancelMessage(participant:getName() .. "Try Again in 20 Hours.")
        end
     
                if participant.uid == player.uid then
                    pull_player = true
                end
     
                participants[#participants + 1] = {participant = participant, toPos = player_positions[i].toPos}
            end
        end
     
        if #participants < config.min_players then
            return player:sendCancelMessage("You do not have the required amount of participants.")
        end
       
       
       
       
       
       
       
     
        if not pull_player then
            return player:sendCancelMessage("You are in the wrong position.")
        end
     
        for i = 1, #monsters do
            local toPos = monsters[i].pos
            if not Tile(toPos) then
                print(">> ERROR: Soul Quest tile does not exist for Position(" .. toPos.x .. ", " .. toPos.y .. ", " .. toPos.z .. ").")
                return player:sendCancelMessage("There is an issue with this quest. Please contact an administrator.")
            end
            removeBoss()
            Game.createMonster(monsters[i].name, monsters[i].pos, false, true)
        end
     
        local cid_array = {}
        for i = 1, #participants do
            participants[i].participant:teleportTo(participants[i].toPos)
            participants[i].toPos:sendMagicEffect(CONST_ME_TELEPORT)
            cid_array[#cid_array + 1] = participants[i].participant.uid
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have 10 minutes to kill and loot this boss. Otherwise you will lose that chance and will be kicked out.")
        end
     
        item:transform(config.pulled_id)
        players:setStorageValue(config.cooldown_storage, os.time() + config.cooldown)
        addEvent(doResetTheBossDukeKrule, config.duration * 60 * 2000,  toPosition, cid_array)
        return true
    end

    theUnwelcome:uid(42606)
    theUnwelcome:register()



    [Actions] [AYUDA]BOSS LEVER YNU5B25
    2 participantes
    http://www.tibiaface.com

    3[Actions] [AYUDA]BOSS LEVER Empty Re: [Actions] [AYUDA]BOSS LEVER Lun Mar 07, 2022 1:57 am

    Dfsuno

    Dfsuno
    Miembro
    Miembro
    nice, gracias maya

    2 participantes

    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).