• 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 - NEW version, bug free, updated

Anyone able to change this to what is explained above??
Need zombie "survival" so that you must fight zombies and survive X amount of waves then all players get prizes who live
All this time I cant believe this still isnt answered :S
Can someone explain how to do this?? just a lil help?? :S
 
How To Do What?
as explained in the post

"Need zombie "survival" so that you must fight zombies and survive X amount of waves then all players get prizes who live"

not get kicked after attack. preferably have like 3 chances then you get kicked if you die 3 times but that isnt a NEED but the other requirement is and I cant seem to get it to work
 
it works perfect, but i have a problem with the zombies spawn: they spawn very very fast (like 100 zombies in 10 second), what can I do?

please help!
 
I feel like I've implemented everything perfectly but I am getting this error:

PHP:
[20/11/2013 22:37:20] Description:
[20/11/2013 22:37:20] data/lib/zombie_event.lua:123: attempt to index local 'pir' (a number value)
[20/11/2013 22:37:20] stack traceback:
[20/11/2013 22:37:20]    data/lib/zombie_event.lua:123: in function 'spawnNewZombie'
[20/11/2013 22:37:20]    data/globalevents/scripts/zombie/onthink.lua:6: in function <data/globalevents/scripts/zombie/onthink.lua:1>
[20/11/2013 22:37:20] [Error - GlobalEvents::think] Couldn't execute event: ZombieGlobalThink
 
I feel like I've implemented everything perfectly but I am getting this error:

PHP:
[20/11/2013 22:37:20] Description:
[20/11/2013 22:37:20] data/lib/zombie_event.lua:123: attempt to index local 'pir' (a number value)
[20/11/2013 22:37:20] stack traceback:
[20/11/2013 22:37:20]    data/lib/zombie_event.lua:123: in function 'spawnNewZombie'
[20/11/2013 22:37:20]    data/globalevents/scripts/zombie/onthink.lua:6: in function <data/globalevents/scripts/zombie/onthink.lua:1>
[20/11/2013 22:37:20] [Error - GlobalEvents::think] Couldn't execute event: ZombieGlobalThink


i have the same error, u know how to solve?
 
This is NEW - full - final version of Zombie Event script:


<flag pushable="0"/>
<flag canpushitems="1"/>
<flag canpushcreatures="1"/>
<flag targetdistance="1"/>
<flag staticattack="90"/>
<flag runonhealth="0"/>
</flags>
<attacks>
<attack name="melee" interval="1000" min="-1500" max="-2350"/>
</attacks>
<defenses armor="0" defense="0"/>
<immunities>
<immunity paralyze="1"/>
<immunity invisible="1"/>
<immunity fire="1"/>
<immunity energy="1"/>
<immunity poison="1"/>
</immunities>
<voices interval="5000" chance="10">
<voice sentence="You wont last long!"/>
<voice sentence="Mmmmh.. braains!"/>
</voices>
<script>
<event name="ZombieThink"/>
<event name="ZombieDeath"/>
</script>
<loot>

</loot>
</monster>[/code]

6. ../data/monster/monsters.xml
XML:
<monster name="Zombie Event" file="zombie_event.xml"/>

Can you update this to where its properly [coded] So I my scripting illiterate eyes can install this please?
 
Get this error, TFS 0.3:

[02/01/2014 06:37:52] [Error - GlobalEvent Interface]
[02/01/2014 06:37:52] data/globalevents/scripts/zombie/onthink.lua:eek:nThink
[02/01/2014 06:37:52] Description:
[02/01/2014 06:37:53] data/lib/zombie_event.lua:123: attempt to index local 'pir' (a number value)
[02/01/2014 06:37:53] stack traceback:
[02/01/2014 06:37:53] data/lib/zombie_event.lua:123: in function 'spawnNewZombie'
[02/01/2014 06:37:53] data/globalevents/scripts/zombie/onthink.lua:6: in function <data/globalevents/scripts/zombie/onthink.lua:1>
[02/01/2014 06:37:53] [Error - GlobalEvents::think] Couldn't execute event: ZombieGlobalThink



What to do? :/


SOLVED
 
Last edited:
Jornthomas, could you explain how you solved it?? =)
Get this error, TFS 0.3:

