• 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 Error boss Urmahlullu the Immaculate disappear

Azerty

Active Member
Joined
Apr 15, 2022
Messages
335
Solutions
4
Reaction score
36
Can anyone help me with this error, when someone already kills the boss and another player tries to enter the room the message appears that the room is occupied, but the boss disappears. I use TFS 1.5 downgrade 8.6

LUA:
-- lever to urmahlullu room

local config = {
    requiredLevel = 100,
    daily = true,
    roomCenterPosition = Position(33919, 31648, 8),
    playerPositions = {
        Position(33918, 31626, 8),
        Position(33919, 31626, 8),
        Position(33920, 31626, 8),
        Position(33921, 31626, 8),
        Position(33922, 31626, 8)
    },
    teleportPosition = Position(33918, 31657, 8),
    bossPosition = Position(33918, 31641, 8)
}

local leverboss = Action()

function leverboss.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if item.itemid == 9825 then
        -- Check if the player that pulled the lever is on the correct position
        if player:getPosition() ~= config.playerPositions[1] then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You can\'t start the battle.")
            return true
        end
       
        local team, participant = {}

        for i = 1, #config.playerPositions do
            participant = Tile(config.playerPositions[i]):getTopCreature()
           
            -- Check there is a participant player
            if participant and participant:isPlayer() then
                -- Check participant level
                if participant:getLevel() < config.requiredLevel then
                    player:sendTextMessage(MESSAGE_EVENT_ADVANCE,
                        "All the players need to be level ".. config.requiredLevel .." or higher.")
                    return true
                end

                -- Check participant boss timer
                if config.daily and participant:getStorageValue(Storage.KilmareshQuest.UrmahlulluTimer) > os.time() then
                    player:getPosition():sendMagicEffect(CONST_ME_POFF)
                    player:sendCancelMessage("Not all players are ready yet from last battle.")
                    return true
                end

                team[#team + 1] = participant
            end
        end

        -- Check if a team currently inside the boss room
        local specs, spec = Game.getSpectators(config.roomCenterPosition, false, false, 14, 14, 13, 13)
        for i = 1, #specs do
            spec = specs[i]
            if spec:isPlayer() then
                player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "A team is already inside the boss room.")
                return true
            end

            spec:remove()
        end

        -- Spawn boss
        Game.createMonster("Urmahlullu the Immaculate", config.bossPosition)

        -- Teleport team participants
        for i = 1, #team do
            team[i]:getPosition():sendMagicEffect(CONST_ME_POFF)
            team[i]:teleportTo(config.teleportPosition)
            -- Assign boss timer
            team[i]:setStorageValue(Storage.KilmareshQuest.UrmahlulluTimer, os.time() + 20*60*60) -- 20 hours
            team[i]:setStorageValue(Storage.KilmareshQuest.Eighth.Yonan, 1)
        end
       
        config.teleportPosition:sendMagicEffect(CONST_ME_ENERGYAREA)
    end

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

leverboss:uid(33001)
leverboss:register()
 
LUA:
        -- Check if a team currently inside the boss room

        local specs, spec = Game.getSpectators(config.roomCenterPosition, false, false, 14, 14, 13, 13)

        for i = 1, #specs do

            spec = specs[i]

            if spec:isPlayer() then

                player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "A team is already inside the boss room.")

spec:remove()

                return true

            end



           

        end

here you just have to replace
 
LUA:
        -- Check if a team currently inside the boss room

        local specs, spec = Game.getSpectators(config.roomCenterPosition, false, false, 14, 14, 13, 13)

        for i = 1, #specs do

            spec = specs[i]

            if spec:isPlayer() then

                player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "A team is already inside the boss room.")

spec:remove()

                return true

            end



          

        end

here you just have to replace
It didn't work, and the player is still kicked
 
It didn't work, and the player is still kicked
Well, this part is slightly wrong.. in that if the first spectator found is the boss, it would remove it..
so change
LUA:
        -- Check if a team currently inside the boss room
        local specs, spec = Game.getSpectators(config.roomCenterPosition, false, false, 14, 14, 13, 13)
        for i = 1, #specs do
            spec = specs[i]
            if spec:isPlayer() then
                player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "A team is already inside the boss room.")
                return true
            end

            spec:remove()
        end
to
LUA:
        -- Check if a team currently inside the boss room
        local specs, spec = Game.getSpectators(config.roomCenterPosition, false, false, 14, 14, 13, 13)
        for i = 1, #specs do
            if specs[i]:isPlayer() then
                player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "A team is already inside the boss room.")
                return true
            end
        end
        
        -- remove any remaining creatures from boss room
        for i = 1, #specs do
            specs[i]:remove()
        end
 
Back
Top