• 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 bug boss lever

darkmu

Well-Known Member
Joined
Aug 26, 2007
Messages
274
Solutions
1
Reaction score
50
Location
Paraná,Brazil
Can anyone tell me where is wrong in this script? Only one person who pulled the lever is left with storage and how else can he pull again, or the correct one is all the main ones for the boss who can no longer go, that is, wait or return again.

otg 1.3, version 12.40

Lua:
local config = {
    requiredLevel = 350,
    daily = true,
    BossPosition = Position(780, 337, 10),
    Center_Room_Position = Position(789, 364, 10),
    playerPositions = {
        Position(778, 315, 10),
        Position(779, 315, 10),
        Position(780, 315, 10),
        Position(781, 315, 10),
        Position(782, 315, 10)
    },
    newPositions = {
        Position(782, 344, 10),
        Position(782, 344, 10),
        Position(782, 344, 10),
        Position(782, 344, 10),
        Position(782, 344, 10)
    },
}


function onUse(player, item, fromPosition, target, toPosition, monster, isHotkey)
    if item.itemid == 9825 then
        if player:getPosition() ~= Position(778, 315, 10) then
            item:transform(9826)
            return true
        end  
        local storePlayers, playerTile = {}
        local exaustedSeconds = 1
        for i = 1, #config.playerPositions do
            playerTile = Tile(config.playerPositions[i]):getTopCreature()
            if not (player:getStorageValue(15510) <= os.time()) then
                player:say("You did this boss before 12 hours!", TALKTYPE_MONSTER_SAY)
                player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Someone did this boss before 12 hours.")
                return true          
            end
            storePlayers[#storePlayers + 1] = playerTile
        end
       
        local specs, spec = Game.getSpectators(config.Center_Room_Position, false, false, 15, 15, 15, 15)
        for i = 1, #specs do
            spec = specs[i]          
            if spec:isPlayer() then
                if item.itemid == 9826 then
                    if player:getPosition() ~= Position(777, 315, 10) then
                        item:transform(9826)
                        player:say("Someone is fighting with Sir Nictros and Sir Baeloc.", TALKTYPE_MONSTER_SAY)
                        return true
                    end
                end
                return true
            end
        end      

        local specs, spec = Game.getSpectators(config.Center_Room_Position, false, false, 15, 15, 15, 15)
        for i = 1, #specs do
            spec = specs[i]
            if spec:isPlayer() then
                player:say("Someone is fighting with Sir Nictros and Sir Baeloc.", TALKTYPE_MONSTER_SAY)
                player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Someone is fighting with Sir Nictros and Sir Baeloc.")
                return true
            end

            spec:remove()
        end
   
        local players
        local monster = Game.createMonster("Sir Nictros", Position(776, 334, 10))
       
       
        local monster1 = Game.createMonster("Sir Baeloc", Position(784, 334, 10))
        monster1:setReward(true)
       
        for i = 1, #storePlayers do
            players = storePlayers[i]
       
            if not (players:getStorageValue(15510) <= os.time()) then
                players:sendTextMessage(TALKTYPE_MONSTER_SAY, "You did this boss before 12 hours.")
                player:say("Someone already did this room before 12 hours!", TALKTYPE_MONSTER_SAY)
                return
            end
        end
        for i = 1, #storePlayers do
            players = storePlayers[i]
            config.playerPositions[i]:sendMagicEffect(CONST_ME_POFF)
            players:teleportTo(config.newPositions[i])
            config.newPositions[i]:sendMagicEffect(CONST_ME_ENERGYAREA)
            players:setDirection(DIRECTION_NORTH)
            player:setStorageValue(15510, os.time()+exaustedSeconds*43200)
        end
       
            elseif item.itemid == 9825 then
        if config.daily then
            player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_NOTPOSSIBLE))
            return true
        end
    end

    item:transform(item.itemid == 9826 and 9825 or 9826)
    return true
end
 
Explain more, I can't get what you exactly want to do.

what's going on, you will give an example.

On the lever, there are 5 people, if the first one to pull or correct is that the sqm cannot go, but this is not how it works, only one person who pulled it receives storage so that he cannot go, so .. if you never pull a lever you can go infinitely.
 
Try this one
Lua:
local config = {
    requiredLevel = 350,
    daily = true,
    BossPosition = Position(780, 337, 10),
    Center_Room_Position = Position(789, 364, 10),
    playerPositions = {
        Position(778, 315, 10),
        Position(779, 315, 10),
        Position(780, 315, 10),
        Position(781, 315, 10),
        Position(782, 315, 10)
    },
    newPositions = {
        Position(782, 344, 10),
        Position(782, 344, 10),
        Position(782, 344, 10),
        Position(782, 344, 10),
        Position(782, 344, 10)
    },
}


