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

Windows Zombie error onStartup

kozmo

Member
Joined
Jan 30, 2009
Messages
441
Solutions
2
Reaction score
23
Lua Script Error: [GlobalEvent Interface]
data/globalevents/scripts/zombie/onstartup.lua:eek:nStartup

data/globalevents/scripts/zombie/onstartup.lua:2: attempt to concatenate global 'ZE_isOnZombieArea' <a nil value>
stack traceback:
data/globalevents/scripts/zombie/onstartup.lua:2: in function
<data/globalevents/scripts/zombie/onstartup.lua:1>
 
http://otland.net/threads/zombie-event-new-version-bug-free-updated.128664/

Code:
function onStartup()
db.executeQuery("UPDATE `player_storage` SET `value` = 0 WHERE `key` = " .. ZE_isOnZombieArea .. ";")
doSetStorage(ZE_STATUS, 0)
doSetStorage(ZE_PLAYERS_NUMBER, ZE_DEFAULT_NUMBER_OF_PLAYERS)
doSetStorage(ZE_ZOMBIES_TO_SPAWN, 0)
doSetStorage(ZE_ZOMBIES_SPAWNED, 0)
addZombiesEventBlockEnterPosition()
return true
end
 
I already have this in my lib, if that's what you are talking about.

Code:
-- CONFIG
ZE_DEFAULT_NUMBER_OF_PLAYERS = 2
ZE_ACCESS_TO_IGNORE_ARENA = 3
-- POSITIONS
ZE_blockEnterItemPosition = {x= 1003, y=995, z=7}
ZE_enterPosition = {x = 782, y = 862, z = 7}
ZE_kickPosition = {x=1000, y=1000, z=7}
ZE_spawnFromPosition = {x = 775, y = 855, z = 7}
ZE_spawnToPosition = {x = 790, y = 870, z = 7}
-- ITEM IDS
ZE_blockEnterItemID = 3767
-- STORAGES
-- - player
ZE_isOnZombieArea = 34370
-- - global
ZE_STATUS = 34370 -- =< 0 - off, 1 - waiting for players, 2 - is running
ZE_PLAYERS_NUMBER = 34371
ZE_ZOMBIES_TO_SPAWN = 34372
ZE_ZOMBIES_SPAWNED = 34373
-- FUNCTION
function setZombiesEventPlayersLimit(value)
    doSetStorage(ZE_PLAYERS_NUMBER, value)
end
function getZombiesEventPlayersLimit()
    return getStorage(ZE_PLAYERS_NUMBER)
end
function addPlayerToZombiesArea(cid)
    doSendMagicEffect(getThingPosition(cid), CONST_ME_TELEPORT)
    doTeleportThing(cid, ZE_enterPosition, true)
    doSendMagicEffect(getThingPosition(cid), CONST_ME_TELEPORT)
    if(getPlayerAccess(cid) < ZE_ACCESS_TO_IGNORE_ARENA) then
        setPlayerZombiesEventStatus(cid, os.time())
    end
end
function kickPlayerFromZombiesArea(cid)
    doSendMagicEffect(getThingPosition(cid), CONST_ME_TELEPORT)
    doTeleportThing(cid, ZE_kickPosition, true)
    doSendMagicEffect(getThingPosition(cid), CONST_ME_TELEPORT)
    setPlayerZombiesEventStatus(cid, 0)
end
function getPlayerZombiesEventStatus(cid)
    return getCreatureStorage(cid, ZE_isOnZombieArea)
end
function setPlayerZombiesEventStatus(cid, value)
    doCreatureSetStorage(cid, ZE_isOnZombieArea, value)
end
function getZombiesEventPlayers()
    local players = {}
    for i, cid in pairs(getPlayersOnline()) do
        if(getPlayerZombiesEventStatus(cid) > 0) then
            table.insert(players, cid)
        end
    end
    return players
end
function getZombiesCount()
    return getStorage(ZE_ZOMBIES_SPAWNED)
end
function addZombiesCount()
    doSetStorage(ZE_ZOMBIES_SPAWNED, getStorage(ZE_ZOMBIES_SPAWNED)+1)
end
function resetZombiesCount()
    doSetStorage(ZE_ZOMBIES_SPAWNED, 0)
