• 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+ Check player pos.

Svira

Active Member
Joined
Jan 27, 2008
Messages
267
Solutions
11
Reaction score
36
I am using this Advanced Monster Arena TFS 1.2 script
and all great just a question:
How to make the script check only the first position and teleport, for example, 8 players? in the documentation I see that you can add more than 1 but the script checks each item if it is taken. I want to make a script for 10 players, but it can enter, for example, 1 or 3 and not all must be, for example, with the annihilator quest ...

I tried to add in the library:
Lua:
if (self.name == "NAMEOFROOM" and #group > 0) or #group == #self.playertable then
but unfortunately no result, no error or effect
my script:

Lua:
local waves = {
    [1] = Wave({
            ["Ushuriel"] = 1,
        }),
    [2] = Wave({
            ["Zugurosh"] = 1,
        }),
    [3] = Wave({
            ["Zugurosh"] = 1,
        }),
    [4] = Wave({
            ["Madareth"] = 1,
        }),
    [5] = Wave({
            ["Latrivan"] = 1,
        }),
    [6] = Wave({
            ["Golgordan"] = 1,
        }),
    [7] = Wave({
            ["Annihilon"] = 1,
        }),
    [8] = Wave({
            ["Hellgorak"] = 1,
        }),
}

local config = {
    levers = {1945, 1946},
}

function rewardPlayers(player, arena)
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Congratulations, you finished the arena " .. arena.name .. ".")
    return true
end



function spawnBroadcast(player, waveid, arena)
    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Spawning wave " .. waveid .. ".")
    return true
end

function waveClear(player, waveid, arena)
    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You cleared wave " .. waveid .. ".")
    if player:getMaxHealth()-player:getHealth() > 0 then
        player:addHealth(player:getMaxHealth()-player:getHealth())
    end
    return true
end

function jokerDeath(player, waveid, arena)
    player:say("Huehuehue?", TALKTYPE_MONSTER_SAY, false, player, arena.position)
end

function arenaStart(player, arena)
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have entered the arena " .. arena.name .. ".")
end

function arenaThink(arena, interval)
    local players = arena:getPlayersInside()
    if #players == 0 then
        arena:reset()
    else
        for i, player in ipairs(players) do
            player:addHealth(-1)
        end
    end
end
-- pierwsza pozycja wejscie gracz, druga srodek areny, trzecia pozycja wyjscia, czwarta w nowej lini przy dzwigni
local arena = Arena("INQ Final", Position(102, 243, 8), Position(102, 243, 8), 9, Position(52, 321, 8))
arena:addPlayerPosition(Position(124, 261, 8))
arena:addPlayerPosition(Position(124, 262, 8))
arena:addPlayerPosition(Position(124, 263, 8))
arena:addPlayerPosition(Position(124, 264, 8))
arena:addPlayerPosition(Position(123, 262, 8))
arena:addPlayerPosition(Position(123, 263, 8))
arena:addPlayerPosition(Position(123, 264, 8))
arena:addPlayerPosition(Position(125, 262, 8))
arena:addPlayerPosition(Position(125, 263, 8))
arena:addPlayerPosition(Position(125, 264, 8))
arena:addWaves(unpack(waves))
arena:setJokerCreature("Cooldown")
arena:setDelayWaves(2000)
arena:setSpawnCallback(spawnBroadcast)
arena:setWaveclearCallback(waveClear)
arena:setJokerdeathCallback(jokerDeath)

arena:setStartCallback(arenaStart)
arena:setThinkCallback(arenaThink)

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if item:getId() == config.levers[1] then
        local ret = arena:useLever(player)

        if ret then
            item:transform(config.levers[2])
        else
            item:getPosition():sendMagicEffect(CONST_ME_POFF)
        end

    elseif item:getId() == config.levers[2] then
        item:transform(config.levers[1])
    end

    return true
end
 
Back
Top