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

Action Advanced Monster Arena TFS 1.2

Use the think callback for that together with the waveclear.

I dont know how but Im trying to make infinite waves or just unpack first position in wave for 10 minutes and then make arena reset
Is there any easy way to cheat functions ?
I want that script think he should spawn all the time mobs for now I know how to make timer I think that would remove player from arena but I need to know how to spawn monsters after someone kill it all the time until time is over

duno smth like disable wave counter for spawn only 1st wave dont really know how does it works its verry complicated script ;<
 
Last edited:
I dont know how but Im trying to make infinite waves or just unpack first position in wave for 10 minutes and then make arena reset
Is there any easy way to cheat functions ?
I want that script think he should spawn all the time mobs for now I know how to make timer I think that would remove player from arena but I need to know how to spawn monsters after someone kill it all the time until time is over

duno smth like disable wave counter for spawn only 1st wave dont really know how does it works its verry complicated script ;<
no it is not complicated, is really easy to understand
 
I dont know how but Im trying to make infinite waves or just unpack first position in wave for 10 minutes and then make arena reset
Is there any easy way to cheat functions ?
I want that script think he should spawn all the time mobs for now I know how to make timer I think that would remove player from arena but I need to know how to spawn monsters after someone kill it all the time until time is over

duno smth like disable wave counter for spawn only 1st wave dont really know how does it works its verry complicated script ;<
As i've said before, you don't have to cheat anything you will get the wave clear callback and set the arena currentwave back to 0 (because the callback is called before the increment of the wave so it will go back to 1)

Code:
function waveClear(player, waveid, arena)
    arena.currentwave = 0
    return true
end

@Aeronx Make sure there is no creature from outside the arena inside the radius.
You can also force the check even if no creature is killed inside the arena using the think callback with the function Arena:monsterDeath(). (you have to make sure no events of wavespawn is set so the easiest way to have this is to have an interval on the think function bigger than the wavespawn delay.)

(If you set a bigger radius for the arena it will search for monsters outside the arena and if there is monsters in this area it wont spawn anything.)

@Thread Updated callbacks that were called with the currentwave and it would change between calls for each players, now the waveid in the call will be the same for every call even if you change the wave id.
 
Last edited:
I made a square 8x8 and radius is 8. Nothing outside that square! tested many ways diferent radius and sometimes still get bugged and the next wave nevers comes, so people get stuck inside.
 
I made a square 8x8 and radius is 8. Nothing outside that square! tested many ways diferent radius and sometimes still get bugged and the next wave nevers comes, so people get stuck inside.
The radius is not 8 in a 8x8 square.

Radius is the distance from the center to the side, so you arena has to have an odd number of sqms of side:

3x3 = 1 radius (like in the demo video)
5x5 = 2 radius
7x7 = 3 radius
9x9 = 4 radius
...etc

So you have to change your arena or atleast use the closest radius (4) and make sure the positions outside are not walkable for monsters.
 
The radius is not 8 in a 8x8 square.

Radius is the distance from the center to the side, so you arena has to have an odd number of sqms of side:

3x3 = 1 radius (like in the demo video)
5x5 = 2 radius
7x7 = 3 radius
9x9 = 4 radius
...etc

So you have to change your arena or atleast use the closest radius (4) and make sure the positions outside are not walkable for monsters.
so whats the diameter?
 
Actually the square its 15x15, radious should be 7. xD damn.. im so retarded.. that could be the error?
 
This script is pretty awesome! I just added it in and it works near flawlessly, the only problem I'm having is with the Storage not preventing players from doing it twice... here's what I'm working with, any help or ideas would be awesome
Code:
local waves = {
    [1] = Wave({
            ["demon skeleton"] = 3,
        }),
    [2] = Wave({
            ["Dragon"] = 1,
        }),
    [3] = Wave({
            ["Dragon lord"] = 1,
        }),
}

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

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

