• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Solved Zombie event error

bybbzan

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

Im trying to setup zombie event for my server.

Im getting these 2 errors and cant understand them, can someone help me?

Error:
Code:
Lua Script Error: [CreatureScript Interface]
data/creaturescripts/scripts/others/battlefield.lua:onLogin
data/creaturescripts/scripts/others/battlefield.lua:3: attempt to index global '
_Lib_Battle_Info' (a nil value)
stack traceback:
        [C]: in function '__index'
        data/creaturescripts/scripts/others/battlefield.lua:3: in function <data
/creaturescripts/scripts/others/battlefield.lua:1>

Error:
Code:
Lua Script Error: [GlobalEvent Interface]
data/globalevents/scripts/battlefield/zombie.lua:onTime
data/globalevents/scripts/battlefield/zombie.lua:4: attempt to compare nil with
number
stack traceback:
        [C]: in function '__lt'
        data/globalevents/scripts/battlefield/zombie.lua:4: in function <data/gl
obalevents/scripts/battlefield/zombie.lua:3>

battlefield.lua
Code:
function onLogin(player)
    player:registerEvent("battledeath")
    if Game.getStorageValue(_Lib_Battle_Info.TeamOne.storage) == -1 then
        Game.setStorageValue(_Lib_Battle_Info.TeamOne.storage, 0)
        Game.setStorageValue(_Lib_Battle_Info.TeamTwo.storage, 0)
        Game.setStorageValue(_Lib_Battle_Info.storage_count, 0)
    end
    if player:getStorageValue(_Lib_Battle_Info.TeamOne.storage) >= 1 or player:getStorageValue(_Lib_Battle_Info.TeamTwo.storage) >= 1 then
        player:setStorageValue(_Lib_Battle_Info.TeamOne.storage, -1)
        player:setStorageValue(_Lib_Battle_Info.TeamTwo.storage, -1)
        player:teleportTo(player:getTown():getTemplePosition())
    end
    return true
end

function onPrepareDeath(creature, lastHitKiller, mostDamageKiller)
    if creature:isPlayer() and creature:getStorageValue(_Lib_Battle_Info.TeamOne.storage) >= 1 or creature:getStorageValue(_Lib_Battle_Info.TeamTwo.storage) >= 1 then
        local MyTeam = creature:getStorageValue(_Lib_Battle_Info.TeamOne.storage) >= 1 and _Lib_Battle_Info.TeamOne.storage or _Lib_Battle_Info.TeamTwo.storage
        local EnemyTeam = creature:getStorageValue(_Lib_Battle_Info.TeamOne.storage) >= 1 and _Lib_Battle_Info.TeamTwo.storage or _Lib_Battle_Info.TeamOne.storage
        Game.setStorageValue(MyTeam, (Game.getStorageValue(MyTeam)-1))
        creature:sendTextMessage(MESSAGE_INFO_DESCR, "[BattleField] You are dead.")
        creature:setStorageValue(MyTeam, -1)
        creature:removeCondition(CONDITION_OUTFIT)
        if Game.getStorageValue(MyTeam) == 0 then
            getWinnersBattle(EnemyTeam)
        else
            doBroadCastBattle(23, "[BattleField] " .. _Lib_Battle_Info.TeamOne.name .. " " .. Game.getStorageValue(_Lib_Battle_Info.TeamOne.storage) .. " VS " .. Game.getStorageValue(_Lib_Battle_Info.TeamTwo.storage) .. " " .._Lib_Battle_Info.TeamTwo.name)
        end
    end
    return true
end

zombie.lua
Code:
dofile('data/zombieEvent.lua')

function onTime(interval, lastExecution, thinkInterval)
    if Game.getStorageValue(ze_stateGlobalStorage) < 1 then
        local teleport = Game.createItem(1387, 1, ze_createTeleportPosition)
        if teleport then
            teleport:setAttribute(ITEM_ATTRIBUTE_ACTIONID, 7000)
        end
        Game.setStorageValue(ze_stateGlobalStorage, 1)
        print('Zombie Event has started & waiting for players to join! Min: 1/100.')
        Game.broadcastMessage('The Zombie Event has started! You have '.. ze_waitTime ..' minutes to join!', MESSAGE_STATUS_WARNING)
        addEvent(startZombieEvent, ze_waitTime * 60 * 1000)
    end
    return true
end
 
Did you added the zombieEvent.lua lib file and is the table _Lib_Battle_Info and the variable ze_stateGlobalStorage added in that lib file?
 
Back
Top