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

Zombie Event ERROR

Azerty

Active Member
Joined
Apr 15, 2022
Messages
301
Solutions
4
Reaction score
31
Good afternoon, I have a problem with the Zombie event, when the zombie attacks the player, this error occurs on the console.
I use TFS 1.5 downgrade 8.60

zombie event.JPG

ZE_creaturescript.lua
Lua:
--
--
dofile('data/lib/events/ZE_config.lua')

function onPrepareDeath(cid, killer)
    local player = Player(cid)
    local enemy = Monster(killer)

    if enemy:getName() == "Zumbi" then
        if (getGlobalStorageValue(ZE.storage) > 0) then
            if (getGlobalStorageValue(ZE.storage) == 1) then
                player:say("ZUMBI EVENT WIN!", TALKTYPE_MONSTER_SAY)
                setGlobalStorageValue(ZE.storage, 0)
                broadcastMessage("The player "..player:getName().." is the winner of the Zombie Event.", MESSAGE_STATUS_WARNING)
                player:sendTextMessage(MESSAGE_STATUS_WARNING, ZE.reward[3])
                player:addItem(ZE.reward[1], ZE.reward[2])
            else
                enemy:say("DEAD!", TALKTYPE_MONSTER_SAY)
  
            end

            setGlobalStorageValue(ZE.storage, getGlobalStorageValue(ZE.storage) - 1)
        end

        player:teleportTo(player:getTown():getTemplePosition())
        player:unregisterEvent("ZumbiDeath")
        player:setStorageValue(357812, 0)
    end

    return false
end
 
Solution
now no error appears, but the event does not end, the surviving player is not teleported to the temple and does not receive the reward

Lua:
--
--
dofile('data/lib/events/ZE_config.lua')

function onPrepareDeath(cid, killer)
    local player = Player(cid)
    local enemy = Monster(killer)

    if enemy:getName() == "Zumbi" then
        if (Game.getStorageValue(88789) > 0) then
            if (Game.getStorageValue(88789) == 1) then
                player:say("ZUMBI EVENT WIN!", TALKTYPE_MONSTER_SAY)
                Game.setStorageValue(88789, 0)
                broadcastMessage("The player "..player:getName().." is the winner of the Zombie Event.", MESSAGE_STATUS_WARNING)...
Good afternoon, I have a problem with the Zombie event, when the zombie attacks the player, this error occurs on the console.
I use TFS 1.5 downgrade 8.60

View attachment 68719

ZE_creaturescript.lua
Lua:
--
--
dofile('data/lib/events/ZE_config.lua')

function onPrepareDeath(cid, killer)
    local player = Player(cid)
    local enemy = Monster(killer)

    if enemy:getName() == "Zumbi" then
        if (getGlobalStorageValue(ZE.storage) > 0) then
            if (getGlobalStorageValue(ZE.storage) == 1) then
                player:say("ZUMBI EVENT WIN!", TALKTYPE_MONSTER_SAY)
                setGlobalStorageValue(ZE.storage, 0)
                broadcastMessage("The player "..player:getName().." is the winner of the Zombie Event.", MESSAGE_STATUS_WARNING)
                player:sendTextMessage(MESSAGE_STATUS_WARNING, ZE.reward[3])
                player:addItem(ZE.reward[1], ZE.reward[2])
            else
                enemy:say("DEAD!", TALKTYPE_MONSTER_SAY)
 
            end

            setGlobalStorageValue(ZE.storage, getGlobalStorageValue(ZE.storage) - 1)
        end

        player:teleportTo(player:getTown():getTemplePosition())
        player:unregisterEvent("ZumbiDeath")
        player:setStorageValue(357812, 0)
    end

    return false
end
That ZE.storage exist?, if yes, number or txt?
 
That ZE.storage exist?, if yes, number or txt?
Lua:
ZE = -- Zumbi Event
{
    tpOpen = {x = 32340, y = 32213, z = 7}, -- posição de onde abrirá o teleport para entrar no evento.
    tpTimeOpen = 2, -- tempo que o tp ficará aberto (em minutes).
    posEnterEvent = {x = 31468, y = 32166, z = 7}, -- posição de onde os players irão para dentro do evento.
    reward = {6527, 2, "You won 2 inwar coins."}, -- recompensa: "itemid, quantidade, msg"
    storage = 88789,
}
 
