• 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

anyone wanna help add gold cost on use?

Code:
function checkPlayer(player)
    if player:getStorageValue(2101) <= 0 then
        return true
    else
         player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "You already completed Greenhorn Arena")
        return false
    end
end
 
This is supposed to suit any idea you have of arena, you just have to use it correctly.

Lib: http://pastebin.com/tnkwCDCa Updated (17/04/2016)
Old: CreatureArena = {}PLAYER_LASTARENA = {}Arena = {}setmetatable(Arena, {__ - Pastebin.com (http://pastebin.com/R4s96bwZ)

Creaturescripts: (Both death events)
Code:
  <event type="death" name="ArenaEvent" script="arenaevent.lua"/>
   <event type="death" name="JokerDeath" script="jokerdeath.lua"/>

arenaevent.lua: function onDeath(creature, corpse, killer, mostDamageKiller, unjustified, mostDa - Pastebin.com (http://pastebin.com/4xkEiqvG)
jokerdeath.lua: function onDeath(creature, corpse, killer, mostDamageKiller, unjustified, mostDa - Pastebin.com (http://pastebin.com/c1K37RCG)

Now I will explain every single option you have to use this lib. You can use the same lib to do any number of arenas. (You can't use the same space for different arenas.). Parameters between [] are optional.
Starting:

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.

Arena:addPlayerPosition(position[, level[, vocation]])
This will add a position to the arena, the player then must be in this position. You must add atleast 1 for the arena to work (ofcourse). With this you can set individual vocations/level something like desert quest and anihi together.

Arena:addWaves(wave, ...)
This is used to add the waves to your arena. Wave is the wave object and I will explain it later on. You can add multiple waves at once.

You SHOULD add atleast one please. Otherwise the player will teleport straight to the reward.

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)

-------------------------
From now on all these functions are optional you can choose to use them or not.

Arena:setJokerCreature(name)
Sets a "joker" creature to your arena (players will have to kill it before every wave to start it.)

Arena:setDelayWaves(delay)
Delay in miliseconds before spawning the next wave after killing all monsters (default is 1000).

Arena:setDelayEnd(delay) NEW
Time to end after the last wave was killed. (Added because before it was instant and the player couldn't loot the monsters.) Default is 2000.


Callbacks (also optionals), they are going to be called for each player inside the arena.

Arena:setRewardCallback(callback)
This will set the callback function to be called once the players finish the arena. It will be called with parameters: (player, arena)

Arena:setCheckCallback(callback)

This is the only callback where the return value matters. It will be called once the player uses the lever and the arena will only start if all the calls return true for every player. (This could be used to check some storage to prevent players from doing 2 times or anything else use your imagination) and the parameter is: (player)

Arena:setSpawnCallback(callback)

This callback function will be called at every spawn (the moment the wave actually spawns) with the parameters: (player, waveid, arena)

Arena:setWaveclearCallback(callback)

This callback function will be called at every wave clear, with parameters: (player, waveid, arena)

Arena:setJokerdeathCallback(callback)

This callback function will be called every time the joker dies, with parameters: (player, waveid, arena) (ONLY IF YOU'RE USING A JOKER OFCOURSE)

NEW

Arena:setStartCallback(callback)
This callback function will be called when the arena starts, with parameters: (player, arena)

Arena:setThinkCallback(callback[, interval = 2000])

This callback will be called whenever the arena is active with default interval 2000. (You should never reload the lib arena if any arena is active using this).
You should aswell reset the arena inside the callback if there is no player inside (Preventing it to call think function with no players inside)


Player:getLastArena()
Returns the last arena object that the player was in. (It will reset if you reload)

Player:isInsideArena(arena)
Self explanatory, true if inside, false if not.


Now the wave constructor function:
Look in the code in the second post its pretty straightforward.

Continues in the next post.
Ca add more players like 3-4-5?
 
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 ...
 
Back
Top