function onUse(player, item, fromPosition, target, toPosition, monster, isHotkey)
    if item.itemid == 9825 then
        if player:getPosition() ~= Position(778, 315, 10) then
            item:transform(9826)
            return true
        end
        local storePlayers, playerTile = {}
        local exaustedSeconds = 1
        for i = 1, #config.playerPositions do
            playerTile = Tile(config.playerPositions[i]):getTopCreature()
            if not (player:getStorageValue(15510) <= os.time()) then
                player:say("You did this boss before 12 hours!", TALKTYPE_MONSTER_SAY)
                player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Someone did this boss before 12 hours.")
                return true        
            end
            storePlayers[#storePlayers + 1] = playerTile
        end
     
        local specs, spec = Game.getSpectators(config.Center_Room_Position, false, false, 15, 15, 15, 15)
        for i = 1, #specs do
            spec = specs[i]        
            if spec:isPlayer() then
                if item.itemid == 9826 then
                    if player:getPosition() ~= Position(777, 315, 10) then
                        item:transform(9826)
                        player:say("Someone is fighting with Sir Nictros and Sir Baeloc.", TALKTYPE_MONSTER_SAY)
                        return true
                    end
                end
                return true
            end
        end    

        local specs, spec = Game.getSpectators(config.Center_Room_Position, false, false, 15, 15, 15, 15)
        for i = 1, #specs do
            spec = specs[i]
            if spec:isPlayer() then
                player:say("Someone is fighting with Sir Nictros and Sir Baeloc.", TALKTYPE_MONSTER_SAY)
                player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Someone is fighting with Sir Nictros and Sir Baeloc.")
                return true
            end

            spec:remove()
        end
 
        local players
        local monster = Game.createMonster("Sir Nictros", Position(776, 334, 10))
     
     
        local monster1 = Game.createMonster("Sir Baeloc", Position(784, 334, 10))
        monster1:setReward(true)
     
        for i = 1, #storePlayers do
            players = storePlayers[i]
     
            if not (players:getStorageValue(15510) <= os.time()) then
                players:sendTextMessage(TALKTYPE_MONSTER_SAY, "You did this boss before 12 hours.")
                player:say("Someone already did this room before 12 hours!", TALKTYPE_MONSTER_SAY)
                return
            end
        end
        for i = 1, #storePlayers do
            players = storePlayers[i]
            config.playerPositions[i]:sendMagicEffect(CONST_ME_POFF)
            players:teleportTo(config.newPositions[i])
            config.newPositions[i]:sendMagicEffect(CONST_ME_ENERGYAREA)
            players:setDirection(DIRECTION_NORTH)
            local players, tab = {}, config.playerPositions
            for i = 1, #tab do
            local playerTile = Tile(tab)
            local playerToGo = Player(playerTile:getTopCreature())
            playerToGo:setStorageValue(15510, os.time()+exaustedSeconds*43200)
        end
        end
     
            elseif item.itemid == 9825 then
        if config.daily then
            player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_NOTPOSSIBLE))
            return true
        end
    end

    item:transform(item.itemid == 9826 and 9825 or 9826)
    return true
end
 
Try this one
Lua:
local config = {
    requiredLevel = 350,
    daily = true,
    BossPosition = Position(780, 337, 10),
    Center_Room_Position = Position(789, 364, 10),
    playerPositions = {
        Position(778, 315, 10),
        Position(779, 315, 10),
        Position(780, 315, 10),
        Position(781, 315, 10),
        Position(782, 315, 10)
    },
    newPositions = {
        Position(782, 344, 10),
        Position(782, 344, 10),
        Position(782, 344, 10),
        Position(782, 344, 10),
        Position(782, 344, 10)
    },
}