Lua:
ZE = -- Zumbi Event
{
    tpOpen = {x = 32340, y = 32213, z = 7}, -- posição de onde abrirá o teleport para entrar no evento.
    tpTimeOpen = 2, -- tempo que o tp ficará aberto (em minutes).
    posEnterEvent = {x = 31468, y = 32166, z = 7}, -- posição de onde os players irão para dentro do evento.
    reward = {6527, 2, "You won 2 inwar coins."}, -- recompensa: "itemid, quantidade, msg"
    storage = 88789,
}
Try changing ZE.storage in the script for 88789
 
tried with storage like that??

Lua:
--
--
dofile('data/lib/events/ZE_config.lua')

function onPrepareDeath(creature, killer)
    local player = creature:getPlayer()
    local enemy = Monster(killer)

    if enemy:getName() == "Zumbi" then
        if (Game.getStorageValue(88789) > 0) then
            if (Game.getStorageValue(88789) == 1) then
                player:say("ZUMBI EVENT WIN!", TALKTYPE_MONSTER_SAY)
                Game.setStorageValue(88789, 0)
                broadcastMessage("The player "..player:getName().." is the winner of the Zombie Event.", MESSAGE_STATUS_WARNING)
                player:sendTextMessage(MESSAGE_STATUS_WARNING, ZE.reward[3])
                player:addItem(ZE.reward[1], ZE.reward[2])
            else
                enemy:say("DEAD!", TALKTYPE_MONSTER_SAY)
 
            end

            Game.setStorageValue(88789, Game.getStorageValue(88789) - 1)
        end

        player:teleportTo(player:getTown():getTemplePosition())
        player:unregisterEvent("ZumbiDeath")
        player:setStorageValue(357812, 0)
    end

    return false
end

wheres the function that start the event? The one that initiates the event putting the global storage? setting 88789 to value 1
 
tried with storage like that??

Lua:
--
--
dofile('data/lib/events/ZE_config.lua')

function onPrepareDeath(creature, killer)
    local player = creature:getPlayer()
    local enemy = Monster(killer)

    if enemy:getName() == "Zumbi" then
        if (Game.getStorageValue(88789) > 0) then
            if (Game.getStorageValue(88789) == 1) then
                player:say("ZUMBI EVENT WIN!", TALKTYPE_MONSTER_SAY)
                Game.setStorageValue(88789, 0)
                broadcastMessage("The player "..player:getName().." is the winner of the Zombie Event.", MESSAGE_STATUS_WARNING)
                player:sendTextMessage(MESSAGE_STATUS_WARNING, ZE.reward[3])
                player:addItem(ZE.reward[1], ZE.reward[2])
            else
                enemy:say("DEAD!", TALKTYPE_MONSTER_SAY)
 
            end

            Game.setStorageValue(88789, Game.getStorageValue(88789) - 1)
        end

        player:teleportTo(player:getTown():getTemplePosition())
        player:unregisterEvent("ZumbiDeath")
        player:setStorageValue(357812, 0)
    end

    return false
end

wheres the function that start the event? The one that initiates the event putting the global storage? setting 88789 to value 1
Lua:
-- <globalevent name="Zumbi_Event" time="03:46:00" script="ZE_globalevents.lua"/>

dofile('data/lib/events/ZE_config.lua')

zeArenaFromPosition = Position(31433, 32135, 7) --pos of top left corner {x = 32442, y = 32522, z = 7}
zeArenaToPosition = Position(31503, 32200, 7) --pos of bottom right corner {x = 32457, y = 32538, z = 7}

