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

TFS 1.X+ Hi, I need help with lever = 5 players

Lalo I

Accepting Dms
Joined
Jul 10, 2018
Messages
52
Reaction score
6
Location
USA
Hello I have this script for issavi, the new update, and I want to see if there is any way to make it so that even if one player pulls the lever it works to the boss, here is my issavi.lua

Lua:
local config = {
    requiredLevel = 300,
    timeToUseAgain = .17, -- time in days
    daily = false,
    centerDemonRoomPosition = Position(34208, 31774, 8),
    playerPositions = {
        Position(34207, 31754, 8),
        Position(34208, 31754, 8),
        Position(34209, 31754, 8),
        Position(34210, 31754, 8),
        Position(34211, 31754, 8)
    },
    newPositions = {
        Position(34206, 31773, 8),
        Position(34207, 31773, 8),
        Position(34208, 31773, 8),
        Position(34209, 31773, 8),
        Position(342010, 31773, 8)
    },
    demonPositions = {
        Position(34208, 31776, 8)
    }
}


function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if item.itemid == 9825 then
        local storePlayers, playerTile = {}

        for i = 1, #config.playerPositions do
            playerTile = Tile(config.playerPositions[i]):getTopCreature()
            if not playerTile or not playerTile:isPlayer() then
                player:sendTextMessage(MESSAGE_STATUS_SMALL, "You need 5 players.")
                return true
            end

            if playerTile:getLevel() < config.requiredLevel then
                player:sendTextMessage(MESSAGE_STATUS_SMALL, "All the players need to be level ".. config.requiredLevel .." or higher.")
                return true
            end
        
            if playerTile:getExhaustion(171717) > 0 then
                player:sendTextMessage(MESSAGE_STATUS_SMALL, "".. playerTile:getName() .." need to wait for ".. player:getExhaustion(171717)/60 .." minutes.")
                return true
            end

               storePlayers[#storePlayers + 1] = playerTile
        end

        local specs, spec = Game.getSpectators(config.centerDemonRoomPosition, false, false, 3, 3, 2, 2)
        for i = 1, #specs do
            spec = specs[i]
            if spec:isPlayer() then
                player:sendTextMessage(MESSAGE_STATUS_SMALL, "A team is already inside the quest room.")
                return true
            end

            spec:remove()
        end

        for i = 1, #config.demonPositions do
            Game.createMonster("Urmahlullu the Immaculate", config.demonPositions[i])
        end

        local players
        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_EAST)
            players:setExhaustion(171717, config.timeToUseAgain*60*1*4)
        end
    elseif item.itemid == 9826 then
        if config.daily then
            player:sendTextMessage(MESSAGE_STATUS_SMALL, Game.getReturnMessage(RETURNVALUE_NOTPOSSIBLE))
            return true
        end
    end

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

Any help? pls ty,
 
Lua:
local playerPositions = {
    [1] = {from = Position(34207, 31754, 8), to = Position(34206, 31773, 8)},
    [2] = {from = Position(34208, 31754, 8), to = Position(34207, 31773, 8)},
    [3] = {from = Position(34209, 31754, 8), to = Position(34208, 31773, 8)},
    [4] = {from = Position(34210, 31754, 8), to = Position(34209, 31773, 8)},
    [5] = {from = Position(34211, 31754, 8), to = Position(342010, 31773, 8)}
}

local demonPositions = {
    [1] = {name = "Urmahlullu the Immaculate", pos = Position(34208, 31776, 8)}
}

