• 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 two bosses share cd, need help

Nooba007

New Member
Joined
Jul 10, 2008
Messages
23
Reaction score
2
I need some help with understanding why the cooldown for urmahlullu and scartlett etzel are shared between each other. Server is 12.0 and its on tfs1.3


basicly once you kill one you go on cd for 2 hours but you cant do the other because it shares cd
 

Attachments

Yeah you're going to want to put a global storage check in there, have them both set the same storage value and it will share the cooldown.
 
Only change the storageValue. This will make the cds different.

Sorry for not fully understanding but it does seem that they do have different storage values

local timer = playerTile:getStorageValue(Storage.ScarlettTimer)

local timer = playerTile:getStorageValue(Storage.UrmaTimer)

where do these check back to? would i find this in global events?
 
Sorry for not fully understanding but it does seem that they do have different storage values

local timer = playerTile:getStorageValue(Storage.ScarlettTimer)

local timer = playerTile:getStorageValue(Storage.UrmaTimer)

where do these check back to? would i find this in global events?

Well that right there shows they dont.

Check your lib file(s) for those storage values, set them to the same number.

Probably in your data\lib directory.
 
Well that right there shows they dont.

Check your lib file(s) for those storage values, set them to the same number.

Probably in your data\lib directory.

maybe I explained things poorly but I actually want them to be different but in the OT they share cd

ScarlettTimer = 51002,
UrmaTimer = 51003,

i found this in lib/tables/storages
 
maybe I explained things poorly but I actually want them to be different but in the OT they share cd

ScarlettTimer = 51002,
UrmaTimer = 51003,

i found this in lib/tables/storages

Oh

Use these

Code:
local config = {
    firstboss = "scarlett etzel",
    lowx = 33385,
    lowy = 32638,
    hix = 33406,
    hiy = 32660,
    z = 6,
    topleft = -1, --Position(config.lowx, config.lowy, config.z),
    bossPosition = Position(33396, 32641, 6),
    centerRoom = Position(33364, 31318, 9), -- Center Room
    exitPosition = Position(33396, 32668, 6),--Position(33297, 31285, 9)
    newPosition = Position(33396, 32657, 6), -- Entrance to Boss Room
    rangeX = -1, -- hix - lowx
    rangeY = -1, -- hiy - lowy
    time = 15, -- time in minutes to remove the player

    leverspots = 5,
    leverpos = {
        Position(33396, 32661, 6),
        Position(33395, 32662, 6),
        Position(33397, 32662, 6),
        Position(33396, 32662, 6),
        Position(33396, 32663, 6),
    }
}

local function clearRoom()
    local spectators, spectator = Game.getSpectators(config.topleft, false, false, 0, config.rangeX, 0, config.rangeY)
    for i = 1, #spectators do
        spectator = spectators[i]
        if spectator:isPlayer() and spectator.uid == playerId then
            spectator:teleportTo(config.exitPosition)
            exitPosition:sendMagicEffect(CONST_ME_TELEPORT)
        end
        if spectator:isMonster() then
            spectator:remove()
        end
    end
end

local function kick(playerid, topleft, exit)
    local player = Player(playerid)
    local position = player:getPosition()

    if position.z ~= config.z then
        return false
    end
    if position.x > config.lowx and position.x < config.hix then
        if position.y > config.lowy and position.y < config.hiy then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You've exceeded your timelimit..")
            player:teleportTo(config.exitPosition)
            return true
        end
    end
end

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    config.topleft = Position(config.lowx, config.lowy, config.z)
    config.rangeX = config.hix - config.lowx
    config.rangeY = config.hiy - config.lowy
    if item.itemid == 36319 then
        if player:getPosition() ~= config.leverpos[1] then
            player:say("You must be on the platform to pull this lever.", TALKTYPE_MONSTER_SAY)
            return true
        end
    end

    if item.itemid == 36319 then
        -- Check if someone is currently in room
        local specs, spec = Game.getSpectators(config.topleft, false, false, 0, config.rangeX, 0, config.rangeY)
        for i = 1, #specs do
            spec = specs[i]
            if spec:isPlayer() then
                player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "There's someone fighting with Scarlett already.")
                return false
            end
        end
       
        -- Check if party is all off exhaust
        local acceptable = true
        local lvl = false
        for i = 1, #config.leverpos do
            local playerTile = Tile(config.leverpos[i]):getTopCreature()
            if playerTile and playerTile:isPlayer() then
                local timer = playerTile:getStorageValue(Storage.ScarlettTimer)
                local timer2 = playerTile:getStorageValue(Storage.UrmaTimer)
                if timer > os.time() or timer2 > os.time() then
                    local diff = timer - os.time()
                    local diff2 = timer - os.time()
                    if diff2 > diff then diff = diff2 end -- Uses the 2nd timer if it's higher                  
                    local minutes = math.floor(diff/60)
                    playerTile:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need to wait " .. minutes .. " minutes to face Scarlett Etzel again.")
                    acceptable = false
                end
                if playerTile:getLevel() < 250 then
                    playerTile:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need to be above level 250.")
                    acceptable = false
                    lvl = true
                end
            end
        end


        if acceptable == true then
            clearRoom()
            local monster = Game.createMonster(config.firstboss, config.bossPosition)
            Game.setStorageValue(GlobalStorage.Bosses.Scarlett, 1)
            for i = 1, #config.leverpos do
                local playerTile = Tile(config.leverpos[i]):getTopCreature()
                if playerTile and playerTile:isPlayer() then                    
                    playerTile:getPosition():sendMagicEffect(CONST_ME_POFF)
                    playerTile:teleportTo(config.newPosition)
                    playerTile:getPosition():sendMagicEffect(CONST_ME_TELEPORT)  
                    playerTile:setStorageValue(Storage.ScarlettTimer, os.time() + 2 * 3600)
                    playerTile:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have " ..
                        config.time .. " minutes to face Scarlett Etzel.")
                    addEvent(kick, config.time * 60 * 1000, playerTile:getId(), config.exitPosition)
                end
            end
            --addEvent(clearOberonRoom, 60 * config.time * 1000, player:getId(), config.centerRoom, config.rangeX, config.rangeY, config.exitPosition)
        else
            if lvl == true then
                player:say("Someone in your party is under level 250.")
            else
                player:say("Someone in your party faced Scarlett Etzel less than 2 hours ago.")
            end
        end
    end
    return true