local function ZE_Verifica()
    local tile = Tile(ZE.tpOpen)
    if tile then
        local item = tile:getItemById(1387)
        if item then
            item:remove()
            broadcastMessage("the Zombie Event vai comecar agora!", MESSAGE_STATUS_WARNING)
            doSummonCreature("Zumbi", ZE.posEnterEvent, false, true)
        else           
            broadcastMessage("The Zombie Event esta aberto e vai ser fechado em ".. ZE.tpTimeOpen .." minutos.", MESSAGE_STATUS_WARNING)
            setGlobalStorageValue(ZE.storage, 0)
            
            local teleport = Game.createItem(1387, 1, ZE.tpOpen)
            if teleport then
                teleport:setActionId(45110)
            end
        end
    end
end

local function warnEvents(i)
    Game.broadcastMessage("The Zombie event esta aberto, teleport se encontra em frente ao DP de Thais!")
    if i > 1 then
        addEvent(warnEvents, 2 * 60 * 1000, i - 1)
    end
end


--- TESTE
local function SumonarZumbis(b)

Game.createMonster("Zumbi", {x = math.random(zeArenaFromPosition.x, zeArenaToPosition.x), y = math.random(zeArenaFromPosition.y, zeArenaToPosition.y), z = math.random(zeArenaFromPosition.z, zeArenaToPosition.z)}, false, true)

if b > 1 then
        addEvent(SumonarZumbis, 1 * 60 * 1000, b - 1)
    end
end
-- TESTE

function onTime(interval)

    ZE_Verifica()
    addEvent(ZE_Verifica, ZE.tpTimeOpen * 60 * 1000)
    addEvent(warnEvents, 2 * 60 * 1000, 4)
    addEvent(SumonarZumbis, 50 * 60 * 1000, 16)
    return true
end
 
Ok, in:
Lua:
ZE = -- Zumbi Event
{
    tpOpen = {x = 32340, y = 32213, z = 7}, -- posição de onde abrirá o teleport para entrar no evento.
    tpTimeOpen = 2, -- tempo que o tp ficará aberto (em minutes).
    posEnterEvent = {x = 31468, y = 32166, z = 7}, -- posição de onde os players irão para dentro do evento.
    reward = {6527, 2, "You won 2 inwar coins."}, -- recompensa: "itemid, quantidade, msg"
    storage = 88789,
}

remove the last , where is storage = 88789, > storage = 88789

replace the script for this:
Lua:
--
--
dofile('data/lib/events/ZE_config.lua')

function onPrepareDeath(creature, killer)
    local player = creature:getPlayer()
    local enemy = Monster(killer)

    if enemy:getName() == "Zumbi" then
        if (Game.getStorageValue(88789) > 0) then
            if (Game.getStorageValue(88789) == 1) then
                player:say("ZUMBI EVENT WIN!", TALKTYPE_MONSTER_SAY)
                Game.setStorageValue(88789, 0)
                broadcastMessage("The player "..player:getName().." is the winner of the Zombie Event.", MESSAGE_STATUS_WARNING)
                player:sendTextMessage(MESSAGE_STATUS_WARNING, ZE.reward[3])
                player:addItem(ZE.reward[1], ZE.reward[2])
            else
                enemy:say("DEAD!", TALKTYPE_MONSTER_SAY)
 
            end

            Game.setStorageValue(88789, Game.getStorageValue(88789) - 1)
        end

        player:teleportTo(player:getTown():getTemplePosition())
        player:unregisterEvent("ZumbiDeath")
        player:setStorageValue(357812, 0)
    end

    return false
end

and use this in the other script:
Lua:
-- <globalevent name="Zumbi_Event" time="03:46:00" script="ZE_globalevents.lua"/>

dofile('data/lib/events/ZE_config.lua')

zeArenaFromPosition = Position(31433, 32135, 7) --pos of top left corner {x = 32442, y = 32522, z = 7}
zeArenaToPosition = Position(31503, 32200, 7) --pos of bottom right corner {x = 32457, y = 32538, z = 7}