local centerPosition = Position(34208, 31774, 8)
local exhaustTime = 60 -- Time in minutes
local levelReq = 300
local playerDirection = DIRECTION_EAST

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local tmp_players = {}
   
    for i = 1, #playerPositions do
        local target = Tile(playerPositions[i].from):getTopDownCreature()
       
        if target then
            tmp_players[#tmp_players + 1] = target
        end
    end
   
    if #tmp_players < 1 then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, "You must be standing on the correct tile.")
        return false
    end
   
    if player:getLevel() < levelReq then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, "You are not high enough level to enter.")
        return false
    end
   
    if player:getExhaustion(171717) > 0 then
        player:sendTextMessage(MESSAGE_STATUS_SMALL, "You must wait ".. player:getExhaustion(171717)/60 .." minutes to enter.")
        return false
    end
       
       
    for i = 1, #tmp_players do
        if tmp_players[i]:getLevel() < levelReq then
            player:sendTextMessage(MESSAGE_STATUS_SMALL, "One or more players are not high enough level to enter.")
            return false
        end
       
        if tmp_players[i]:getExhaustion(171717) > 0 then
            player:sendTextMessage(MESSAGE_STATUS_SMALL, "One or more players are exhausted and cannot enter.")
            return false
        end
    end
   
    local specs = Game.getSpectators(centerPosition, false, false, 3, 3, 2, 2)
    for i = 1, #specs do
        if specs[i]:isPlayer() then
            player:sendTextMessage(MESSAGE_STATUS_SMALL, "A team is already inside the quest room.")
            return false
        end
    end
   
   
    for i = 1, #demonPositions do
        local mons = Tile(demonPositions[i].pos):getTopCreature()
       
        if mons then
            mons:addHealth(mons:getMaxHealth())
        else
            Game.createMonster(demonPositions[i].name, demonPositions[i].pos)
        end
    end
   
    for i = 1, #tmp_players do
        tmp_players[i]:sendMagicEffect(CONST_ME_POFF)
        tmp_players[i]:teleportTo(playerPositions[i].to)
        tmp_players[i]:sendMagicEffect(CONST_ME_TELEPORT)
        tmp_players[i]:setDirection(playerDirection)
        tmp_players[i]:setExhaustion(171717, exhaustTime * 60)
    end

    item:transform(item.itemid == 9825 and 9826 or 9825)
return true
end
 
Lua:
Lua Script Error: [Action Interface]
data/actions/scripts/falcon.lua:onUse
data/actions/scripts/falcon.lua:22: attempt to call method 'getTopDownCreature' (a nil value)
stack traceback:
        [C]: in function 'getTopDownCreature'
        data/actions/scripts/falcon.lua:22: in function <data/actions/scripts/falcon.lua:18>

Can't even click on the lever, just shows that error
its is tfs 1.3
 
Lua:
Lua Script Error: [Action Interface]
data/actions/scripts/falcon.lua:onUse
data/actions/scripts/falcon.lua:22: attempt to call method 'getTopDownCreature' (a nil value)
stack traceback:
        [C]: in function 'getTopDownCreature'
        data/actions/scripts/falcon.lua:22: in function <data/actions/scripts/falcon.lua:18>

Can't even click on the lever, just shows that error
its is tfs 1.3
try using :getTopCreature instead
 
Lua:
local config = {
    duration = 30, -- time till reset, in minutes
    level_req = 10, -- minimum level to do quest
    min_players = 1, -- minimum players to join quest
    lever_id = 1945, -- id of lever before pulled
    pulled_id = 1946 -- id of lever after pulled
}

local player_positions = {
    [1] = {fromPos = Position(33642, 31513, 8), toPos = Position(33666, 31491, 8)},
    [2] = {fromPos = Position(33643, 31513, 8), toPos = Position(33666, 31491, 8)},
    [3] = {fromPos = Position(33644, 31513, 8), toPos = Position(33666, 31491, 8)},
    [4] = {fromPos = Position(33645, 31513, 8), toPos = Position(33666, 31491, 8)},
    [5] = {fromPos = Position(33646, 31513, 8), toPos = Position(33666, 31491, 8)}
}


local configg = {
    maxPlayers = 0,
    room = {fromPos = Position(33640, 31482, 8), toPos = Position(33671, 31497, 8)},
   
}

function boss53Area()
   Game.createMonster("grand master oberon", Position(33649, 31488, 8))
 
    return
end

function onUse(player, item, fromPosition, target, toPosition, isHotkey)



local function getPlayersInArea(fromPos, toPos)
    local players, playerss = {}, Game.getPlayers()
    for i = 1, #playerss do
        local player = playerss[i]
        if isInRange(player:getPosition(), fromPos, toPos) then
            table.insert(players, player)
        end
    end
    return players
end




