• 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

[Error - CreatureScript Interface]
data/creaturescripts/scripts/zombie/onattack.lua:eek:nStatsChange
Description:
data/creaturescripts/scripts/zombie/onattack.lua:25: bad argument
(table expected, got nil)
 
I have this problem:
Code:
[9:49:00.593] [Error - LuaInterface::loadFile] cannot open data/creaturescripts/scripts/zombie/onthink.lua: No such file or directory
[9:49:00.593] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/zombie/onthink.lua)
[9:49:00.593] cannot open data/creaturescripts/scripts/zombie/onthink.lua: No such file or directory
[9:49:00.593] [Error - LuaInterface::loadFile] cannot open data/creaturescripts/scripts/zombie/onattack.lua: No such file or directory
[9:49:00.593] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/zombie/onattack.lua)
[9:49:00.593] cannot open data/creaturescripts/scripts/zombie/onattack.lua: No such file or directory
[9:49:00.593] [Error - LuaInterface::loadFile] cannot open data/creaturescripts/scripts/zombie/ondeath.lua: No such file or directory
[9:49:00.593] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/zombie/ondeath.lua)
 
ot works fine no errors, but when the players are in the arena its says Zombie Event Startes But no Zombies Apear :S and no error in console so what i can do? please help me :S
 
i'm getting this when killing a monsterzombie 3.jpg

Lua:
function onThink(interval, lastExecution, thinkInterval)
	if(getStorage(ZE_STATUS) == 2) then
		setZombiesToSpawnCount(getZombiesToSpawnCount()+1)
		local players = getZombiesEventPlayers()
		for i=1, getZombiesToSpawnCount() * 2 do
			if(getZombiesToSpawnCount() > 0 and spawnNewZombie()) then
				setZombiesToSpawnCount(getZombiesToSpawnCount()-1)
			end
		end
	end
	return true
end


Otherwise it works but that will sooner or later crash the server i think, can you help me with it?
 
Last edited:
I don't like scripts where teleports appear, because something (player,monster, m-wall...) can block this position and teleport doesn't appear :(

--------------------------------------------------------------

Yes :)
Create ../data/globalevents/scripts/zombie/onstartup_autostart.lua and paste:
Lua:
function onStartup()
	doSetStorage(45267, os.time()+300)
	doSetStorage(45268, 0)
	return true
end

Create ../data/globalevents/scripts/zombie/onthink_autostart.lua and paste:
Lua:
local autoStartInterval = 60 -- time between arenas in minutes, default 60 = 1 hour

function onThink(interval, lastExecution, thinkInterval)
	if(getStorage(ZE_STATUS) ~= 2) then
		if(getStorage(45267)+autoStartInterval*60 <= os.time() and getStorage(45268) ~= 1) then
			doSetStorage(45268, 1)
			removeZombiesEventBlockEnterPosition()
			doSetStorage(ZE_STATUS, 1)
			doBroadcastMessage("Zombie Arena Event teleport will be opened for 2 minutes. We are waiting for " .. getZombiesEventPlayersLimit() - #getZombiesEventPlayers() .. " players to start.")
		elseif(getStorage(45267)+autoStartInterval*60+120 <= os.time() and getStorage(45268) == 1) then
			addZombiesEventBlockEnterPosition()
			doSetStorage(45268, 0)
			doSetStorage(ZE_STATUS, 2)
			doSetStorage(45267, os.time())
			doBroadcastMessage("Zombie Arena Event started.")
		end
	end
	return true
end

In ../data/globalevents/globalevents.xml add:
XML:
<globalevent name="ZombieGlobalThink_AutoStart" interval="5" event="script" value="zombie/onthink_autostart.lua"/>
<globalevent name="ZombieGlobalStartup_AutoStart" type="start" event="script" value="zombie/onstartup_autostart.lua"/>

cant get this work :( no errors or nothing 0.3.6
 
Hey PhoOwned) i wanna ask you something man!
Which script of them controls zombie Appearing?!
This check if it should spawn and how many zombies:
6. ../data/globalevents/scripts/zombie/onthink.lua
Lua:
function onThink(interval, lastExecution, thinkInterval)
	if(getStorage(ZE_STATUS) == 2) then
		setZombiesToSpawnCount(getZombiesToSpawnCount()+1)
		local players = getZombiesEventPlayers()
		for i=1, getZombiesToSpawnCount() * 2 do
			if(getZombiesToSpawnCount() > 0 and spawnNewZombie()) then
				setZombiesToSpawnCount(getZombiesToSpawnCount()-1)
			end
		end
	end
	return true
end
and in:
7. ../data/lib/zombie_event.lua
Lua:
-- CONFIG
ZE_DEFAULT_NUMBER_OF_PLAYERS = 5
ZE_ACCESS_TO_IGNORE_ARENA = 3
-- POSITIONS
ZE_blockEnterItemPosition = {x= 873, y=997, z=7}
ZE_enterPosition = {x = 1638, y = 1530, z = 7}
ZE_kickPosition = {x=874, y=994, z=7}
ZE_spawnFromPosition = {x = 1617, y = 1514, z = 7}
ZE_spawnToPosition = {x = 1671, y = 1565, z = 7}
-- ITEM IDS
ZE_blockEnterItemID = 2700
-- 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
is function:
spawnNewZombie()
which spawns zombies
 
I'm having this error as many others:
Code:
[22:2:32.603] data/lib/zombie_event.lua:104: bad argument #2 to 'random' (interval is empty)
[22:2:32.603] stack traceback:
[22:2:32.603]   [C]: in function 'random'
[22:2:32.603]   data/lib/zombie_event.lua:104: in function 'spawnNewZombie'
[22:2:32.603]   data/globalevents/scripts/zombie/onthink.lua:6: in function <data/globalevents/scripts/zombie/onthink.lua:1>
[22:2:32.603] [Error - GlobalEvents::think] Couldn't execute event: ZombieGlobalThink
What's wrong?
 
how do i make the zombie can attack players as normal monster and if zombie killed the player. player get teleported to temple without lossing anything and the event continue till somebody wins
 
This work safely for 0.4, and does anyone have a map for this? For example the one used in the video?
 
Back
Top