function onUse(player, item, fromPosition, target, toPosition, monster, isHotkey)
    if item.itemid == 9825 then
        if player:getPosition() ~= Position(778, 315, 10) then
            item:transform(9826)
            return true
        end
        local storePlayers, playerTile = {}
        local exaustedSeconds = 1
        for i = 1, #config.playerPositions do
            playerTile = Tile(config.playerPositions[i]):getTopCreature()
            if not (player:getStorageValue(15510) <= os.time()) then
                player:say("You did this boss before 12 hours!", TALKTYPE_MONSTER_SAY)
                player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Someone did this boss before 12 hours.")
                return true       
            end
            storePlayers[#storePlayers + 1] = playerTile
        end
    
        local specs, spec = Game.getSpectators(config.Center_Room_Position, false, false, 15, 15, 15, 15)
        for i = 1, #specs do
            spec = specs[i]       
            if spec:isPlayer() then
                if item.itemid == 9826 then
                    if player:getPosition() ~= Position(777, 315, 10) then
                        item:transform(9826)
                        player:say("Someone is fighting with Sir Nictros and Sir Baeloc.", TALKTYPE_MONSTER_SAY)
                        return true
                    end
                end
                return true
            end
        end   

        local specs, spec = Game.getSpectators(config.Center_Room_Position, false, false, 15, 15, 15, 15)
        for i = 1, #specs do
            spec = specs[i]
            if spec:isPlayer() then
                player:say("Someone is fighting with Sir Nictros and Sir Baeloc.", TALKTYPE_MONSTER_SAY)
                player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Someone is fighting with Sir Nictros and Sir Baeloc.")
                return true
            end

            spec:remove()
        end

        local players
        local monster = Game.createMonster("Sir Nictros", Position(776, 334, 10))
    
    
        local monster1 = Game.createMonster("Sir Baeloc", Position(784, 334, 10))
        monster1:setReward(true)
    
        for i = 1, #storePlayers do
            players = storePlayers[i]
    
            if not (players:getStorageValue(15510) <= os.time()) then
                players:sendTextMessage(TALKTYPE_MONSTER_SAY, "You did this boss before 12 hours.")
                player:say("Someone already did this room before 12 hours!", TALKTYPE_MONSTER_SAY)
                return
            end
        end
        for i = 1, #storePlayers do
            players = storePlayers[i]
            config.playerPositions[i]:sendMagicEffect(CONST_ME_POFF)
            players:teleportTo(config.newPositions[i])
            config.newPositions[i]:sendMagicEffect(CONST_ME_ENERGYAREA)
            players:setDirection(DIRECTION_NORTH)
            local players, tab = {}, config.playerPositions
            for i = 1, #tab do
            local playerTile = Tile(tab)
            local playerToGo = Player(playerTile:getTopCreature())
            playerToGo:setStorageValue(15510, os.time()+exaustedSeconds*43200)
        end
        end
    
            elseif item.itemid == 9825 then
        if config.daily then
            player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_NOTPOSSIBLE))
            return true
        end
    end

    item:transform(item.itemid == 9826 and 9825 or 9826)
    return true
end


I will try thank you very much, since already thank you.
 
Try this one
Lua:
local config = {
    requiredLevel = 350,
    daily = true,
    BossPosition = Position(780, 337, 10),
    Center_Room_Position = Position(789, 364, 10),
    playerPositions = {
        Position(778, 315, 10),
        Position(779, 315, 10),
        Position(780, 315, 10),
        Position(781, 315, 10),
        Position(782, 315, 10)
    },
    newPositions = {
        Position(782, 344, 10),
        Position(782, 344, 10),
        Position(782, 344, 10),
        Position(782, 344, 10),
        Position(782, 344, 10)
    },
}


function onUse(player, item, fromPosition, target, toPosition, monster, isHotkey)
    if item.itemid == 9825 then
        if player:getPosition() ~= Position(778, 315, 10) then
            item:transform(9826)
            return true
        end
        local storePlayers, playerTile = {}
        local exaustedSeconds = 1
        for i = 1, #config.playerPositions do
            playerTile = Tile(config.playerPositions[i]):getTopCreature()
            if not (player:getStorageValue(15510) <= os.time()) then
                player:say("You did this boss before 12 hours!", TALKTYPE_MONSTER_SAY)
                player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Someone did this boss before 12 hours.")
                return true       
            end
            storePlayers[#storePlayers + 1] = playerTile
        end
    
        local specs, spec = Game.getSpectators(config.Center_Room_Position, false, false, 15, 15, 15, 15)
        for i = 1, #specs do
            spec = specs[i]       
            if spec:isPlayer() then
                if item.itemid == 9826 then
                    if player:getPosition() ~= Position(777, 315, 10) then
                        item:transform(9826)
                        player:say("Someone is fighting with Sir Nictros and Sir Baeloc.", TALKTYPE_MONSTER_SAY)
                        return true
                    end
                end
                return true
            end
        end   

        local specs, spec = Game.getSpectators(config.Center_Room_Position, false, false, 15, 15, 15, 15)
        for i = 1, #specs do
            spec = specs[i]
            if spec:isPlayer() then
                player:say("Someone is fighting with Sir Nictros and Sir Baeloc.", TALKTYPE_MONSTER_SAY)
                player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Someone is fighting with Sir Nictros and Sir Baeloc.")
                return true
            end

            spec:remove()
        end

        local players
        local monster = Game.createMonster("Sir Nictros", Position(776, 334, 10))
    
    
        local monster1 = Game.createMonster("Sir Baeloc", Position(784, 334, 10))
        monster1:setReward(true)
    
        for i = 1, #storePlayers do
            players = storePlayers[i]
    
            if not (players:getStorageValue(15510) <= os.time()) then
                players:sendTextMessage(TALKTYPE_MONSTER_SAY, "You did this boss before 12 hours.")
                player:say("Someone already did this room before 12 hours!", TALKTYPE_MONSTER_SAY)
                return
            end
        end
        for i = 1, #storePlayers do
            players = storePlayers[i]
            config.playerPositions[i]:sendMagicEffect(CONST_ME_POFF)
            players:teleportTo(config.newPositions[i])
            config.newPositions[i]:sendMagicEffect(CONST_ME_ENERGYAREA)
            players:setDirection(DIRECTION_NORTH)
            local players, tab = {}, config.playerPositions
            for i = 1, #tab do
            local playerTile = Tile(tab)
            local playerToGo = Player(playerTile:getTopCreature())
            playerToGo:setStorageValue(15510, os.time()+exaustedSeconds*43200)
        end
        end
    
            elseif item.itemid == 9825 then
        if config.daily then
            player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_NOTPOSSIBLE))
            return true
        end
    end

    item:transform(item.itemid == 9826 and 9825 or 9826)
    return true