local function ZE_Verifica()
    local tile = Tile(ZE.tpOpen)
    if tile then
        local item = tile:getItemById(1387)
        if item then
            item:remove()
            broadcastMessage("the Zombie Event vai comecar agora!", MESSAGE_STATUS_WARNING)
            doSummonCreature("Zumbi", ZE.posEnterEvent, false, true)
        else          
            broadcastMessage("The Zombie Event esta aberto e vai ser fechado em ".. ZE.tpTimeOpen .." minutos.", MESSAGE_STATUS_WARNING)
            Game.setStorageValue(88789, 0)
           
            local teleport = Game.createItem(1387, 1, ZE.tpOpen)
            if teleport then
                teleport:setActionId(45110)
            end
        end
    end
end

local function warnEvents(i)
    Game.broadcastMessage("The Zombie event esta aberto, teleport se encontra em frente ao DP de Thais!")
    if i > 1 then
        addEvent(warnEvents, 2 * 60 * 1000, i - 1)
    end
end


--- TESTE
local function SumonarZumbis(b)

Game.createMonster("Zumbi", {x = math.random(zeArenaFromPosition.x, zeArenaToPosition.x), y = math.random(zeArenaFromPosition.y, zeArenaToPosition.y), z = math.random(zeArenaFromPosition.z, zeArenaToPosition.z)}, false, true)

if b > 1 then
        addEvent(SumonarZumbis, 1 * 60 * 1000, b - 1)
    end
end
-- TESTE

function onTime(interval)

    ZE_Verifica()
    addEvent(ZE_Verifica, ZE.tpTimeOpen * 60 * 1000)
    addEvent(warnEvents, 2 * 60 * 1000, 4)
    addEvent(SumonarZumbis, 50 * 60 * 1000, 16)
    return true
end

see if it works and get back to me
 
Ok, in:
Lua:
ZE = -- Zumbi Event
{
    tpOpen = {x = 32340, y = 32213, z = 7}, -- posição de onde abrirá o teleport para entrar no evento.
    tpTimeOpen = 2, -- tempo que o tp ficará aberto (em minutes).
    posEnterEvent = {x = 31468, y = 32166, z = 7}, -- posição de onde os players irão para dentro do evento.
    reward = {6527, 2, "You won 2 inwar coins."}, -- recompensa: "itemid, quantidade, msg"
    storage = 88789,
}

remove the last , where is storage = 88789, > storage = 88789

replace the script for this:
Lua:
--
--
dofile('data/lib/events/ZE_config.lua')

function onPrepareDeath(creature, killer)
    local player = creature:getPlayer()
    local enemy = Monster(killer)

    if enemy:getName() == "Zumbi" then
        if (Game.getStorageValue(88789) > 0) then
            if (Game.getStorageValue(88789) == 1) then
                player:say("ZUMBI EVENT WIN!", TALKTYPE_MONSTER_SAY)
                Game.setStorageValue(88789, 0)
                broadcastMessage("The player "..player:getName().." is the winner of the Zombie Event.", MESSAGE_STATUS_WARNING)
                player:sendTextMessage(MESSAGE_STATUS_WARNING, ZE.reward[3])
                player:addItem(ZE.reward[1], ZE.reward[2])
            else
                enemy:say("DEAD!", TALKTYPE_MONSTER_SAY)
 
            end

            Game.setStorageValue(88789, Game.getStorageValue(88789) - 1)
        end

        player:teleportTo(player:getTown():getTemplePosition())
        player:unregisterEvent("ZumbiDeath")
        player:setStorageValue(357812, 0)
    end

    return false
end

and use this in the other script:
Lua:
-- <globalevent name="Zumbi_Event" time="03:46:00" script="ZE_globalevents.lua"/>

dofile('data/lib/events/ZE_config.lua')

zeArenaFromPosition = Position(31433, 32135, 7) --pos of top left corner {x = 32442, y = 32522, z = 7}
zeArenaToPosition = Position(31503, 32200, 7) --pos of bottom right corner {x = 32457, y = 32538, z = 7}