function checkPlayer(player)
    if player:getStorageValue(2000) <= 0 then
        return true
    else
        return true
    end
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("MUAHAHAHA", 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(-50)
        end
    end
end

local arena = Arena("Hell", Position(32395, 32194, 7), Position(32400, 32203, 7), 6, Position(32400, 32203, 7))
arena:addPlayerPosition(Position(32399, 32202, 7), 50)
arena:addWaves(unpack(waves))
--arena:setJokerCreature("bug")
arena:setDelayWaves(5000)
arena:setDelayEnd(5000)
arena:setRewardCallback(rewardPlayers)
arena:setCheckCallback(checkPlayer)
arena:setSpawnCallback(spawnBroadcast)
arena:setWaveclearCallback(waveClear)
--arena:setJokerdeathCallback(jokerDeath)
--Arena:setCheckCallback(player)
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
Using TFS 1.2
 
This script is pretty awesome! I just added it in and it works near flawlessly, the only problem I'm having is with the Storage not preventing players from doing it twice... here's what I'm working with, any help or ideas would be awesome
Code:
local waves = {
    [1] = Wave({
            ["demon skeleton"] = 3,
        }),
    [2] = Wave({
            ["Dragon"] = 1,
        }),
    [3] = Wave({
            ["Dragon lord"] = 1,
        }),
}

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

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

function checkPlayer(player)
    if player:getStorageValue(2000) <= 0 then
        return true
    else
        return true
    end
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("MUAHAHAHA", 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(-50)
        end
    end
end

local arena = Arena("Hell", Position(32395, 32194, 7), Position(32400, 32203, 7), 6, Position(32400, 32203, 7))
arena:addPlayerPosition(Position(32399, 32202, 7), 50)
arena:addWaves(unpack(waves))
--arena:setJokerCreature("bug")
arena:setDelayWaves(5000)
arena:setDelayEnd(5000)
arena:setRewardCallback(rewardPlayers)
arena:setCheckCallback(checkPlayer)
arena:setSpawnCallback(spawnBroadcast)
arena:setWaveclearCallback(waveClear)
--arena:setJokerdeathCallback(jokerDeath)
--Arena:setCheckCallback(player)
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.leveFS 1.2[/QUOTE]
if player:getStorageValue(2000) <= 0 then
return true
else
return false

It was my mistake did this for testing.
 
if player:getStorageValue(2000) <= 0 then
return true
else
return false

It was my mistake did this for testing.


Where to paste this?
Code:
local waves = {
    [1] = Wave({
            ["Rat"] = 1,
        }),
    [2] = Wave({
            ["Cave Rat"] = 2,
        }),
}
local config = {
    levers = {1945, 1946},
}
function rewardPlayers(player, arena)
    player:addItem(2160, 100)
    player:setStorageValue(2101, 1)
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Congratulations, you finished the arena " .. arena.name .. ".")
    return true
end
function checkPlayer(player)
    if player:getStorageValue(2101) <= 0 then
        return true
    else
        return false
    end
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("MUAHAHAHA", 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(-50)
        end
    end
end
local arena = Arena("Hell", Position(146, 432, 7), Position(149, 432, 7), 1, Position(146, 427, 7))
arena:addPlayerPosition(Position(150, 438, 7))
arena:addWaves(unpack(waves))
arena:setJokerCreature("Bug")
arena:setDelayWaves(5000)
arena:setRewardCallback(rewardPlayers)
arena:setCheckCallback(checkPlayer)
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

Should I paste it into actions or creaturescripts\lib? how to make it work with leaver with no using action?
 
Where to paste this?
Code:
local waves = {
    [1] = Wave({
            ["Rat"] = 1,
        }),
    [2] = Wave({
            ["Cave Rat"] = 2,
        }),
}
local config = {
    levers = {1945, 1946},
}
function rewardPlayers(player, arena)
    player:addItem(2160, 100)
    player:setStorageValue(2101, 1)
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Congratulations, you finished the arena " .. arena.name .. ".")
    return true
end
function checkPlayer(player)
    if player:getStorageValue(2101) <= 0 then
        return true
    else
        return false
    end
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("MUAHAHAHA", 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(-50)
        end
    end
end
local arena = Arena("Hell", Position(146, 432, 7), Position(149, 432, 7), 1, Position(146, 427, 7))
arena:addPlayerPosition(Position(150, 438, 7))
arena:addWaves(unpack(waves))
arena:setJokerCreature("Bug")
arena:setDelayWaves(5000)
arena:setRewardCallback(rewardPlayers)
arena:setCheckCallback(checkPlayer)
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

Should I paste it into actions or creaturescripts\lib? how to make it work with leaver with no using action?
Read the functions definition and you will see:

Arena:useLever(player)

Use this to start the arena, it will start and return true if it meets the requirements otherwise it will return false (Its useLever but you can use for talkaction or whatever you want)

I know it is a bad name, I was going to rename it to Arena:start(player) but I never did.
 
Ok, I used this script with actions folder and add id line to lever in actions.xml, I have the lib and creaturescripts that u send in first post, lever dont working, no bug in console, probarly Im doing somethink wrong with placing files correctly, can u tell me where to put this
Code:
local waves = {
    [1] = Wave({
            ["Rat"] = 1,
        }),
    [2] = Wave({
            ["Cave Rat"] = 2,
        }),
}
local config = {
    levers = {1945, 1946},
}
function rewardPlayers(player, arena)
    player:addItem(2160, 100)
    player:setStorageValue(2101, 1)
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Congratulations, you finished the arena " .. arena.name .. ".")
    return true
end
function checkPlayer(player)
    if player:getStorageValue(2101) <= 0 then
        return true
    else
        return false
    end
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("MUAHAHAHA", 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(-50)
        end
    end
end
local arena = Arena("Hell", Position(146, 432, 7), Position(149, 432, 7), 1, Position(146, 427, 7))
arena:addPlayerPosition(Position(150, 438, 7))
arena:addWaves(unpack(waves))
arena:setJokerCreature("Bug")
arena:setDelayWaves(5000)
arena:setRewardCallback(rewardPlayers)
arena:setCheckCallback(checkPlayer)
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
?

I try to create it in data\actions\scripts and add actions.xml line
Code:
<action actionid="1841" script="arena.lua"/>
so lever can work but nothing happens.
 
Ok, I used this script with actions folder and add id line to lever in actions.xml, I have the lib and creaturescripts that u send in first post, lever dont working, no bug in console, probarly Im doing somethink wrong with placing files correctly, can u tell me where to put this
Code:
local waves = {
    [1] = Wave({
            ["Rat"] = 1,
        }),
    [2] = Wave({
            ["Cave Rat"] = 2,
        }),
}
local config = {
    levers = {1945, 1946},
}
function rewardPlayers(player, arena)
    player:addItem(2160, 100)
    player:setStorageValue(2101, 1)
    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Congratulations, you finished the arena " .. arena.name .. ".")
    return true
end
function checkPlayer(player)
    if player:getStorageValue(2101) <= 0 then
        return true
    else
        return false
    end
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("MUAHAHAHA", 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(-50)
        end
    end
end
local arena = Arena("Hell", Position(146, 432, 7), Position(149, 432, 7), 1, Position(146, 427, 7))
arena:addPlayerPosition(Position(150, 438, 7))
arena:addWaves(unpack(waves))
arena:setJokerCreature("Bug")
arena:setDelayWaves(5000)
arena:setRewardCallback(rewardPlayers)
arena:setCheckCallback(checkPlayer)
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
?

I try to create it in data\actions\scripts and add actions.xml line
Code:
<action actionid="1841" script="arena.lua"/>
so lever can work but nothing happens.

Just need to choice lever with id 1841 to work with that script. how to make it?
 
@Mkalo
How to configure it?
local arena = Arena("Hell", Position(146, 432, 7), Position(149, 432, 7), 1, Position(146, 427, 7))

and what is the number 1 marked with red color?

I put these positions:
sVCodHy.jpg
 
@Mkalo
How to configure it?
local arena = Arena("Hell", Position(146, 432, 7), Position(149, 432, 7), 1, Position(146, 427, 7))

and what is the number 1 marked with red color?

I put these positions:
sVCodHy.jpg
It is all documented:

Arena(name, position/center, exitposition, radius[, rewardposition]):

This should be used outside the action script!!! DO NOT USE IT INSIDE ONUSE FFS.
Exitposition is only used in case someone is inside and the arena is not started (like from some crash or something).
You can have a normal teleport inside the arena to leave it, it wont bug the arena and it will reset if no player is inside it (Make sure players cant logout inside there)

This function will return the object that you will use to set all the other options.

Your "positions" are not what they are supposed to be. I don't use corner positions only center and radius. the number 1 is the radius in sqm.
 
It is all documented:

Arena(name, position/center, exitposition, radius[, rewardposition]):

This should be used outside the action script!!! DO NOT USE IT INSIDE ONUSE FFS.
Exitposition is only used in case someone is inside and the arena is not started (like from some crash or something).
You can have a normal teleport inside the arena to leave it, it wont bug the arena and it will reset if no player is inside it (Make sure players cant logout inside there)

This function will return the object that you will use to set all the other options.

Your "positions" are not what they are supposed to be. I don't use corner positions only center and radius. the number 1 is the radius in sqm.

thanks!!
hey if some player stay afk there, no have kick function ? :p
 
Back
Top