• 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!

HELP on my oberon lever .

robertorb12

New Member
Joined
Jan 15, 2020
Messages
65
Reaction score
3
hello, what happens that in my oberon can go to kill him but once you kill him for the first time and spend 20 hours, you can not go back in it keeps coming out that you wait for the time.
someone could help me?

here my script:

Code:
local config = {
    firstboss = "grand master oberon",
    bossPosition = Position(33364, 31317, 9),
    centerPosition = Position(33364, 31318, 9), -- Center Room
    exitPosition = Position(33297, 31285, 9), -- Exit Position
    newPosition = Position(33364, 31321, 9),
    rangeX = 10,
    rangeY = 10,
    time = 30, -- time in minutes to remove the player 
} 

local monsters = {
    {pillar = "oberons ire", pos = Position(33367, 31320, 9)},
    {pillar = "oberons spite", pos = Position(33361, 31320, 9)},
    {pillar = "oberons hate", pos = Position( 33367, 31316, 9)},
    {pillar = "oberons bile", pos = Position(33361, 31316, 9)}
}

local function OberonIsOccupied(centerPosition, rangeX, rangeY)
    local spectators = Game.getSpectators(config.centerPosition, false, false, config.rangeX, config.rangeX, config.rangeY, config.rangeY)
    if #spectators ~= 0 then
        return true
    end

    return false
end

local function clearOberonRoom(playerId, centerPosition, rangeX, rangeY, exitPosition)
    local spectators, spectator = Game.getSpectators(config.centerPosition, 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

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if item.itemid == 1945 then
        if player:getPosition() ~= Position(33363, 31344, 9) and player:getPosition() ~= Position(33364, 31344, 9) and player:getPosition() ~= Position(33365, 31344, 9) then
            item:transform(1946)
            return true
        end
    end
  
    if item.itemid == 1945 then
        if player:getStorageValue(Storage.TheSecretLibrary.TheOrderOfTheFalcon.OberonTimer) >= 1 then
           player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You can face Grand Master Oberon every 20 hours.")
       return true
        end
    end

    if item.itemid == 1945 then
        if OberonIsOccupied(config.centerPosition, config.rangeX, config.rangeY) then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "There's someone fighting with Grand Master Oberon.")
        return true
    end
        for n = 1, #monsters do
            Game.createMonster(monsters[n].pillar, monsters[n].pos, true, true)
        end
        local monster = Game.createMonster(config.firstboss, config.bossPosition)
    if not monster then
        return true
    end
  
  
        for x = 33362, 33366 do
            local playerTile = Tile(Position(x, 31344, 9)):getTopCreature()
               if playerTile and playerTile:isPlayer() then                   
                playerTile:getPosition():sendMagicEffect(CONST_ME_POFF)
                playerTile:teleportTo(config.newPosition)
                playerTile:getPosition():sendMagicEffect(CONST_ME_TELEPORT) 
                playerTile:setExhaustion(Storage.TheSecretLibrary.TheOrderOfTheFalcon.OberonTimer, 20 * 60 * 60)
            end
        end
        addEvent(clearOberonRoom, 60 * config.time * 1000, player:getId(), config.centerPosition, config.rangeX, config.rangeY, config.exitPosition)
        item:transform(1946)
    elseif item.itemid == 1946 then
        item:transform(1945)
    end
    return true
end

help please :D
 
Last edited:
Solution
replace:
Lua:
if player:getStorageValue(Storage.TheSecretLibrary.TheOrderOfTheFalcon.OberonTimer) >= 1 then

with:
Lua:
if player:getStorageValue(Storage.TheSecretLibrary.TheOrderOfTheFalcon.OberonTimer) > os.time() then

replace:
Lua:
playerTile:setExhaustion(Storage.TheSecretLibrary.TheOrderOfTheFalcon.OberonTimer, 20 * 60 * 60)

with:
Lua:
playerTile:setStorageValue(Storage.TheSecretLibrary.TheOrderOfTheFalcon.OberonTimer, os.time() + (20 * 60 * 60))