[02/01/2014 06:37:52] [Error - GlobalEvent Interface]
[02/01/2014 06:37:52] data/globalevents/scripts/zombie/onthink.lua:eek:nThink
[02/01/2014 06:37:52] Description:
[02/01/2014 06:37:53] data/lib/zombie_event.lua:123: attempt to index local 'pir' (a number value)
[02/01/2014 06:37:53] stack traceback:
[02/01/2014 06:37:53] data/lib/zombie_event.lua:123: in function 'spawnNewZombie'
[02/01/2014 06:37:53] data/globalevents/scripts/zombie/onthink.lua:6: in function <data/globalevents/scripts/zombie/onthink.lua:1>
[02/01/2014 06:37:53] [Error - GlobalEvents::think] Couldn't execute event: ZombieGlobalThink



What to do? :/


SOLVED
 
Yes, I can. But not before it has been tested and found 100% free for bugs. Seems to be running perfect so far. I'll re-post in a few days.
I rescripted some by myself and made it on-timer.
 
Read everything from page 1 and found few ppl with the same problem but never the answer

Had the same problem, change your lib to this(include your own config)
Code:
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], stackpos = 253})) == 'number')
    if(ret) then
        addZombiesCount()
    end
    return ret
end
 
i having one problem, i use this script for running automatic zombie event, but when zombie event finish all zombies still in the arena .. when the next event start all zombie again will be in the arena causing bug. Would have to add something in the script when the event was finish the zombies disappear..

can someone help me?

Thanks
Code:
--day_of_week: 0 = Sunday, 1 = Monday ... 6 = Saturday
--hour: value between 0 and 23
--minute: value between 0 and 59
--storage: unique, not used global storage value


local autoStartsTable = {
{["day_of_week"] = 5, ["hour"] = 10, ["minute"] = 35, ["storage"] = 7867},
{["day_of_week"] = 5, ["hour"] = 10, ["minute"] = 45, ["storage"] = 7867}
}

function shouldExecuteEvent(configTable)
for _, config in pairs(configTable) do
if(tonumber(os.date("%d")) ~= getStorage(config.storage) and tonumber(os.date("%w")) == config.day_of_week) then
if(tonumber(os.date("%H")) == config.hour and tonumber(os.date("%M")) == config.minute) then
doSetStorage(config.storage, tonumber(os.date("%d")))
return true
end
end
end
return false
end

function onThink(interval, lastExecution, thinkInterval)
if(shouldExecuteEvent(autoStartsTable)) then
if(getStorage(ZE_STATUS) ~= 1 and getStorage(ZE_STATUS) ~= 2) then
removeZombiesEventBlockEnterPosition()
doSetStorage(ZE_STATUS, 1)
doBroadcastMessage("Zombie Arena Event teleport will be open for 2 minutes. We are waiting for " .. getZombiesEventPlayersLimit() - #getZombiesEventPlayers() .. " players to start.")
addEvent(startArenaEvent, 120 * 1000)
end
end
return true
end

function startArenaEvent()
if(getStorage(ZE_STATUS) == 1) then
addZombiesEventBlockEnterPosition()
doSetStorage(ZE_STATUS, 2)
doBroadcastMessage("Zombie Arena Event started.")
end

end
 
can anyone help me i'm using Rev 3778 0.4 and for some reason when the zombie spawns it is attacking me and killing me instead of teleporting me

this is my data/lib/zombie_event.lua

Code:
-- CONFIG
ZE_DEFAULT_NUMBER_OF_PLAYERS = 1
ZE_ACCESS_TO_IGNORE_ARENA = 3
-- POSITIONS
ZE_blockEnterItemPosition = {x= 997, y=995, z=7}
ZE_enterPosition = {x = 710, y = 959, z = 7}
ZE_kickPosition = {x=1003, y=998, z=7}
ZE_spawnFromPosition = {x = 704, y = 953, z = 7}
ZE_spawnToPosition = {x = 717, y = 965, z = 7}
-- ITEM IDS
ZE_blockEnterItemID = 1484
-- STORAGES
-- - player
ZE_isOnZombieArea = 39970
-- - global
ZE_STATUS = 39970 -- =< 0 - off, 1 - waiting for players, 2 - is running
ZE_PLAYERS_NUMBER = 39971
ZE_ZOMBIES_TO_SPAWN = 39972
ZE_ZOMBIES_SPAWNED = 39973
-- 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], stackpos = 253})) == 'number')
    if(ret) then
        addZombiesCount()
    end
    return ret
end

for some reason the "creaturescripts" dont wanna work either ;s like i dont get a console error saying "BOOM you are dead."
 
Back
Top