if #getPlayersInArea(configg.room.fromPos, configg.room.toPos) > configg.maxPlayers then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, 'Wait for the team to leave the room.')
        player:getPosition():sendMagicEffect(CONST_ME_POFF)
        return true
    end  



    local participants, pull_player = {}, false
    for i = 1, #player_positions do
        local fromPos = player_positions[i].fromPos
        local tile = Tile(fromPos)
        if not tile then
            print(">> ERROR: Annihilator tile does not exist for Position(" .. fromPos.x .. ", " .. fromPos.y .. ", " .. fromPos.z .. ").")
            return player:sendCancelMessage("There is an issue with this quest. Please contact an administrator.")
        end

        local creature = tile:getBottomCreature()
        if creature then
            local participant = creature:getPlayer()
            if not participant then
                return player:sendCancelMessage(participant:getName() .. " is not a valid participant.")
            end

            if participant:getLevel() < config.level_req then
                return player:sendCancelMessage(participant:getName() .. " is not the required level.")
            end

            if participant.uid == player.uid then
                pull_player = true
            end

            participants[#participants + 1] = {participant = participant, toPos = player_positions[i].toPos}
        end
    end

    if #participants < config.min_players then
        return player:sendCancelMessage("You do not have the required amount of participants.")
    end

    if not pull_player then
        return player:sendCancelMessage("You are in the wrong position.")
    end



    for i = 1, #participants do
   
    local function Maya()

    participants[i].participant:teleportTo(Position(33649, 31492, 8))
    return true
    end
        participants[i].participant:teleportTo(participants[i].toPos)
        participants[i].toPos:sendMagicEffect(CONST_ME_TELEPORT)
        addEvent(Maya, 10 * 1000)
    end



  addEvent(boss53Area, 500)
    cleanZone(Position(33640, 31482, 8), Position(33671, 31497, 8), true)
    return true
end

I got a new code, nowI want to add exhaustion on thisone, any help?
 
Last edited:
@GM Mega

Try This, data/scripts/urmalulu.lua (it's a rev script), tested on tfs 1.3

actionid:33009
leverid: 9826

Lua:
local config = {
    bossName = "Urmahlullu the Immaculate",
    lockStorage = 5000109, -- globalstorage
    bossPos = Position(33919, 31648, 8),
    centerRoom = Position(33919, 31648, 8), -- Center Room
    exitPosition = Position(33920, 31629, 8), -- Exit Position
    newPos = Position(33919, 31639, 8),
    range = 1,
    time = 10, -- time in minutes to remove the player  
}

local function clearRoom()
    if Game.getStorageValue(config.lockStorage) == 1 then
        local spectators = Game.getSpectators(config.bossPos, false, false, 15, 15, 15, 15)
        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
local leverboss = Action()
function leverboss.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if item.itemid == 9826 and item.actionid == 33009 then
        if player:getPosition() ~= Position(33918, 31626, 8) then -- position of the player to use the lever
            return true
        end
           
    for x = 33918, 33922 do
    local playerTile = Tile(Position(x, 31626, 8)):getTopCreature()
        if playerTile and playerTile:isPlayer() then
            if playerTile:getStorageValue(696969) > os.time() then -- storage
                playerTile:say("You or a member in your team have to wait 20 hours to challange Urmalulu the Immaculate again!", TALKTYPE_MONSTER_SAY)
                item:transform(9825)
                return true
            end
        end
    end          
   
    local specs, spec = Game.getSpectators(config.centerRoom, false, false, 15, 15, 15, 15) -- west, east, north, south
    for i = 1, #specs do
        spec = specs[i]
        if spec:isPlayer() then
            player:sendTextMessage(MESSAGE_STATUS_SMALL, "There's someone fighting with the Immaculate.")
            item:transform(9825)
            return true
        end
    end  
   
    local spectators = Game.getSpectators(config.bossPos, false, false, 15, 15, 15, 15) -- west, east, north, south
    for i = 1, #spectators do
        local spectator = spectators[i]
        if spectator:isMonster() then
            spectator:remove()
        end
    end

    Game.createMonster(config.bossName, config.bossPos, true, true)  
    Game.setStorageValue(config.lockStorage, 1)
    for x = 33918, 33922 do
        local playerTile = Tile(Position(x, 31626, 8)):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(696969, os.time() + 20 * 60 * 3600) -- storage + 20 * 60 * 3600 (20 hours)
            addEvent(clearRoom, 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(9825)
        end
    end
   
elseif item.itemid == 9825 then
        item:transform(9826)
    end
        return true
end

leverboss:aid(33009) -- lever actionid
leverboss:register()
 
Last edited:
Would you know if the durarion of waiting time is per player or per switch on the lever because im trying to add the waiting time on the player not on the lever
 
Back
Top