• 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!
  • If you're using Gesior 2012 or MyAAC, please review this thread for information about a serious security vulnerability and a fix.

Zombie Event ERROR

Azerty

Member
Joined
Apr 15, 2022
Messages
207
Solutions
3
Reaction score
15
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)...

mano368

Advanced OT User
Joined
Sep 2, 2011
Messages
394
Solutions
36
Reaction score
158
Location
Brazil
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?
 
OP
OP
A

Azerty

Member
Joined
Apr 15, 2022
Messages
207
Solutions
3
Reaction score
15
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,
}
 

mano368

Advanced OT User
Joined
Sep 2, 2011
Messages
394
Solutions
36
Reaction score
158
Location
Brazil
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
 

mano368

Advanced OT User
Joined
Sep 2, 2011
Messages
394
Solutions
36
Reaction score
158
Location
Brazil
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
 
OP
OP
A

Azerty

Member
Joined
Apr 15, 2022
Messages
207
Solutions
3
Reaction score
15
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
 

mano368

Advanced OT User
Joined
Sep 2, 2011
Messages
394
Solutions
36
Reaction score
158
Location
Brazil
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
 
OP
OP
A

Azerty

Member
Joined
Apr 15, 2022
Messages
207
Solutions
3
Reaction score
15
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
 

mano368

Advanced OT User
Joined
Sep 2, 2011
Messages
394
Solutions
36
Reaction score
158
Location
Brazil
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
OP
OP
A

Azerty

Member
Joined
Apr 15, 2022
Messages
207
Solutions
3
Reaction score
15
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
 
Top