set it to something low to test it:
Lua:
playerTile:setStorageValue(Storage.TheSecretLibrary.TheOrderOfTheFalcon.OberonTimer, os.time() + 5) -- 5 seconds

os.time()
replace:
Lua:
if player:getStorageValue(Storage.TheSecretLibrary.TheOrderOfTheFalcon.OberonTimer) >= 1 then

with:
Lua:
if player:getStorageValue(Storage.TheSecretLibrary.TheOrderOfTheFalcon.OberonTimer) > os.time() then

replace:
Lua:
playerTile:setExhaustion(Storage.TheSecretLibrary.TheOrderOfTheFalcon.OberonTimer, 20 * 60 * 60)

with:
Lua:
playerTile:setStorageValue(Storage.TheSecretLibrary.TheOrderOfTheFalcon.OberonTimer, os.time() + (20 * 60 * 60))

set it to something low to test it:
Lua:
playerTile:setStorageValue(Storage.TheSecretLibrary.TheOrderOfTheFalcon.OberonTimer, os.time() + 5) -- 5 seconds

os.time()
 
Last edited:
Solution
replace:
Lua:
if player:getStorageValue(Storage.TheSecretLibrary.TheOrderOfTheFalcon.OberonTimer) >= 1 then

with:
Lua:
if player:getStorageValue(Storage.TheSecretLibrary.TheOrderOfTheFalcon.OberonTimer) > os.time() then

replace:
Lua:
playerTile:setExhaustion(Storage.TheSecretLibrary.TheOrderOfTheFalcon.OberonTimer, 20 * 60 * 60)

with:
Lua:
playerTile:setStorageValue(Storage.TheSecretLibrary.TheOrderOfTheFalcon.OberonTimer, os.time() + (20 * 60 * 60 * 1000)) -- needs to be in ms

set it to something low to test it:
Lua:
playerTile:setStorageValue(Storage.TheSecretLibrary.TheOrderOfTheFalcon.OberonTimer, os.time() + 5000)) -- 5 seconds



throws me this error

[Warning - Event::checkScript] Can not load script: scripts/farmine/Oberonlever.lua
data/actions/scripts/farmine/Oberonlever.lua:78: unexpected symbol near ')'
Post automatically merged:

replace:
Lua:
if player:getStorageValue(Storage.TheSecretLibrary.TheOrderOfTheFalcon.OberonTimer) >= 1 then

with:
Lua:
if player:getStorageValue(Storage.TheSecretLibrary.TheOrderOfTheFalcon.OberonTimer) > os.time() then

replace:
Lua:
playerTile:setExhaustion(Storage.TheSecretLibrary.TheOrderOfTheFalcon.OberonTimer, 20 * 60 * 60)

with:
Lua:
playerTile:setStorageValue(Storage.TheSecretLibrary.TheOrderOfTheFalcon.OberonTimer, os.time() + (20 * 60 * 60 * 1000)) -- needs to be in ms

set it to something low to test it:
Lua:
playerTile:setStorageValue(Storage.TheSecretLibrary.TheOrderOfTheFalcon.OberonTimer, os.time() + 5000)) -- 5 seconds
and if I remove the symbol, it remains the same. I couldn't pull the lever in 5 seconds
 
Last edited:
throws me this error

[Warning - Event::checkScript] Can not load script: scripts/farmine/Oberonlever.lua
data/actions/scripts/farmine/Oberonlever.lua:78: unexpected symbol near ')'

Get rid of the extra )
Lua:
playerTile:setStorageValue(Storage.TheSecretLibrary.TheOrderOfTheFalcon.OberonTimer, os.time() + 5000) -- 5 seconds


and if I remove the symbol, it remains the same. I couldn't pull the lever in 5 seconds

What?

Thats what you want right? player cant pull the lever for another 20 hours.
We're just testing with 5 seconds.
 
Get rid of the extra )
Lua:
playerTile:setStorageValue(Storage.TheSecretLibrary.TheOrderOfTheFalcon.OberonTimer, os.time() + 5000) -- 5 seconds