end

Lua:
local config = {
    firstboss = "Urmahlullu the Immaculate",
    lowx = 33906,
    lowy = 31635,
    hix = 33931,
    hiy = 31663,
    z = 8,
    topleft = -1, --Position(config.lowx, config.lowy, config.z),
    bossPosition = Position(33919, 31648, 8),
    centerRoom = Position(33918, 31649, 8), --25 rangeX 28 rangeY
    exitPosition = Position(33920, 31629, 8),--Position(33297, 31285, 9)
    newPosition = Position(33915, 31641, 8), -- Entrance to Boss Room
    rangeX = 13, -- hix - lowx
    rangeY = 14, -- hiy - lowy
    time = 15, -- time in minutes to remove the player

    leverspots = 5,
    leverpos = {
        Position(33918, 31626, 8),
        Position(33919, 31626, 8),
        Position(33920, 31626, 8),
        Position(33921, 31626, 8),
        Position(33922, 31626, 8),
    }
}

local function clearRoom()
    local spectators, spectator = Game.getSpectators(config.centerRoom, false, false, config.rangeX, config.rangeX, config.rangeY, config.rangeY)
    for i = 1, #spectators do
        spectator = spectators[i]
        if spectator:isPlayer() and spectator.uid == playerId then
            spectator:teleportTo(config.exitPosition)
            exitPosition:sendMagicEffect(CONST_ME_TELEPORT)
        end
        if spectator:isMonster() then
            spectator:remove()
        end
    end
end

local function kick(playerid, centerRoom, exit)
    local player = Player(playerid)
    local position = player:getPosition()

    if position.z ~= config.z then
        return false
    end
    if position.x > config.lowx and position.x < config.hix then
        if position.y > config.lowy and position.y < config.hiy then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You've exceeded your timelimit..")
            player:teleportTo(config.exitPosition)
            return true
        end
    end
end

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if item.itemid == 9825 then
        if player:getPosition() ~= config.leverpos[1] then
            player:say("You must be on the platform to pull this lever.", TALKTYPE_MONSTER_SAY)
            return true
        end
    end

    if item.itemid == 9825 then
        -- Check if someone is currently in room
        local specs, spec = Game.getSpectators(config.centerRoom, false, false, config.rangeX, config.rangeX, config.rangeY, config.rangeY)
        for i = 1, #specs do
            spec = specs[i]
            if spec:isPlayer() then
                player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "There's someone fighting with Urmahlullu already.")
                return false
            end
        end
       
        -- Check if party is all off exhaust
        local acceptable = true
        for i = 1, #config.leverpos do
            local playerTile = Tile(config.leverpos[i]):getTopCreature()
            if playerTile and playerTile:isPlayer() then
                local timer = playerTile:getStorageValue(Storage.UrmaTimer)
                local timer2 = playerTile:getStorageValue(Storage.ScarlettTimer)
                if timer > os.time() or timer2 > os.time() then
                    local diff = timer - os.time()
                    local diff2 = timer - os.time()
                    if diff2 > diff then diff = diff2 end -- Uses the 2nd timer if it's higher
                    local minutes = math.floor(diff/60)
                    playerTile:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need to wait " .. minutes .. " minutes to face Urmahlullu again.")
                    acceptable = false
                end
            end
        end


        if acceptable == true then
            clearRoom()
            local monster = Game.createMonster(config.firstboss, config.bossPosition)
            Game.setStorageValue(GlobalStorage.Bosses.Urma, 1)
            for i = 1, #config.leverpos do
                local playerTile = Tile(config.leverpos[i]):getTopCreature()
                if playerTile and playerTile:isPlayer() then                    
                    playerTile:getPosition():sendMagicEffect(CONST_ME_POFF)
                    playerTile:teleportTo(config.newPosition)
                    playerTile:getPosition():sendMagicEffect(CONST_ME_TELEPORT)  
                    playerTile:setStorageValue(Storage.UrmaTimer, os.time() + 2 * 3600)
                    playerTile:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have " ..
                        config.time .. " minutes to face Urmahlullu.")
                    addEvent(kick, config.time * 60 * 1000, playerTile:getId(), config.exitPosition)
                end
            end
            --addEvent(clearOberonRoom, 60 * config.time * 1000, player:getId(), config.centerRoom, config.rangeX, config.rangeY, config.exitPosition)
        else
            player:say("Someone in your party faced Urmahlullu less than 2 hours ago.")
        end
    elseif item.itemid == 9826 then
        item:transform(9825)
    end
    return true
end
 
Last edited:
maybe I explained things poorly but I actually want them to be different but in the OT they share cd

ScarlettTimer = 51002,
UrmaTimer = 51003,

i found this in lib/tables/storages
GlobalStorage.Bosses.Urma and GlobalStorage.Bosses.Scarlett are different?

Lua:
local timer = playerTile:getStorageValue(Storage.ScarlettTimer)

local timer2 = playerTile:getStorageValue(Storage.UrmaTimer)

if timer > os.time() or timer2 > os.time() then
This will link the countdowns in both scripts.
 
Back
Top