• 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+ Arena monster hooks?

QuickLearner

New Member
Joined
Mar 20, 2018
Messages
21
Reaction score
2
Hi, I need some ideas how to approach monster in the arena.

I have three same arenas to not block players.
So if one player enter arena he is teleported to one arena and globalStorage is set to 1. If another players wants to also enter arena he is teleported to the same looking arena but with different globalStorage value.

I am spawning monsters on enter the arena.
But now I want to somehow get a hook on the monsters so when player kill arena monster I can update player storage so it will say that you killed 1/6 arena monsters. When player leave the arena the monster ( only for the players arena, not all monsters from all arenas ) must dissapear.

I can not find the good approach to get the hook on the monsters for arena.
I tried to do something like that :

LUA:
local function initMonsters(monsterName, positions)   
        for _, pos in pairs(positions) do       
             local monster = Game.createMonster(monsterName, pos)
             if monster then
                    monster:setStorageValue(9999, 1)
             end
    end
end

But it doesnt work.

The only thing that came to my mind that may have chance to work is to name the monsters different
ArenaMonster One
ArenaMonster Two
ArenaMonster Three

But that is stupid.

I just need to have the chance to somehow count killed monster and destroy monsters if player dies or leaves arena but I cannot find the good way to get a "hook" on the monsters.

Can somebody help me with this?
 
Store the monster's UID in the cache and simply check if a monster with that UID exists. If it does, do whatever you want.

monsterCache = {}

monsterCache[monster:getId()] = true

Or
If not monsterCache[arenaId] then
monsterCache[arenaId] = {}
end
monsterCache[arenaId][monster:getId()] = true

Or just index use instead of monsterID as key.

What ever..
 
Back
Top