end
function getZombiesToSpawnCount()
    return getStorage(ZE_ZOMBIES_TO_SPAWN)
end
function setZombiesToSpawnCount(count)
    doSetStorage(ZE_ZOMBIES_TO_SPAWN, count)
end
function addZombiesEventBlockEnterPosition()
    if(getTileItemById(ZE_blockEnterItemPosition, ZE_blockEnterItemID).uid == 0) then
        doCreateItem(ZE_blockEnterItemID, 1, ZE_blockEnterItemPosition)
    end
end
function removeZombiesEventBlockEnterPosition()
    local item = getTileItemById(ZE_blockEnterItemPosition, ZE_blockEnterItemID)
    if(item.uid ~= 0) then
        doRemoveItem(item.uid)
    end
end
function spawnNewZombie()
    local posx = {}
    local posy = {}
    local posz = {}
    local pir = {}
    for i=1, 5 do
        local posx_tmp = math.random(ZE_spawnFromPosition.x ,ZE_spawnToPosition.x)
        local posy_tmp = math.random(ZE_spawnFromPosition.y ,ZE_spawnToPosition.y)
        local posz_tmp = math.random(ZE_spawnFromPosition.z ,ZE_spawnToPosition.z)
        local pir_tmp = 0
        local spec = getSpectators({x=posx_tmp, y=posy_tmp, z=posz_tmp}, 3, 3, false)
        if(spec and #spec > 0) then
            for z, pid in pairs(spec) do
                if(isPlayer(pid)) then
                    pir_tmp = pir_tmp + 1
                end
            end
        end
        posx[i] = posx_tmp
        posy[i] = posy_tmp
        posz[i] = posz_tmp
        pir[i] = pir_tmp
    end
    local lowest_i = 1
    for i=2, 5 do
        if(pir[i] < pir[lowest_i]) then
            lowest_i = i
        end
    end
    local ret = (type(doCreateMonster("Zombie Event", {x=posx[lowest_i], y=posy[lowest_i], z=posz[lowest_i]}, false)) == 'number')
    if(ret) then
        addZombiesCount()
    end
    return ret
end
 
I did that now i have this error.

Lua Script Error: [GlobalEvent Interface]
data/globalevents/scripts/zombie/onstartup.lua:eek:nStartup
data/globalevents/scripts/zombie/onstartup.lua:3: attempt to call global 'doSetStorage' <a nil value>
stack traceback:
data/globalevents/scripts/zombie/onstartup.lua:3: in function <data/globalevents/scripts/zombie/onstartup.lua:1>
 
Now there are no errors but nothing happens lol.

There is a Error when trying to use the talk action.

Lua Script Error: [TalkAction Interface]
data/talkactions/scripts/zombie/onsay.lua:eek:nSay

data/lib/function.lua:511: attempt to call global 'getCreatureStorage' <a nil value>
stack traceback:
data/lib/function.lua:511 in function 'getPlayerZombiesEventStatus'
data/lib/function.lua:521 in function 'getZombiesEventPlayers'

data/talkactions/scripts/zombie/onsay.lua:3: in function <data/talkactions/scripts/zombie/onsay.lua:3: in function <data/talkactions/scripts/zombie/onsay.lua:1>
 
Add this also in compat.lua
Code:
getCreatureStorage = getPlayerStorageValue
doCreatureSetStorage = doPlayerSetStorageValue
 
Great awesome i really appreciate all the help. that's now working, but of course there's the next Error.

Lua Script Error: [MoveEvents Interface]
data/movements/scripts/zombie/onenter.lua:eek:nStepIn

data/lib/function.lua:495: attempt to call global 'getThingPosition' <a nile value>
stack traceback:
data/lib/function.lua:495: in function 'addPlayerToZombieArea'
data/movements/scripts/zombie/onenter.lua:8: in function <data/movements/scripts/zombie/onenter.lua:1>
 
Broadcasted message: Test Paladin has entered a Zombie Arena. We still need 1 players. ''.
assertion failed: it !=creatureList.end<>, file../map.h, line 282
 
I get this error when i put that in compat.lua

Broadcasted message: Test Paladin has entered a Zombie Arena. We still need 1 players. ''.
assertion failed: it !=creatureList.end<>, file../map.h, line 282
 
Back
Top