• 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 1.2 problem

bybbzan

mapper
Joined
Aug 4, 2012
Messages
809
Solutions
2
Reaction score
136
Location
Sweden
Hi

The zombie teleport is just saying "The zombie event has already started" even tho it has not started.
Actually its saying the same thing when it has started aswell. I am not getting any warning, so it seems this doesn't work. Im getting no errors.

globalevents
Code:
function onTime(interval)
    if ze_started == false then
        ze_started = true
        print("Zombie event has started and we are waiting for players to join! Min: "..ze_min_players.."/"..ze_max_players..".")
        broadcastMessage("The zombie event has started! You have "..ze_wait_minutes.." minutes to join!", MESSAGE_STATUS_CONSOLE_ORANGE)
        addEvent(startZombie, ze_wait_minutes * 60 * 1000)
    end
    return true
end

creaturescript
Code:
function onDeath(cid, corpse, killer, mostDamage, unjustified, mostDamage_unjustified)
    local monster = Monster(cid)
    monster:getPosition():sendMagicEffect(CONST_ME_MORTAREA)
    doSummonZombie()
    ze_zombie_count = ze_zombie_count - 1
end

function onPrepareDeath(cid, killer)
    local player = Player(cid)
    local winner = 0
    if player:getStorageValue(ze_join_storage) == 1 then
        ze_joined_count = ze_joined_count - 1
        player:teleportTo(player:getTown():getTemplePosition(), false)
        player:setStorageValue(ze_join_storage, 0)
        player:addHealth(player:getMaxHealth())
        Game.broadcastMessage(player:getName() .. " was killed. " .. ze_joined_count .. " players left in the arena.", MESSAGE_STATUS_WARNING)
        if ze_joined_count <= 1 then --Event ended, someone won!
            local players = Game.getPlayers()
            for _, tmpPlayer in ipairs(players) do
                local stor = tmpPlayer:getStorageValue(ze_join_storage)
                if stor == 1 then
                    winner = tmpPlayer:getId()
                end
            end

            winner = Player(winner)
            if winner ~= nil then
                local rewardId = { 15546, 5919 }
                local random = rewardId[math.random(#rewardId)]
                winner:addItem(random, 1)
                winner:teleportTo(winner:getTown():getTemplePosition(), false)
                local trophy = winner:addItem(ze_trophy, 1)
                if trophy then
                    trophy:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, "["..winner:getName().."] "..ze_trophy_desc)
                end
                Game.broadcastMessage(winner:getName() .. " is the winner of zombie event versus " .. ze_zombie_count .. " Zombies! He won a " .. ItemType(random):getName() .. ".", MESSAGE_STATUS_WARNING)
            end
            doClearZombieArena()
            resetVariables()
        end
        return false
    end
    return true
end

movement
Code:
function onStepIn(cid, item, position, fromPosition)
    local player = Player(cid)
    if not player then
        return false
    end

    if player:getGroup():getAccess() then
        player:say('Gamemasters are not allowed to participate in this event.', TALKTYPE_MONSTER_SAY)      
        fromPosition:sendMagicEffect(CONST_ME_TELEPORT)
        player:teleportTo(fromPosition, true)
        return false
    end

    if ze_started == started then
        player:say('The zombie event has already been started.', TALKTYPE_MONSTER_SAY)      
        fromPosition:sendMagicEffect(CONST_ME_TELEPORT)       
        player:teleportTo(fromPosition, true)
        return false
    end

    if ze_started == true then
        if ze_joined_count < ze_max_players then
            player:teleportTo(ze_waiting_room_pos, false)
            ze_joined_count = ze_joined_count + 1
            broadcastMessage(player:getName().." has joined the zombie event! ["..ze_joined_count.."/"..ze_max_players.."].", MESSAGE_STATUS_WARNING)
            player:setStorageValue(ze_join_storage, 1)
        else
            player:teleportTo(fromPosition, true)
            player:sendTextMessage(MESSAGE_INFO_DESCR, "I'm sorry, but the zombie event is currently full. ["..ze_joined_count.."/"..ze_max_players.."]")
            fromPosition:sendMagicEffect(CONST_ME_TELEPORT)       
        end
    else
        player:say('The zombie event has not started yet.', TALKTYPE_MONSTER_SAY)      
        fromPosition:sendMagicEffect(CONST_ME_TELEPORT)       
        player:teleportTo(fromPosition, true)
    end
end

lib
Code:
--zombie variables
ze_Zombie_Name = "Zombie" --Zombie Name
zombie_spawn_interval = 5 --how many seconds until a new zombie spawns
ze_zombie_count = 0 --dont touch
ze_max_zombies = 40 --max zombies in the arena?

--players variables
ze_join_storage = 30451 --player join storage
ze_min_players = 1 --min players needed when time runout
ze_max_players = 40 --max players to join
ze_trophy = 7369 --trophy id
ze_trophy_desc =  "has won the zombie event." --winner description on the trophy

--other variables
ze_wait_minutes = 1 --when event has opened, how long until it starts?
ze_started = false --dont touch
ze_waiting_room_pos = {x = 989, y = 760, z = 7} --middle of waiting room
ze_zombie_arena = {x = 1027, y = 755, z = 7} --when even start where should player be teleported in the zombie arena?
ze_Arena_fromPosition = {x = 1008, y = 753, z = 7} --pos of top left corner
ze_Arena_toPosition = {x = 1052, y = 773, z = 7} --pos of bottom right corner
ze_middle_zombie_arena = {x = 1029, y = 763, z = 7} --Middle pos of the arena
ze_joined_count = 0 --dont touch
ze_waiting_room_radius_x = 3 --depends how big the waiting room is 20sqm to x
ze_waiting_room_radius_y = 3 --depends how big the waiting room is 20sqm to y
ze_zombie_arena_radius_x = 22 --Depends how big the zombie arena is 50sqm to x
ze_zombie_arena_radius_y = 10 --Depends how big the zombie arena is 50sqm to y

function startZombie()
    local specs = Game.getSpectators(ze_waiting_room_pos, false, true, 0, ze_waiting_room_radius_x, 0, ze_waiting_room_radius_y)
    if ze_joined_count >= ze_min_players then
        for i = 1, #specs do
            specs[i]:teleportTo(ze_zombie_arena, true)
        end
        broadcastMessage("The zombie event has started, good luck to all participants!", MESSAGE_STATUS_WARNING)
        ze_started = started
        doStartZombieEvasion()
    else
        for i = 1, #specs do
            specs[i]:teleportTo(specs[i]:getTown():getTemplePosition(), false)
            specs[i]:setStorageValue(ze_join_storage, 0)
        end
        resetVariables()
        broadcastMessage("The zombie event could not start because not enough players joined the event.", MESSAGE_STATUS_WARNING)
    end
end

function doSummonZombie()
    if ze_zombie_count < ze_max_zombies then
        local zomb = Game.createMonster(ze_Zombie_Name, {x = math.random(ze_Arena_fromPosition.x, ze_Arena_toPosition.x), y = math.random(ze_Arena_fromPosition.y, ze_Arena_toPosition.y), z = math.random(ze_Arena_fromPosition.z, ze_Arena_toPosition.z)})
        if zomb == false then
            Game.createMonster(ze_Zombie_Name, {x = math.random(ze_Arena_fromPosition.x, ze_Arena_toPosition.x), y = math.random(ze_Arena_fromPosition.y, ze_Arena_toPosition.y), z = math.random(ze_Arena_fromPosition.z, ze_Arena_toPosition.z)})
        end
        ze_zombie_count = ze_zombie_count + 1
    end
end

function doStartZombieEvasion()
    if ze_started == started then
        doSummonZombie()
        addEvent(doStartZombieEvasion, 5 * 1000)
    end
end

function resetVariables()
    ze_started = false
    ze_joined_count = 0
    ze_zombie_count = 0
end

function doClearZombieArena()
    local specs = Game.getSpectators(ze_middle_zombie_arena, false, false, 0, ze_zombie_arena_radius_x, 0, ze_zombie_arena_radius_y)
    for i = 1, #specs do
        if specs[i]:getName() == ze_Zombie_Name then
            specs[i]:remove()
        end
    end
end
 
Hi

The zombie teleport is just saying "The zombie event has already started" even tho it has not started.
Actually its saying the same thing when it has started aswell. I am not getting any warning, so it seems this doesn't work. Im getting no errors.

globalevents
Code:
function onTime(interval)
    if ze_started == false then
        ze_started = true
        print("Zombie event has started and we are waiting for players to join! Min: "..ze_min_players.."/"..ze_max_players..".")
        broadcastMessage("The zombie event has started! You have "..ze_wait_minutes.." minutes to join!", MESSAGE_STATUS_CONSOLE_ORANGE)
        addEvent(startZombie, ze_wait_minutes * 60 * 1000)
    end
    return true
end

creaturescript
Code:
function onDeath(cid, corpse, killer, mostDamage, unjustified, mostDamage_unjustified)
    local monster = Monster(cid)
    monster:getPosition():sendMagicEffect(CONST_ME_MORTAREA)
    doSummonZombie()
    ze_zombie_count = ze_zombie_count - 1
end

function onPrepareDeath(cid, killer)
    local player = Player(cid)
    local winner = 0
    if player:getStorageValue(ze_join_storage) == 1 then
        ze_joined_count = ze_joined_count - 1
        player:teleportTo(player:getTown():getTemplePosition(), false)
        player:setStorageValue(ze_join_storage, 0)
        player:addHealth(player:getMaxHealth())
        Game.broadcastMessage(player:getName() .. " was killed. " .. ze_joined_count .. " players left in the arena.", MESSAGE_STATUS_WARNING)
        if ze_joined_count <= 1 then --Event ended, someone won!
            local players = Game.getPlayers()
            for _, tmpPlayer in ipairs(players) do
                local stor = tmpPlayer:getStorageValue(ze_join_storage)
                if stor == 1 then
                    winner = tmpPlayer:getId()
                end
            end

            winner = Player(winner)
            if winner ~= nil then
                local rewardId = { 15546, 5919 }
                local random = rewardId[math.random(#rewardId)]
                winner:addItem(random, 1)
                winner:teleportTo(winner:getTown():getTemplePosition(), false)
                local trophy = winner:addItem(ze_trophy, 1)
                if trophy then
                    trophy:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, "["..winner:getName().."] "..ze_trophy_desc)
                end
                Game.broadcastMessage(winner:getName() .. " is the winner of zombie event versus " .. ze_zombie_count .. " Zombies! He won a " .. ItemType(random):getName() .. ".", MESSAGE_STATUS_WARNING)
            end
            doClearZombieArena()
            resetVariables()
        end
        return false
    end
    return true
end

movement
Code:
function onStepIn(cid, item, position, fromPosition)
    local player = Player(cid)
    if not player then
        return false
    end

    if player:getGroup():getAccess() then
        player:say('Gamemasters are not allowed to participate in this event.', TALKTYPE_MONSTER_SAY)     
        fromPosition:sendMagicEffect(CONST_ME_TELEPORT)
        player:teleportTo(fromPosition, true)
        return false
    end

    if ze_started == started then
        player:say('The zombie event has already been started.', TALKTYPE_MONSTER_SAY)     
        fromPosition:sendMagicEffect(CONST_ME_TELEPORT)      
        player:teleportTo(fromPosition, true)
        return false
    end

    if ze_started == true then
        if ze_joined_count < ze_max_players then
            player:teleportTo(ze_waiting_room_pos, false)
            ze_joined_count = ze_joined_count + 1
            broadcastMessage(player:getName().." has joined the zombie event! ["..ze_joined_count.."/"..ze_max_players.."].", MESSAGE_STATUS_WARNING)
            player:setStorageValue(ze_join_storage, 1)
        else
            player:teleportTo(fromPosition, true)
            player:sendTextMessage(MESSAGE_INFO_DESCR, "I'm sorry, but the zombie event is currently full. ["..ze_joined_count.."/"..ze_max_players.."]")
            fromPosition:sendMagicEffect(CONST_ME_TELEPORT)      
        end
    else
        player:say('The zombie event has not started yet.', TALKTYPE_MONSTER_SAY)     
        fromPosition:sendMagicEffect(CONST_ME_TELEPORT)      
        player:teleportTo(fromPosition, true)
    end
end

lib
Code:
--zombie variables
ze_Zombie_Name = "Zombie" --Zombie Name
zombie_spawn_interval = 5 --how many seconds until a new zombie spawns
ze_zombie_count = 0 --dont touch
ze_max_zombies = 40 --max zombies in the arena?

--players variables
ze_join_storage = 30451 --player join storage
ze_min_players = 1 --min players needed when time runout
ze_max_players = 40 --max players to join
ze_trophy = 7369 --trophy id
ze_trophy_desc =  "has won the zombie event." --winner description on the trophy

--other variables
ze_wait_minutes = 1 --when event has opened, how long until it starts?
ze_started = false --dont touch
ze_waiting_room_pos = {x = 989, y = 760, z = 7} --middle of waiting room
ze_zombie_arena = {x = 1027, y = 755, z = 7} --when even start where should player be teleported in the zombie arena?
ze_Arena_fromPosition = {x = 1008, y = 753, z = 7} --pos of top left corner
ze_Arena_toPosition = {x = 1052, y = 773, z = 7} --pos of bottom right corner
ze_middle_zombie_arena = {x = 1029, y = 763, z = 7} --Middle pos of the arena
ze_joined_count = 0 --dont touch
ze_waiting_room_radius_x = 3 --depends how big the waiting room is 20sqm to x
ze_waiting_room_radius_y = 3 --depends how big the waiting room is 20sqm to y
ze_zombie_arena_radius_x = 22 --Depends how big the zombie arena is 50sqm to x
ze_zombie_arena_radius_y = 10 --Depends how big the zombie arena is 50sqm to y

function startZombie()
    local specs = Game.getSpectators(ze_waiting_room_pos, false, true, 0, ze_waiting_room_radius_x, 0, ze_waiting_room_radius_y)
    if ze_joined_count >= ze_min_players then
        for i = 1, #specs do
            specs[i]:teleportTo(ze_zombie_arena, true)
        end
        broadcastMessage("The zombie event has started, good luck to all participants!", MESSAGE_STATUS_WARNING)
        ze_started = started
        doStartZombieEvasion()
    else
        for i = 1, #specs do
            specs[i]:teleportTo(specs[i]:getTown():getTemplePosition(), false)
            specs[i]:setStorageValue(ze_join_storage, 0)
        end
        resetVariables()
        broadcastMessage("The zombie event could not start because not enough players joined the event.", MESSAGE_STATUS_WARNING)
    end
end

function doSummonZombie()
    if ze_zombie_count < ze_max_zombies then
        local zomb = Game.createMonster(ze_Zombie_Name, {x = math.random(ze_Arena_fromPosition.x, ze_Arena_toPosition.x), y = math.random(ze_Arena_fromPosition.y, ze_Arena_toPosition.y), z = math.random(ze_Arena_fromPosition.z, ze_Arena_toPosition.z)})
        if zomb == false then
            Game.createMonster(ze_Zombie_Name, {x = math.random(ze_Arena_fromPosition.x, ze_Arena_toPosition.x), y = math.random(ze_Arena_fromPosition.y, ze_Arena_toPosition.y), z = math.random(ze_Arena_fromPosition.z, ze_Arena_toPosition.z)})
        end
        ze_zombie_count = ze_zombie_count + 1
    end
end

function doStartZombieEvasion()
    if ze_started == started then
        doSummonZombie()
        addEvent(doStartZombieEvasion, 5 * 1000)
    end
end

function resetVariables()
    ze_started = false
    ze_joined_count = 0
    ze_zombie_count = 0
end

function doClearZombieArena()
    local specs = Game.getSpectators(ze_middle_zombie_arena, false, false, 0, ze_zombie_arena_radius_x, 0, ze_zombie_arena_radius_y)
    for i = 1, #specs do
        if specs[i]:getName() == ze_Zombie_Name then
            specs[i]:remove()
        end
    end
end

Where did you get that code? Could it be outdated?
Try this; Zombie Event BETA! [Tfs 1.0] Vers: 0.5

If you have custom edits to the script this is the problem;
LUA:
if ze_started == started then
Either ze_started or started does not reset, use print(ze_started, started) and see what prints out.
Most likely started will be nil or you forgot to upload something, so you are trying to compare a boolean value to a nil value, replace it to just;
LUA:
if ze_started then
That will check if it's true or not.
 
Where did you get that code? Could it be outdated?
Try this; Zombie Event BETA! [Tfs 1.0] Vers: 0.5

If you have custom edits to the script this is the problem;
LUA:
if ze_started == started then
Either ze_started or started does not reset, use print(ze_started, started) and see what prints out.
Most likely started will be nil or you forgot to upload something, so you are trying to compare a boolean value to a nil value, replace it to just;
LUA:
if ze_started then
That will check if it's true or not.

Alright, i updated the files to the newer version, now i got this.

Code:
Lua Script Error: [MoveEvents Interface]
data/movements/scripts/zombie/zombie_teleport.lua:onStepIn
data/movements/scripts/zombie/zombie_teleport.lua:21: attempt to compare number with nil
stack traceback:
        [C]: in function '__lt'
        data/movements/scripts/zombie/zombie_teleport.lua:21: in function <data/movements/scripts/zombie/zombie_teleport.lua:3>

Code:
dofile('data/lib/zombie_system.lua')

function onStepIn(cid, item, position, fromPosition)
        local player = Player(cid)
    if not player then
            return false
        end

        if Game.getStorageValue(zeStartedGlobalStorage) == 2 then
            player:sendTextMessage(MESSAGE_INFO_DESCR, 'The Zombie Event has already started.')
            player:teleportTo(fromPosition, true)
            return false
        end

        if Game.getStorageValue(zeStartedGlobalStorage) == 0 then
            player:sendTextMessage(MESSAGE_INFO_DESCR, 'The Zombie Event has not started yet.')
            player:teleportTo(fromPosition, true)
            return false
        end

       if Game.getStorageValue(zeJoinedCountGlobalStorage) > zeMaxPlayers then
            player:teleportTo(fromPosition, true)
            player:sendTextMessage(MESSAGE_INFO_DESCR, 'The Zombie Event is already full! ['.. Game.getStorageValue(zeJoinedCountGlobalStorage) ..'/'.. zeMaxPlayers ..']')
            return false
        end

        player:teleportTo(zeWaitingRoomPos)
        Game.setStorageValue(zeJoinedCountGlobalStorage, Game.getStorageValue(zeJoinedCountGlobalStorage) + 1)
        Game.broadcastMessage(string.format('%s has joined the Zombie Event! [%s/'.. zeMaxPlayers ..'].', player:getName(), Game.getStorageValue(zeJoinedCountGlobalStorage)), MESSAGE_STATUS_WARNING)
        player:setStorageValue(zeJoinStorage, 1)
        return true
end

Kinda like you predicted? :p
 
Alright, i updated the files to the newer version, now i got this.

Code:
Lua Script Error: [MoveEvents Interface]
data/movements/scripts/zombie/zombie_teleport.lua:onStepIn
data/movements/scripts/zombie/zombie_teleport.lua:21: attempt to compare number with nil
stack traceback:
        [C]: in function '__lt'
        data/movements/scripts/zombie/zombie_teleport.lua:21: in function <data/movements/scripts/zombie/zombie_teleport.lua:3>

Code:
dofile('data/lib/zombie_system.lua')

function onStepIn(cid, item, position, fromPosition)
        local player = Player(cid)
    if not player then
            return false
        end

        if Game.getStorageValue(zeStartedGlobalStorage) == 2 then
            player:sendTextMessage(MESSAGE_INFO_DESCR, 'The Zombie Event has already started.')
            player:teleportTo(fromPosition, true)
            return false
        end

        if Game.getStorageValue(zeStartedGlobalStorage) == 0 then
            player:sendTextMessage(MESSAGE_INFO_DESCR, 'The Zombie Event has not started yet.')
            player:teleportTo(fromPosition, true)
            return false
        end

       if Game.getStorageValue(zeJoinedCountGlobalStorage) > zeMaxPlayers then
            player:teleportTo(fromPosition, true)
            player:sendTextMessage(MESSAGE_INFO_DESCR, 'The Zombie Event is already full! ['.. Game.getStorageValue(zeJoinedCountGlobalStorage) ..'/'.. zeMaxPlayers ..']')
            return false
        end

        player:teleportTo(zeWaitingRoomPos)
        Game.setStorageValue(zeJoinedCountGlobalStorage, Game.getStorageValue(zeJoinedCountGlobalStorage) + 1)
        Game.broadcastMessage(string.format('%s has joined the Zombie Event! [%s/'.. zeMaxPlayers ..'].', player:getName(), Game.getStorageValue(zeJoinedCountGlobalStorage)), MESSAGE_STATUS_WARNING)
        player:setStorageValue(zeJoinStorage, 1)
        return true
end

Kinda like you predicted? :p

Did you add these? Zombie Event BETA! [Tfs 1.0] Vers: 0.5
LUA:
zeMaxPlayers = 5 --max players to join

As you posted in the thread, the libs has to be linked, try to add a print("testing ze libs") at the top of the script, if that isn't shown when you start the server the script isn't loaded.
 
Did you add these? Zombie Event BETA! [Tfs 1.0] Vers: 0.5
LUA:
zeMaxPlayers = 5 --max players to join

As you posted in the thread, the libs has to be linked, try to add a print("testing ze libs") at the top of the script, if that isn't shown when you start the server the script isn't loaded.

Okay so i deleted everything, copy & pasted it again from scratch. And now i got this error:
Code:
Lua Script Error: [GlobalEvent Interface]
data/globalevents/scripts/zombie_think.lua:onThink
data/globalevents/scripts/zombie_think.lua:4: attempt to compare nil with number
stack traceback:
        [C]: in function '__lt'
        data/globalevents/scripts/zombie_think.lua:4: in function <data/globalevents/scripts/zombie_think.lua:3>
[Error - GlobalEvents::think] Failed to execute event: zombie

Code:
dofile('data/zombie_system.lua')

function onThink(interval, lastExecution, thinkInterval)
    if Game.getStorageValue(zeStartedGlobalStorage) < 1 then
        local teleport = Game.createItem(1387, 1, zeCreateTeleportPosition)
        if teleport then
            teleport:setAttribute(ITEM_ATTRIBUTE_UNIQUEID, 7000)
        end
        Game.setStorageValue(zeStartedGlobalStorage, 1)
        print('Zombie Event has started & waiting for players to join! Min: '.. zeMinPlayers ..'/'.. zeMaxPlayers ..'.')
        Game.broadcastMessage('The Zombie Event has started! You have '.. zeWaitMinutes ..' minutes to join!', MESSAGE_STATUS_WARNING)
        addEvent(startZombie, zeWaitMinutes * 60 * 1000)
    end
    return true
end
 
Okay so i deleted everything, copy & pasted it again from scratch. And now i got this error:
Code:
Lua Script Error: [GlobalEvent Interface]
data/globalevents/scripts/zombie_think.lua:onThink
data/globalevents/scripts/zombie_think.lua:4: attempt to compare nil with number
stack traceback:
        [C]: in function '__lt'
        data/globalevents/scripts/zombie_think.lua:4: in function <data/globalevents/scripts/zombie_think.lua:3>
[Error - GlobalEvents::think] Failed to execute event: zombie

Code:
dofile('data/zombie_system.lua')

function onThink(interval, lastExecution, thinkInterval)
    if Game.getStorageValue(zeStartedGlobalStorage) < 1 then
        local teleport = Game.createItem(1387, 1, zeCreateTeleportPosition)
        if teleport then
            teleport:setAttribute(ITEM_ATTRIBUTE_UNIQUEID, 7000)
        end
        Game.setStorageValue(zeStartedGlobalStorage, 1)
        print('Zombie Event has started & waiting for players to join! Min: '.. zeMinPlayers ..'/'.. zeMaxPlayers ..'.')
        Game.broadcastMessage('The Zombie Event has started! You have '.. zeWaitMinutes ..' minutes to join!', MESSAGE_STATUS_WARNING)
        addEvent(startZombie, zeWaitMinutes * 60 * 1000)
    end
    return true
end

LUA:
print(zeStartedGlobalStorage, zeCreateTeleportPosition)
 
Code:
nil     nil
102     table: 0x0d91a0c8
102     table: 0x0d7d29d8
102     table: 0x0d7f8520
102     table: 0x0d7fdd28
102     table: 0x0d7d4128
102     table: 0x0d8e5a80
102     table: 0x0d7ef100

Well thats weird, try to just make the lib global, so move this to global.lua insted.
LUA:
dofile('data/zombie_system.lua')
 
Well thats weird, try to just make the lib global, so move this to global.lua insted.
LUA:
dofile('data/zombie_system.lua')
Should i remove all
Code:
dofile('data/zombie_system.lua')
lines, and just add it in global.lua? Did i get that right? In that case, this is just what i got "nil nil"
 
Last edited:
Should i remove all
Code:
dofile('data/zombie_system.lua')
lines, and just add it in global.lua? Did i get that right? In that case, this is just what i got "nil nil"

Add a print to the lib file, it should show that print when you restart the server.
If you only reload global this will happen.

And is zombie_system.lua located in data/ (same as global.lua?)
 
Add a print to the lib file, it should show that print when you restart the server.
If you only reload global this will happen.

And is zombie_system.lua located in data/ (same as global.lua?)

So.. i added print to the global.lua file and
Code:
testing zombie event
 
Now the event is running, but when it's actually about to start, this happens:
I tried this on a new compiled server, latest from GitHub - otland/forgottenserver: A free and open-source MMORPG server emulator written in C++
Could it be my Windows 10 or why will it not work!? :(

Code:
Lua Script Error: [Main Interface]
in a timer event called from:
(Unknown scriptfile)
data/lib/core/game.lua:67: table index is nil
stack traceback:
        [C]: in function '__newindex'
        data/lib/core/game.lua:67: in function 'setStorageValue'
        data/lib/zombie_system.lua:71: in function 'resetVariables'
        data/lib/zombie_system.lua:37: in function <data/lib/zombie_system.lua:30>
 
Back
Top