local function ZE_Verifica()
    local tile = Tile(ZE.tpOpen)
    if tile then
        local item = tile:getItemById(1387)
        if item then
            item:remove()
            broadcastMessage("the Zombie Event vai comecar agora!", MESSAGE_STATUS_WARNING)
            doSummonCreature("Zumbi", ZE.posEnterEvent, false, true)
        else         
            broadcastMessage("The Zombie Event esta aberto e vai ser fechado em ".. ZE.tpTimeOpen .." minutos.", MESSAGE_STATUS_WARNING)
            Game.setStorageValue(88789, 0)
          
            local teleport = Game.createItem(1387, 1, ZE.tpOpen)
            if teleport then
                teleport:setActionId(45110)
            end
        end
    end
end

local function warnEvents(i)
    Game.broadcastMessage("The Zombie event esta aberto, teleport se encontra em frente ao DP de Thais!")
    if i > 1 then
        addEvent(warnEvents, 2 * 60 * 1000, i - 1)
    end
end


--- TESTE
local function SumonarZumbis(b)

Game.createMonster("Zumbi", {x = math.random(zeArenaFromPosition.x, zeArenaToPosition.x), y = math.random(zeArenaFromPosition.y, zeArenaToPosition.y), z = math.random(zeArenaFromPosition.z, zeArenaToPosition.z)}, false, true)

if b > 1 then
        addEvent(SumonarZumbis, 1 * 60 * 1000, b - 1)
    end
end
-- TESTE

function onTime(interval)

    ZE_Verifica()
    addEvent(ZE_Verifica, ZE.tpTimeOpen * 60 * 1000)
    addEvent(warnEvents, 2 * 60 * 1000, 4)
    addEvent(SumonarZumbis, 50 * 60 * 1000, 16)
    return true
end

see if it works and get back to me

now no error appears, but the event does not end, the surviving player is not teleported to the temple and does not receive the reward
 
now no error appears, but the event does not end, the surviving player is not teleported to the temple and does not receive the reward

Lua:
--
--
dofile('data/lib/events/ZE_config.lua')

function onPrepareDeath(cid, killer)
    local player = Player(cid)
    local enemy = Monster(killer)

    if enemy:getName() == "Zumbi" then
        if (Game.getStorageValue(88789) > 0) then
            if (Game.getStorageValue(88789) == 1) then
                player:say("ZUMBI EVENT WIN!", TALKTYPE_MONSTER_SAY)
                Game.setStorageValue(88789, 0)
                broadcastMessage("The player "..player:getName().." is the winner of the Zombie Event.", MESSAGE_STATUS_WARNING)
                player:sendTextMessage(MESSAGE_STATUS_WARNING, ZE.reward[3])
                player:addItem(ZE.reward[1], ZE.reward[2])
            else
                enemy:say("DEAD!", TALKTYPE_MONSTER_SAY)
 
            end

            Game.setStorageValue(88789, Game.getStorageValue(88789) - 1)
        end

        player:teleportTo(player:getTown():getTemplePosition())
        player:unregisterEvent("ZumbiDeath")
        player:setStorageValue(357812, 0)
    end

    return false
end

try this
 
Solution
Lua:
--
--
dofile('data/lib/events/ZE_config.lua')

function onPrepareDeath(cid, killer)
    local player = Player(cid)
    local enemy = Monster(killer)

    if enemy:getName() == "Zumbi" then
        if (Game.getStorageValue(88789) > 0) then
            if (Game.getStorageValue(88789) == 1) then
                player:say("ZUMBI EVENT WIN!", TALKTYPE_MONSTER_SAY)
                Game.setStorageValue(88789, 0)
                broadcastMessage("The player "..player:getName().." is the winner of the Zombie Event.", MESSAGE_STATUS_WARNING)
                player:sendTextMessage(MESSAGE_STATUS_WARNING, ZE.reward[3])
                player:addItem(ZE.reward[1], ZE.reward[2])
            else
                enemy:say("DEAD!", TALKTYPE_MONSTER_SAY)
 
            end

            Game.setStorageValue(88789, Game.getStorageValue(88789) - 1)
        end

        player:teleportTo(player:getTown():getTemplePosition())
        player:unregisterEvent("ZumbiDeath")
        player:setStorageValue(357812, 0)
    end

    return false
end

try this

same error
 
Back
Top