end

it didn't work for me, the boss is born, but I am not teleported and it seems that the cooldown does not work.
 
Didn't look too much at the script except for the point where it sets the storage, try this.
Might work.

Lua:
local config = {
    requiredLevel = 350,
    daily = true,
    BossPosition = Position(780, 337, 10),
    Center_Room_Position = Position(789, 364, 10),
    playerPositions = {
        Position(778, 315, 10),
        Position(779, 315, 10),
        Position(780, 315, 10),
        Position(781, 315, 10),
        Position(782, 315, 10)
    },
    newPositions = {
        Position(782, 344, 10),
        Position(782, 344, 10),
        Position(782, 344, 10),
        Position(782, 344, 10),
        Position(782, 344, 10)
    },
}


function onUse(player, item, fromPosition, target, toPosition, monster, isHotkey)
    if item.itemid == 9825 then
        if player:getPosition() ~= Position(778, 315, 10) then
            item:transform(9826)
            return true
        end 
        local storePlayers, playerTile = {}
        local exaustedSeconds = 1
        for i = 1, #config.playerPositions do
            playerTile = Tile(config.playerPositions[i]):getTopCreature()
            if not (player:getStorageValue(15510) <= os.time()) then
                player:say("You did this boss before 12 hours!", TALKTYPE_MONSTER_SAY)
                player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Someone did this boss before 12 hours.")
                return true         
            end
            storePlayers[#storePlayers + 1] = playerTile
        end
      
        local specs, spec = Game.getSpectators(config.Center_Room_Position, false, false, 15, 15, 15, 15)
        for i = 1, #specs do
            spec = specs[i]         
            if spec:isPlayer() then
                if item.itemid == 9826 then
                    if player:getPosition() ~= Position(777, 315, 10) then
                        item:transform(9826)
                        player:say("Someone is fighting with Sir Nictros and Sir Baeloc.", TALKTYPE_MONSTER_SAY)
                        return true
                    end
                end
                return true
            end
        end     

        local specs, spec = Game.getSpectators(config.Center_Room_Position, false, false, 15, 15, 15, 15)
        for i = 1, #specs do
            spec = specs[i]
            if spec:isPlayer() then
                player:say("Someone is fighting with Sir Nictros and Sir Baeloc.", TALKTYPE_MONSTER_SAY)
                player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "Someone is fighting with Sir Nictros and Sir Baeloc.")
                return true
            end

            spec:remove()
        end
  
        local players
        local monster = Game.createMonster("Sir Nictros", Position(776, 334, 10))
      
      
        local monster1 = Game.createMonster("Sir Baeloc", Position(784, 334, 10))
        monster1:setReward(true)
      
        for i = 1, #storePlayers do
            players = storePlayers[i]
      
            if not (players:getStorageValue(15510) <= os.time()) then
                players:sendTextMessage(TALKTYPE_MONSTER_SAY, "You did this boss before 12 hours.")
                player:say("Someone already did this room before 12 hours!", TALKTYPE_MONSTER_SAY)
                return
            end
        end
        for i = 1, #storePlayers do
            players = storePlayers[i]
            config.playerPositions[i]:sendMagicEffect(CONST_ME_POFF)
            players:teleportTo(config.newPositions[i])
            config.newPositions[i]:sendMagicEffect(CONST_ME_ENERGYAREA)
            players:setDirection(DIRECTION_NORTH)
            players:setStorageValue(15510, os.time()+exaustedSeconds*43200)
        end
      
            elseif item.itemid == 9825 then
        if config.daily then
            player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_NOTPOSSIBLE))
            return true
        end
    end

    item:transform(item.itemid == 9826 and 9825 or 9826)
    return true
end
 
Back
Top