What?

Thats what you want right? player cant pull the lever for another 20 hours.
We're just testing with 5 seconds.

I know, but it's not like that, I keep getting the message
So, I put it like that in 5 seconds to test but it didn't work, I still get the message and I couldn't get in.
Post automatically merged:

Get rid of the extra )
Lua:
playerTile:setStorageValue(Storage.TheSecretLibrary.TheOrderOfTheFalcon.OberonTimer, os.time() + 5000) -- 5 seconds




What?

Thats what you want right? player cant pull the lever for another 20 hours.
We're just testing with 5 seconds.

I have the same error from the beginning in case I do not explain well
 
Last edited:
Maybe its not millisecond.

Try this, I've updated it:
 
Maybe its not millisecond.

Try this, I've updated it:
THANKS BRO, IT WORKED
Post automatically merged:

Maybe its not millisecond.

Try this, I've updated it:
It can't be real :( now when a player dies and another one pulls the lever, this appears: "There's someone fighting with Grand Master Oberon."
Before changing the script, if someone died and another person pulled the lever if he could enter :s
 
It can't be real :( now when a player dies and another one pulls the lever, this appears: "There's someone fighting with Grand Master Oberon."
Before changing the script, if someone died and another person pulled the lever if he could enter :s

My changes didn't touch that.

It's is just checking the room for players...
Lua:
local function OberonIsOccupied(centerPosition, rangeX, rangeY)
    local spectators = Game.getSpectators(config.centerPosition, false, false, config.rangeX, config.rangeX, config.rangeY, config.rangeY)
    if #spectators ~= 0 then
        return true
    end

    return false
end

So if there are two players in there, or YOU, a gm is standing in the room - it would block it.
 
My changes didn't touch that.

It's is just checking the room for players...
Lua:
local function OberonIsOccupied(centerPosition, rangeX, rangeY)
    local spectators = Game.getSpectators(config.centerPosition, false, false, config.rangeX, config.rangeX, config.rangeY, config.rangeY)
    if #spectators ~= 0 then
        return true
    end

    return false
end

So if there are two players in there, or YOU, a gm is standing in the room - it would block it.

nobody is in the room, only the boss was there because he killed my tester
 
change this:
Lua:
local function OberonIsOccupied(centerPosition, rangeX, rangeY)
    local spectators = Game.getSpectators(config.centerPosition, false, false, config.rangeX, config.rangeX, config.rangeY, config.rangeY)
    if #spectators ~= 0 then
        return true
    end

    return false
end

to:
Lua:
local function OberonIsOccupied(centerPosition, rangeX, rangeY)
    -- only checks for players
    local spectators = Game.getSpectators(config.centerPosition, false, true, config.rangeX, config.rangeX, config.rangeY, config.rangeY)
    if #spectators ~= 0 then
        return true
    end

    return false
end

This is going to cause more problems as you aren't despawning Oberon when the player dies.
This script needs work - buddy.

I would leave it as is.
if player dies - Oberon is still there for 30 minutes until the boss timer expires.
 
Last edited:
change this line:
Lua:
local function OberonIsOccupied(centerPosition, rangeX, rangeY)
    local spectators = Game.getSpectators(config.centerPosition, false, false, config.rangeX, config.rangeX, config.rangeY, config.rangeY)
    if #spectators ~= 0 then
        return true
    end

    return false
end

to:
Lua:
local function OberonIsOccupied(centerPosition, rangeX, rangeY)
    local spectators = Game.getSpectators(config.centerPosition, false, true, config.rangeX, config.rangeX, config.rangeY, config.rangeY)
    if #spectators ~= 0 then
        return true
    end

    return false
end

This is going to cause more problems as you aren't despawning Oberon when the player dies.
This script just needs work buddy.
hmmm..

and how can I make oberon disappear ?
Post automatically merged:

hmmm..

and how can I make oberon disappear ?

right now it disappears every 10 minutes
 
Back
Top