Ir para conteúdo

Featured Replies

Postado

Fala galera tenho eu criei uma sala que vai vai andando puxa as alavancas abre o boss.

 

Na hora de matar o boss segue normal os monstro do lado de fora tbm.

 

Quando player morre, ou quando mato o boss, a sala fica inativa por 10 minutos. o tempos que esta no script..

 

Oque eu gostaria.

quando player morrer ou o boss morrer. a sala seja resetada para que outro player possa entrar e não esperar os 10 minutos. o script funciona tudo só queria acrescentar essa função.

 

1- MORREU RESETA.

2- MATOU E TELETRANSPORTADO PRA SALA DO PREMIO.

Spoiler

 

local config = {
    bossName = "Caveirao",
    lockStorage = 5000107, -- globalstorage
    bossPos = Position(31742, 32257, 8),
    centerRoom = Position(31742, 32257, 8), -- Center Room
    exitPosition = Position(32127, 32300, 7), -- Exit Position
    newPos = Position(31742, 32334, 8),
    range = 1,
    time = 10, -- time in minutes to remove the player    
}

local monsters = {
   {pillar = "Cranial Basher", pos = Position(31725, 32324, 8)},

   {pillar = "Cranial Basher", pos = Position(31725, 32324, 8)},          
   {pillar = "Cranial Basher", pos = Position(31757, 32316, 8)}   
}

local function clearOberonRoom()
    if Game.getStorageValue(config.lockStorage) == 1 then
        local spectators = Game.getSpectators(config.bossPos, false, false, 100, 100, 100, 100)
        for i = 1, #spectators do
            local spectator = spectators[i]
            if spectator:isPlayer() then
                spectator:teleportTo(config.exitPosition)
                spectator:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
                spectator:say('Time out! You were teleported out by strange forces.', TALKTYPE_MONSTER_SAY)
            elseif spectator:isMonster() then
                spectator:remove()
            end
        end
        Game.setStorageValue(config.lockStorage, 0)
    end
end

-- Start Script
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if item.itemid == 11051 and item.actionid == 33370 then
        if player:getPosition() ~= Position(32127, 32300, 7) then
            return true
        end
            
    for x = 32127, 32127 do
    local playerTile = Tile(Position(x, 32300, 7)):getTopCreature()
        if playerTile and playerTile:isPlayer() then 
            if playerTile:getStorageValue(Storage.TheSecretLibrary1.TheOrderOfTheCobra.CobraTimer) > os.time() then
                playerTile:sendTextMessage(MESSAGE_STATUS_SMALL, "You or a member in your team have to wait 20 hours to challange Scarlet again!")
                item:transform(11051)
                return true
            end
        end
    end            
    
    local specs, spec = Game.getSpectators(config.centerRoom, false, false, 100, 100, 100, 100)
    for i = 1, #specs do
        spec = specs[i]
        if spec:isPlayer() then
            player:sendTextMessage(MESSAGE_STATUS_SMALL, "There's someone fighting with Scarlet.")
            item:transform(11051)
            return true
        end
    end    
            
    if Game.getStorageValue(config.lockStorage) == 1 then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, "You need wait 10 minutes to room cleaner!")
        return true
    end
    
    local spectators = Game.getSpectators(config.bossPos, false, false, 100, 100, 100, 100)
    for i = 1, #spectators do
        local spectator = spectators[i]
        if spectator:isMonster() then
            spectator:remove()
        end
    end
    
for n = 1, #monsters do
            Game.createMonster(monsters[n].pillar, monsters[n].pos, true, true)
        end
    Game.createMonster(config.bossName, config.bossPos, true, true)    
    Game.setStorageValue(config.lockStorage, 1)
    for x = 32127, 32127 do
        local playerTile = Tile(Position(x, 32300, 7)):getTopCreature()
        if playerTile and playerTile:isPlayer() then                     
            playerTile:getPosition():sendMagicEffect(CONST_ME_POFF)
            playerTile:teleportTo(config.newPos)
            playerTile:getPosition():sendMagicEffect(CONST_ME_TELEPORT)    
            playerTile:setStorageValue(Storage.TheSecretLibrary1.TheOrderOfTheCobra.CobraTimer, os.time() + 20 * 60 * 3600) -- + 20 * 60 * 3600
            addEvent(clearOberonRoom, 60 * config.time * 1000, playerTile:getId(), config.centerRoom, config.range, config.range, config.exitPosition)
            playerTile:sendTextMessage(MESSAGE_STATUS_SMALL, "You have 10 minutes to kill and loot this boss. Otherwise you will lose that chance and will be kicked out.")
            item:transform(11051)
        end
    end
    
elseif item.itemid == 11051 then
        item:transform(11051)
    end
        return true
end

 

 

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo