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

*NEW* Zombie Event [TFS 1.x]

No works on TFS 1.2, no spawn zombies, no show errors on console.

Make sure you setup this correct:
XML:
    <!-- Zombie Event -->
    <monster name="Zombie Event" file="Zombie Event.xml"/>

I missed the monster name.. so the zombies didnt spawn, but changing it to Zombie Event fixed it.
 
I did a globalevents. enjoy.
Code:
<globalevent name="Zombie Arena"  time="8:18:30" script="zombie_arena.lua" />
Code:
function onTime(interval, lastExecution)
    local minPlayers = 3 --
    local maxPlayers = 3 --
    local waitTime = 1 --
    
    local playersOnline = #getOnlinePlayers()

    if playersOnline >= maxPlayers then
        Game.broadcastMessage("Zombie Event it's coming...", MESSAGE_STATUS_WARNING)
        print('...Game.broadcastMessage("Zombie Event Starting...", MESSAGE_STATUS_WARNING)...')
        -- Set the new variables and setup the event
        setupZombieEvent(minPlayers, maxPlayers, waitTime)
    else
      Game.broadcastMessage("[Zombie Event]: Insufficient online players to open the event", MESSAGE_STATUS_WARNING)
      print('[Zombie Event]: Insufficient online players to open the event')
    end
    
    return false
end
 
Lua:
cannot open data/zombieEvent.lua: No such file or directory
stack traceback:
        [C]: at 0x7ff78998bd50
        [C]: in function 'dofile'
        data/global.lua:3: in main chunk
[Warning - ScriptingManager::loadScriptSystems] Can not load data/global.lua
>> Loading lua libs

Lua Script Error: [Scripts Interface]
C:\Users\jpole\Desktop\otx\data\scripts/lib\create_functions.lua
data/lib/core/tables.lua:17: bad argument #1 to 'pairs' (table expected, got string)
stack traceback:
        [C]: at 0x7ff78998bd50
        [C]: in function 'pairs'
        data/lib/core/tables.lua:17: in function 'contains'
        data/lib/compat/compat.lua:1286: in function 'createFunctions'
        ...\jpole\Desktop\otx\data\scripts/lib\create_functions.lua:1: in main chunk
> create_functions.lua [error]
^
>> Loading lua scripts

Lua Script Error: [Scripts Interface]
C:\Users\jpole\Desktop\otx\data\scripts\actions\door\custom_door.lua
data/lib/core/tables.lua:17: bad argument #1 to 'pairs' (table expected, got number)
stack traceback:
        [C]: at 0x7ff78998bd50
        [C]: in function 'pairs'
        data/lib/core/tables.lua:17: in function 'contains'
        ...le\Desktop\otx\data\scripts\actions\door\custom_door.lua:6: in main chunk
> custom_door.lua [error]
^

Lua Script Error: [Scripts Interface]
C:\Users\jpole\Desktop\otx\data\scripts\actions\door\key_door.lua
data/lib/core/tables.lua:17: bad argument #1 to 'pairs' (table expected, got number)
stack traceback:
        [C]: at 0x7ff78998bd50
        [C]: in function 'pairs'
        data/lib/core/tables.lua:17: in function 'contains'
        ...jpole\Desktop\otx\data\scripts\actions\door\key_door.lua:6: in main chunk
> key_door.lua [error]
^

Lua Script Error: [Scripts Interface]
C:\Users\jpole\Desktop\otx\data\scripts\actions\door\level_door.lua
data/lib/core/tables.lua:17: bad argument #1 to 'pairs' (table expected, got number)
stack traceback:
        [C]: at 0x7ff78998bd50
        [C]: in function 'pairs'
        data/lib/core/tables.lua:17: in function 'contains'
        ...ole\Desktop\otx\data\scripts\actions\door\level_door.lua:6: in main chunk
> level_door.lua [error]
^

Lua Script Error: [Scripts Interface]
C:\Users\jpole\Desktop\otx\data\scripts\actions\door\quest_door.lua
data/lib/core/tables.lua:17: bad argument #1 to 'pairs' (table expected, got number)
stack traceback:
        [C]: at 0x7ff78998bd50
        [C]: in function 'pairs'
        data/lib/core/tables.lua:17: in function 'contains'
        ...ole\Desktop\otx\data\scripts\actions\door\quest_door.lua:6: in main chunk
> quest_door.lua [error]
^

Lua Script Error: [Scripts Interface]
C:\Users\jpole\Desktop\otx\data\scripts\movements\closing_door.lua
data/lib/core/tables.lua:17: bad argument #1 to 'pairs' (table expected, got number)
stack traceback:
        [C]: at 0x7ff78998bd50
        [C]: in function 'pairs'
        data/lib/core/tables.lua:17: in function 'contains'
        ...pole\Desktop\otx\data\scripts\movements\closing_door.lua:7: in main chunk
> closing_door.lua [error]

Is not work on OTX 4
 
Hey, lobby works, arena works, but monsters don't appear

Code:
 in a timer event called from: (Unknown scriptfile) data/zombieEvent.lua:113: bad argument #2 to 'random' (interval is empty) in a timer event called from: (Unknown scriptfile) data/zombieEvent.lua:113: bad argument #2 to 'random' (interval is empty)
tfs 1.2 8.6 tibia
 
Hey, lobby works, arena works, but monsters don't appear

Code:
 in a timer event called from: (Unknown scriptfile) data/zombieEvent.lua:113: bad argument #2 to 'random' (interval is empty) in a timer event called from: (Unknown scriptfile) data/zombieEvent.lua:113: bad argument #2 to 'random' (interval is empty)
tfs 1.2 8.6 tibia
It is a magical effect that it sends out when you create a zombie, and it not compatible with 8.6. I solved this and send you later.
 
Lua:
[Error - Creatureevent::configure event] Invalid type for creature event : tp_pad

[warning - base events::load from xml] failed to configure event.
TFS 1.3 Downgraded to 8.6
 
It is a magical effect that it sends out when you create a zombie, and it not compatible with 8.6. I solved this and send you later.
can you please share you solution? i didn't get error, zombies are not summoning. thank you!
TFS 1.3 ~ downgraded to 8.6
 
can you please share you solution? i didn't get error, zombies are not summoning. thank you!
TFS 1.3 ~ downgraded to 8.6

try with
Lua:
-- Store player kills
if zombieKillCount == nil then
    zombieKillCount = {}
end
 
-- Zombie Variables
ze_zombieName = "Zombie Event" -- Zombie name
ze_timeToStartInvasion = 30 -- When should the first zombie be summoned [seconds]
ze_zombieSpawnInerval = 5 -- The interval of each zombie that will get summoned
ze_zombieMaxSpawn = 20 -- Max zombies in the arena
ze_zombieCountGlobalStorage = 2349 -- Use empty global storage
 
-- Player Variables
ze_joinStorage = 2350 -- Storage that will be added, when player join
ze_minPlayers = 1 -- Minimum players that have to join
ze_maxPlayers = 50 -- Maxnimum players that can join
ze_joinCountGlobalStorage = 2352 -- Use empty global storage
 
-- States
ze_stateGlobalStorage = 2353 -- Use empty global storage
ze_EVENT_CLOSED = 0
ze_EVENT_STATE_STARTUP = 1
ze_EVENT_STARTED = 2
 
-- Waiting room
ze_WaitingRoomStartPosition = Position(641, 1830, 7) -- Where should player be teleport in waiting room
ze_waitingRoomCenterPosition = Position(641, 1830, 7) -- Center of the waiting room
ze_waitingRoomRadiusX = 5 -- Depends how big the arena room is 25sqm to x
ze_waitingRoomRadiusY = 5 -- Depends how big the arena room is 25sqm to y
 
-- Zombie arena
ze_zombieArenaStartPosition = Position(619, 1965, 7) -- When even start where should player be teleported in the zombie arena?
ze_arenaCenterPosition = Position(619, 1965, 7) -- Center position of the arena
ze_arenaFromPosition = Position(598, 1954, 7) -- Pos of top left corner
ze_arenaToPosition = Position(641, 1978, 7) -- Pos of bottom right corner
ze_arenaRoomRadiusX = 20 -- Depends how big the arena room is 50sqm to x
ze_arenaRoomRadiusY = 11 -- Depends how big the arena room is 50sqm to y
ze_arenaRoomMultifloor = false -- Does the arena have more floors than one?
 
-- Other variables
ze_waitTime = 5 -- How long until the event begin?
ze_createTeleportPosition = Position(977, 999, 7) -- Where should the teleport be created?
ze_teleportActionId = 7000 -- Actionid of the teleport
ze_trophiesTable = {
    [1] = {itemid = 7369, description = "won first place on Zombie Event."},
    [2] = {itemid = 7370, description = "won second place on Zombie Event."},
    [3] = {itemid = 7371, description = "won third place on Zombie Event."}
}
 
-- Get methods
function getZombieEventZombieCount()
    return Game.getStorageValue(ze_zombieCountGlobalStorage)
end
 
function getZombieEventJoinedCount()
    return Game.getStorageValue(ze_joinCountGlobalStorage)
end
 
function setZombieEventState(value)
    Game.setStorageValue(ze_stateGlobalStorage, value)
end
 
function getZombieEventState()
    return Game.getStorageValue(ze_stateGlobalStorage) or ze_EVENT_CLOSED
end
 
function resetZombieEvent()
    -- Reset variables
    Game.setStorageValue(ze_zombieCountGlobalStorage, 0)
    Game.setStorageValue(ze_joinCountGlobalStorage, 0)
    setZombieEventState(ze_EVENT_CLOSED)
 
    -- Clear the arena from zombies
    local spectator = Game.getSpectators(ze_arenaCenterPosition, ze_arenaRoomMultifloor, false, 0, ze_arenaRoomRadiusX, 0, ze_arenaRoomRadiusY)
    for i = 1, #spectator do
        if spectator[i]:isMonster() then
            spectator[i]:remove()
        end
    end
end

function resetPlayersEvent()
    local count = getZombieEventJoinedCount()
    Game.setStorageValue(ze_joinCountGlobalStorage, count - 1)
    print('storages reseteados')
    end
 
function startZombieEvent()
    local spectator = Game.getSpectators(ze_waitingRoomCenterPosition, ze_arenaRoomMultifloor, false, 0, ze_waitingRoomRadiusX, 0, ze_waitingRoomRadiusY)
    if getZombieEventJoinedCount() < ze_minPlayers then
        for i = 1, #spectator do
            spectator[i]:teleportTo(spectator[i]:getTown():getTemplePosition())
            spectator[i]:setStorageValue(ze_joinStorage, 0)
        end
 
        resetZombieEvent()
        Game.broadcastMessage("Zombie event failed to start, due to not enough of participants.")
    else
        for i = 1, #spectator do
            spectator[i]:teleportTo(ze_zombieArenaStartPosition)
            spectator[i]:registerEvent("ZombiePlayerDeath")
        end
 
        Game.broadcastMessage("Zombie Event has started, good luck to all participants.")
        setZombieEventState(ze_EVENT_STARTED)
        addEvent(startZombieInvasion, ze_timeToStartInvasion * 1000)
    end
 
    -- Remove Teleport
    local item = Tile(ze_createTeleportPosition):getItemById(1387)
    if item:isTeleport() then
        item:remove()
    end
end
 
function startZombieInvasion()
    if getZombieEventState() == ze_EVENT_STARTED then
        local random = math.random
        local zombie = Game.createMonster(ze_zombieName, Position(random(ze_arenaFromPosition.x, ze_arenaToPosition.x), random(ze_arenaFromPosition.y, ze_arenaToPosition.y), random(ze_arenaFromPosition.z, ze_arenaToPosition.z)))
        if zombie then
            Game.setStorageValue(ze_zombieCountGlobalStorage, getZombieEventZombieCount() + 1)
        end
 
        addEvent(startZombieInvasion, ze_zombieSpawnInerval * 1000)
    end
end
 
function Player.joinZombieEvent(self)
    -- Set storage and teleport
    self:teleportTo(ze_WaitingRoomStartPosition)
    ze_WaitingRoomStartPosition:sendMagicEffect(CONST_ME_TELEPORT)
    self:setStorageValue(ze_joinStorage, 1)
 
    -- Add count and broadcast
    local count = getZombieEventJoinedCount()
    Game.setStorageValue(ze_joinCountGlobalStorage, count + 1)
    Game.broadcastMessage(string.format("%s has joined the Zombie Event! [%d/%d].", self:getName(), count + 1, ze_maxPlayers))
end
 
function setupZombieEvent(minPlayers, maxPlayers, waitTime)
    -- Event is not closed, then stop from start new one
    if getZombieEventState() ~= ze_EVENT_CLOSED then
        return
    end
 
    -- Create teleport and set the respective action id
    local item = Game.createItem(1387, 1, ze_createTeleportPosition)
    if item:isTeleport() then
        item:setAttribute(ITEM_ATTRIBUTE_ACTIONID, ze_teleportActionId)
    end
 
    -- Change the variables, to the new ones
    ze_minPlayers = minPlayers
    ze_maxPlayers = maxPlayers
    ze_waitTime = waitTime
 
    -- Set the counts, state, broadcast and delay the start of the event.
    Game.setStorageValue(ze_zombieCountGlobalStorage, 0)
    Game.setStorageValue(ze_joinCountGlobalStorage, 0)
    setZombieEventState(ze_EVENT_STATE_STARTUP)
    Game.broadcastMessage(string.format("The Zombie Event has started! The event require atleast %d and max %d players, you have %d minutes to join.", minPlayers, maxPlayers, waitTime))
    addEvent(startZombieEvent, waitTime * 60 * 1000)
end
 
try with
Lua:
-- Store player kills
if zombieKillCount == nil then
    zombieKillCount = {}
end

-- Zombie Variables
ze_zombieName = "Zombie Event" -- Zombie name
ze_timeToStartInvasion = 30 -- When should the first zombie be summoned [seconds]
ze_zombieSpawnInerval = 5 -- The interval of each zombie that will get summoned
ze_zombieMaxSpawn = 20 -- Max zombies in the arena
ze_zombieCountGlobalStorage = 2349 -- Use empty global storage

-- Player Variables
ze_joinStorage = 2350 -- Storage that will be added, when player join
ze_minPlayers = 1 -- Minimum players that have to join
ze_maxPlayers = 50 -- Maxnimum players that can join
ze_joinCountGlobalStorage = 2352 -- Use empty global storage

-- States
ze_stateGlobalStorage = 2353 -- Use empty global storage
ze_EVENT_CLOSED = 0
ze_EVENT_STATE_STARTUP = 1
ze_EVENT_STARTED = 2

-- Waiting room
ze_WaitingRoomStartPosition = Position(641, 1830, 7) -- Where should player be teleport in waiting room
ze_waitingRoomCenterPosition = Position(641, 1830, 7) -- Center of the waiting room
ze_waitingRoomRadiusX = 5 -- Depends how big the arena room is 25sqm to x
ze_waitingRoomRadiusY = 5 -- Depends how big the arena room is 25sqm to y

-- Zombie arena
ze_zombieArenaStartPosition = Position(619, 1965, 7) -- When even start where should player be teleported in the zombie arena?
ze_arenaCenterPosition = Position(619, 1965, 7) -- Center position of the arena
ze_arenaFromPosition = Position(598, 1954, 7) -- Pos of top left corner
ze_arenaToPosition = Position(641, 1978, 7) -- Pos of bottom right corner
ze_arenaRoomRadiusX = 20 -- Depends how big the arena room is 50sqm to x
ze_arenaRoomRadiusY = 11 -- Depends how big the arena room is 50sqm to y
ze_arenaRoomMultifloor = false -- Does the arena have more floors than one?

-- Other variables
ze_waitTime = 5 -- How long until the event begin?
ze_createTeleportPosition = Position(977, 999, 7) -- Where should the teleport be created?
ze_teleportActionId = 7000 -- Actionid of the teleport
ze_trophiesTable = {
    [1] = {itemid = 7369, description = "won first place on Zombie Event."},
    [2] = {itemid = 7370, description = "won second place on Zombie Event."},
    [3] = {itemid = 7371, description = "won third place on Zombie Event."}
}

-- Get methods
function getZombieEventZombieCount()
    return Game.getStorageValue(ze_zombieCountGlobalStorage)
end

function getZombieEventJoinedCount()
    return Game.getStorageValue(ze_joinCountGlobalStorage)
end

function setZombieEventState(value)
    Game.setStorageValue(ze_stateGlobalStorage, value)
end

function getZombieEventState()
    return Game.getStorageValue(ze_stateGlobalStorage) or ze_EVENT_CLOSED
end

function resetZombieEvent()
    -- Reset variables
    Game.setStorageValue(ze_zombieCountGlobalStorage, 0)
    Game.setStorageValue(ze_joinCountGlobalStorage, 0)
    setZombieEventState(ze_EVENT_CLOSED)

    -- Clear the arena from zombies
    local spectator = Game.getSpectators(ze_arenaCenterPosition, ze_arenaRoomMultifloor, false, 0, ze_arenaRoomRadiusX, 0, ze_arenaRoomRadiusY)
    for i = 1, #spectator do
        if spectator[i]:isMonster() then
            spectator[i]:remove()
        end
    end
end

function resetPlayersEvent()
    local count = getZombieEventJoinedCount()
    Game.setStorageValue(ze_joinCountGlobalStorage, count - 1)
    print('storages reseteados')
    end

function startZombieEvent()
    local spectator = Game.getSpectators(ze_waitingRoomCenterPosition, ze_arenaRoomMultifloor, false, 0, ze_waitingRoomRadiusX, 0, ze_waitingRoomRadiusY)
    if getZombieEventJoinedCount() < ze_minPlayers then
        for i = 1, #spectator do
            spectator[i]:teleportTo(spectator[i]:getTown():getTemplePosition())
            spectator[i]:setStorageValue(ze_joinStorage, 0)
        end

        resetZombieEvent()
        Game.broadcastMessage("Zombie event failed to start, due to not enough of participants.")
    else
        for i = 1, #spectator do
            spectator[i]:teleportTo(ze_zombieArenaStartPosition)
            spectator[i]:registerEvent("ZombiePlayerDeath")
        end

        Game.broadcastMessage("Zombie Event has started, good luck to all participants.")
        setZombieEventState(ze_EVENT_STARTED)
        addEvent(startZombieInvasion, ze_timeToStartInvasion * 1000)
    end

    -- Remove Teleport
    local item = Tile(ze_createTeleportPosition):getItemById(1387)
    if item:isTeleport() then
        item:remove()
    end
end

function startZombieInvasion()
    if getZombieEventState() == ze_EVENT_STARTED then
        local random = math.random
        local zombie = Game.createMonster(ze_zombieName, Position(random(ze_arenaFromPosition.x, ze_arenaToPosition.x), random(ze_arenaFromPosition.y, ze_arenaToPosition.y), random(ze_arenaFromPosition.z, ze_arenaToPosition.z)))
        if zombie then
            Game.setStorageValue(ze_zombieCountGlobalStorage, getZombieEventZombieCount() + 1)
        end

        addEvent(startZombieInvasion, ze_zombieSpawnInerval * 1000)
    end
end

function Player.joinZombieEvent(self)
    -- Set storage and teleport
    self:teleportTo(ze_WaitingRoomStartPosition)
    ze_WaitingRoomStartPosition:sendMagicEffect(CONST_ME_TELEPORT)
    self:setStorageValue(ze_joinStorage, 1)

    -- Add count and broadcast
    local count = getZombieEventJoinedCount()
    Game.setStorageValue(ze_joinCountGlobalStorage, count + 1)
    Game.broadcastMessage(string.format("%s has joined the Zombie Event! [%d/%d].", self:getName(), count + 1, ze_maxPlayers))
end

function setupZombieEvent(minPlayers, maxPlayers, waitTime)
    -- Event is not closed, then stop from start new one
    if getZombieEventState() ~= ze_EVENT_CLOSED then
        return
    end

    -- Create teleport and set the respective action id
    local item = Game.createItem(1387, 1, ze_createTeleportPosition)
    if item:isTeleport() then
        item:setAttribute(ITEM_ATTRIBUTE_ACTIONID, ze_teleportActionId)
    end

    -- Change the variables, to the new ones
    ze_minPlayers = minPlayers
    ze_maxPlayers = maxPlayers
    ze_waitTime = waitTime

    -- Set the counts, state, broadcast and delay the start of the event.
    Game.setStorageValue(ze_zombieCountGlobalStorage, 0)
    Game.setStorageValue(ze_joinCountGlobalStorage, 0)
    setZombieEventState(ze_EVENT_STATE_STARTUP)
    Game.broadcastMessage(string.format("The Zombie Event has started! The event require atleast %d and max %d players, you have %d minutes to join.", minPlayers, maxPlayers, waitTime))
    addEvent(startZombieEvent, waitTime * 60 * 1000)
end
Still not working sir, no errors and no monster spawning. thank you for your fast reply.
Problem has been fixed, there were two mistakes first one naming
my file name was Zombie Event.xml, but monster Name inside was "Zombie"
so i changed <monster name="Zombie" file="Zombie Event.xml"/> to <monster name="Zombie Event" file="Zombie Event.xml"/>
second error was my fire event creaturescript was not letting me die, so i had to remove it for further fixes.
 
Last edited:
How to configure IT???

I make a test map, with resting area and map area..... When i say !zombie start.... broadcast message dont go but after i say !zombie begin.... chacters are teleported to resting area.... but teleport don't to apear to start event, if enter with gamemaster and push players, zombies don't summoned

But no erros on console
 
Nice, work!
can someone help me!
I would like every player to have the same speed, regardless of whether he will wear / download boots of haste and used spell utani gran hur or utani hur.
speed and block spell ?
 
Back
Top