• 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

Fixed Error

data/lib/032-position.lua:2: in function 'isInRange'


Lua:
function isInRange(pos, fromPosition, toPosition)
        return (position.x >= fromPosition.x and position.y >= fromPosition.y and position.z >= fromPosition.z and position.x <= toPosition.x and position.y <= toPosition.y and position.z <= toPosition.z)
end

to


Lua:
function isInRange(position, fromPosition, toPosition)
        return (position.x >= fromPosition.x and position.y >= fromPosition.y and position.z >= fromPosition.z and position.x <= toPosition.x and position.y <= toPosition.y and position.z <= toPosition.z)
end
 
Hello, I have a question.

if zombie attacks player he loses and goes to kick position

I want to disable it, the players must fight with the zombies until the player dies, so then they are teleported to kick position.

A lot of knight want to participate of the event, but with "melee combat" this was impossible.

Can someone help me?

Thanks!
 
hello
its working good with me
but after some time the server crashes
and how can i edit it so when a player lose he dont lose lvl or skills
 
Working great on my tfs 0.3.6, 8.60.
You should add talkaction to reset/stop event(set players storage to 0 and kick all players, if there are any. set event storages to 0 etc.)
Tried by myself, but made wrong.
ty for zombie event :)
 
my zombies wont spawn !!?!?!?
and I cant spawn them.
so event goes on after I restart server also
 
Everything work correctly exept zombie event do not respawn Loolzz!!

nevermind fixed :D

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

butt when the event starts like 90 Monster zombie event are summoned Loolzzz!! It's impossible to run .... I think i need a QUERY for Database (storage or something)

Please Help....

Ps :maybe something like this

alter table ' player storage'
SET `value` = 0 WHERE `key` = " .. ZE_isOnZombieArea .. ";") << I think this is the cause why respawn many zombies it's impossible to move you lose automatically

kind regards , Yisuschrist
 
Last edited:
Everything work correctly exept zombie event do not respawn Loolzz!!

nevermind fixed :D

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

butt when the event starts like 90 Monster zombie event are summoned Loolzzz!! It's impossible to run .... I think i need a QUERY for Database (storage or something)

Please Help....

Ps :maybe something like this

alter table ' player storage'
SET `value` = 0 WHERE `key` = " .. ZE_isOnZombieArea .. ";") << I think this is the cause why respawn many zombies it's impossible to move you lose automatically

kind regards , Yisuschrist

Dump... just change 5 to 50 in globalevent :)
 
Im running 0.3.7 3777
when i want to start the event (/lms) i get the red-text that "zome event lala have started waiting for..."
but the tree is not removed.
And even if i remove it with /r, im the only one who can enter the arena (with gm char).. Whats wrong? I'll rep+++ for help!
 
Updated:
I now have the event working, spawning zombies, but now instead of being kicked when you get attacked, I need it to where you MUST kill all zombies and the remaining players all get prizes if they survive X amounts of spawn waves

- - - Updated - - -

just change statschange to prepare death

Can you explain that one a little better?? to make the script so you MUST fight and KILL all zombies. This is done in the onattack.lua correct?
Code:
function loseOnZombieArena(cid)
	kickPlayerFromZombiesArea(cid)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "BOOM! You are dead.")
	local players = getZombiesEventPlayers()
	if(#players <= 1) then
		local winner = players[1]
		if(winner) then
			doPlayerAddItem(winner, 2157, 25, true)
			doPlayerAddItem(winner, 9969, 1, true)
			doPlayerSendTextMessage(winner, MESSAGE_STATUS_CONSOLE_BLUE, "You won zombies arena event.")
			doBroadcastMessage("After " .. os.time() - getPlayerZombiesEventStatus(winner) .. " seconds of fight " .. getCreatureName(winner) .. " won Zombie Arena Event in game versus " .. getStorage(ZE_ZOMBIES_SPAWNED) .. " zombies!")
			kickPlayerFromZombiesArea(winner)
		else
			doBroadcastMessage("Zombie arena event finished! No one win?!?!?! WTF!")
		end
		doSetStorage(ZE_STATUS, 0)
		doSetStorage(ZE_PLAYERS_NUMBER, ZE_DEFAULT_NUMBER_OF_PLAYERS)
		doSetStorage(ZE_ZOMBIES_TO_SPAWN, 0)
		doSetStorage(ZE_ZOMBIES_SPAWNED, 0)
		local width = (math.max(ZE_spawnFromPosition.x, ZE_spawnToPosition.x) - math.min(ZE_spawnFromPosition.x, ZE_spawnToPosition.x)) / 2 + 1
		local height = (math.max(ZE_spawnFromPosition.y, ZE_spawnToPosition.y) - math.min(ZE_spawnFromPosition.y, ZE_spawnToPosition.y)) / 2 + 1
		local centerPos = {x=math.min(ZE_spawnFromPosition.x, ZE_spawnToPosition.x)+width,y=math.min(ZE_spawnFromPosition.y, ZE_spawnToPosition.y)+height,z=ZE_spawnFromPosition.z}
		for z = math.min(ZE_spawnFromPosition.z, ZE_spawnToPosition.z), math.max(ZE_spawnFromPosition.z, ZE_spawnToPosition.z) do
			centerPos.z = z
			for i, uid in pairs(getSpectators(centerPos, width, height, false)) do
				if(isMonster(uid)) then
					doRemoveCreature(uid)
				end
			end
		end
	end
end
 
function onStatsChange(target, cid, changetype, combat, value)
	if((cid and isMonster(cid) and getCreatureName(cid) == "Zombie Event") or (isInRange(getThingPosition(target), ZE_spawnFromPosition, ZE_spawnToPosition) and changetype == STATSCHANGE_HEALTHLOSS and math.abs(value) >= getCreatureHealth(target))) then
		doCreatureAddHealth(target, getCreatureMaxHealth(target))
		loseOnZombieArena(target)
		return false
	end
	return true
end
 
Last edited:
Updated:
I now have the event working, spawning zombies, but now instead of being kicked when you get attacked, I need it to where you MUST kill all zombies and the remaining players all get prizes if they survive X amounts of spawn waves

- - - Updated - - -



Can you explain that one a little better?? to make the script so you MUST fight and KILL all zombies. This is done in the onattack.lua correct?
Code:
function loseOnZombieArena(cid)
	kickPlayerFromZombiesArea(cid)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "BOOM! You are dead.")
	local players = getZombiesEventPlayers()
	if(#players <= 1) then
		local winner = players[1]
		if(winner) then
			doPlayerAddItem(winner, 2157, 25, true)
			doPlayerAddItem(winner, 9969, 1, true)
			doPlayerSendTextMessage(winner, MESSAGE_STATUS_CONSOLE_BLUE, "You won zombies arena event.")
			doBroadcastMessage("After " .. os.time() - getPlayerZombiesEventStatus(winner) .. " seconds of fight " .. getCreatureName(winner) .. " won Zombie Arena Event in game versus " .. getStorage(ZE_ZOMBIES_SPAWNED) .. " zombies!")
			kickPlayerFromZombiesArea(winner)
		else
			doBroadcastMessage("Zombie arena event finished! No one win?!?!?! WTF!")
		end
		doSetStorage(ZE_STATUS, 0)
		doSetStorage(ZE_PLAYERS_NUMBER, ZE_DEFAULT_NUMBER_OF_PLAYERS)
		doSetStorage(ZE_ZOMBIES_TO_SPAWN, 0)
		doSetStorage(ZE_ZOMBIES_SPAWNED, 0)
		local width = (math.max(ZE_spawnFromPosition.x, ZE_spawnToPosition.x) - math.min(ZE_spawnFromPosition.x, ZE_spawnToPosition.x)) / 2 + 1
		local height = (math.max(ZE_spawnFromPosition.y, ZE_spawnToPosition.y) - math.min(ZE_spawnFromPosition.y, ZE_spawnToPosition.y)) / 2 + 1
		local centerPos = {x=math.min(ZE_spawnFromPosition.x, ZE_spawnToPosition.x)+width,y=math.min(ZE_spawnFromPosition.y, ZE_spawnToPosition.y)+height,z=ZE_spawnFromPosition.z}
		for z = math.min(ZE_spawnFromPosition.z, ZE_spawnToPosition.z), math.max(ZE_spawnFromPosition.z, ZE_spawnToPosition.z) do
			centerPos.z = z
			for i, uid in pairs(getSpectators(centerPos, width, height, false)) do
				if(isMonster(uid)) then
					doRemoveCreature(uid)
				end
			end
		end
	end
end
 
function onStatsChange(target, cid, changetype, combat, value)
	if((cid and isMonster(cid) and getCreatureName(cid) == "Zombie Event") or (isInRange(getThingPosition(target), ZE_spawnFromPosition, ZE_spawnToPosition) and changetype == STATSCHANGE_HEALTHLOSS and math.abs(value) >= getCreatureHealth(target))) then
		doCreatureAddHealth(target, getCreatureMaxHealth(target))
		loseOnZombieArena(target)
		return false
	end
	return true
end

BUMP!, anyone? pls?
 
do u can use the script on 2.15 also i have no data/lib on my server can i use global.lua instand?
 
Updated:
I now have the event working, spawning zombies, but now instead of being kicked when you get attacked, I need it to where you MUST kill all zombies and the remaining players all get prizes if they survive X amounts of spawn waves

- - - Updated - - -



Can you explain that one a little better?? to make the script so you MUST fight and KILL all zombies. This is done in the onattack.lua correct?
Code:
function loseOnZombieArena(cid)
	kickPlayerFromZombiesArea(cid)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "BOOM! You are dead.")
	local players = getZombiesEventPlayers()
	if(#players <= 1) then
		local winner = players[1]
		if(winner) then
			doPlayerAddItem(winner, 2157, 25, true)
			doPlayerAddItem(winner, 9969, 1, true)
			doPlayerSendTextMessage(winner, MESSAGE_STATUS_CONSOLE_BLUE, "You won zombies arena event.")
			doBroadcastMessage("After " .. os.time() - getPlayerZombiesEventStatus(winner) .. " seconds of fight " .. getCreatureName(winner) .. " won Zombie Arena Event in game versus " .. getStorage(ZE_ZOMBIES_SPAWNED) .. " zombies!")
			kickPlayerFromZombiesArea(winner)
		else
			doBroadcastMessage("Zombie arena event finished! No one win?!?!?! WTF!")
		end
		doSetStorage(ZE_STATUS, 0)
		doSetStorage(ZE_PLAYERS_NUMBER, ZE_DEFAULT_NUMBER_OF_PLAYERS)
		doSetStorage(ZE_ZOMBIES_TO_SPAWN, 0)
		doSetStorage(ZE_ZOMBIES_SPAWNED, 0)
		local width = (math.max(ZE_spawnFromPosition.x, ZE_spawnToPosition.x) - math.min(ZE_spawnFromPosition.x, ZE_spawnToPosition.x)) / 2 + 1
		local height = (math.max(ZE_spawnFromPosition.y, ZE_spawnToPosition.y) - math.min(ZE_spawnFromPosition.y, ZE_spawnToPosition.y)) / 2 + 1
		local centerPos = {x=math.min(ZE_spawnFromPosition.x, ZE_spawnToPosition.x)+width,y=math.min(ZE_spawnFromPosition.y, ZE_spawnToPosition.y)+height,z=ZE_spawnFromPosition.z}
		for z = math.min(ZE_spawnFromPosition.z, ZE_spawnToPosition.z), math.max(ZE_spawnFromPosition.z, ZE_spawnToPosition.z) do
			centerPos.z = z
			for i, uid in pairs(getSpectators(centerPos, width, height, false)) do
				if(isMonster(uid)) then
					doRemoveCreature(uid)
				end
			end
		end
	end
end
 
function onStatsChange(target, cid, changetype, combat, value)
	if((cid and isMonster(cid) and getCreatureName(cid) == "Zombie Event") or (isInRange(getThingPosition(target), ZE_spawnFromPosition, ZE_spawnToPosition) and changetype == STATSCHANGE_HEALTHLOSS and math.abs(value) >= getCreatureHealth(target))) then
		doCreatureAddHealth(target, getCreatureMaxHealth(target))
		loseOnZombieArena(target)
		return false
	end
	return true
end

BUMP again
 
This sucks full of bugs :D!

[21/08/2013 20:52:48] [Error - LuaScriptInterface::loadFile] cannot open data/talkactions/scripts/zombie/onsay.lua: No such file or directory
[21/08/2013 20:52:48] [Warning - Event::loadScript] Cannot load script (data/talkactions/scripts/zombie/onsay.lua)
[21/08/2013 20:52:48] cannot open data/talkactions/scripts/zombie/onsay.lua: No such file or directory
[21/08/2013 20:52:48] [Error - LuaScriptInterface::loadFile] data/movements/scripts/zombie/onenter.lua:20: 'end' expected (to close 'function' at line 1) near '<eof>'
[21/08/2013 20:52:48] [Warning - Event::loadScript] Cannot load script (data/movements/scripts/zombie/onenter.lua)
[21/08/2013 20:52:48] data/movements/scripts/zombie/onenter.lua:20: 'end' expected (to close 'function' at line 1) near '<eof>'


[21/08/2013 20:52:54] [Error - GlobalEvent Interface]
[21/08/2013 20:52:54] data/globalevents/scripts/zombie/onstartup.lua:eek:nStartup
[21/08/2013 20:52:54] Description:
[21/08/2013 20:52:54] data/globalevents/scripts/zombie/onstartup.lua:7: attempt to call global 'addZombiesEventBlockEnterPosition' (a nil value)
[21/08/2013 20:52:54] stack traceback:
[21/08/2013 20:52:54] data/globalevents/scripts/zombie/onstartup.lua:7: in function <data/globalevents/scripts/zombie/onstartup.lua:1>
#

I fixed movements for you !

PHP:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
	if(not isPlayer(cid)) then
		return true
	end
	if(getPlayerAccess(cid) >= ZE_ACCESS_TO_IGNORE_ARENA) then
		addPlayerToZombiesArea(cid)
	elseif(#getZombiesEventPlayers() < getZombiesEventPlayersLimit() and getStorage(ZE_STATUS) == 1) then
		addPlayerToZombiesArea(cid)
		local players_on_arena_count = #getZombiesEventPlayers()
		if(players_on_arena_count == getZombiesEventPlayersLimit()) then
			addZombiesEventBlockEnterPosition()
			doSetStorage(ZE_STATUS, 2)
			doBroadcastMessage("Zombie Arena Event started.")
		else
			doBroadcastMessage(getCreatureName(cid) .. " has entered a Zombie Arena. We still need " .. getZombiesEventPlayersLimit() - players_on_arena_count .. " players.")
		end
	else
		doTeleportThing(cid, fromPosition, true)
		addZombiesEventBlockEnterPosition()
		end
		return true
	end
 
Updated:
I now have the event working, spawning zombies, but now instead of being kicked when you get attacked, I need it to where you MUST kill all zombies and the remaining players all get prizes if they survive X amounts of spawn waves

- - - Updated - - -




Can you explain that one a little better?? to make the script so you MUST fight and KILL all zombies. This is done in the onattack.lua correct?
Code:
function loseOnZombieArena(cid)
	kickPlayerFromZombiesArea(cid)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "BOOM! You are dead.")
	local players = getZombiesEventPlayers()
	if(#players <= 1) then
		local winner = players[1]
		if(winner) then
			doPlayerAddItem(winner, 2157, 25, true)
			doPlayerAddItem(winner, 9969, 1, true)
			doPlayerSendTextMessage(winner, MESSAGE_STATUS_CONSOLE_BLUE, "You won zombies arena event.")
			doBroadcastMessage("After " .. os.time() - getPlayerZombiesEventStatus(winner) .. " seconds of fight " .. getCreatureName(winner) .. " won Zombie Arena Event in game versus " .. getStorage(ZE_ZOMBIES_SPAWNED) .. " zombies!")
			kickPlayerFromZombiesArea(winner)
		else
			doBroadcastMessage("Zombie arena event finished! No one win?!?!?! WTF!")
		end
		doSetStorage(ZE_STATUS, 0)
		doSetStorage(ZE_PLAYERS_NUMBER, ZE_DEFAULT_NUMBER_OF_PLAYERS)
		doSetStorage(ZE_ZOMBIES_TO_SPAWN, 0)
		doSetStorage(ZE_ZOMBIES_SPAWNED, 0)
		local width = (math.max(ZE_spawnFromPosition.x, ZE_spawnToPosition.x) - math.min(ZE_spawnFromPosition.x, ZE_spawnToPosition.x)) / 2 + 1
		local height = (math.max(ZE_spawnFromPosition.y, ZE_spawnToPosition.y) - math.min(ZE_spawnFromPosition.y, ZE_spawnToPosition.y)) / 2 + 1
		local centerPos = {x=math.min(ZE_spawnFromPosition.x, ZE_spawnToPosition.x)+width,y=math.min(ZE_spawnFromPosition.y, ZE_spawnToPosition.y)+height,z=ZE_spawnFromPosition.z}
		for z = math.min(ZE_spawnFromPosition.z, ZE_spawnToPosition.z), math.max(ZE_spawnFromPosition.z, ZE_spawnToPosition.z) do
			centerPos.z = z
			for i, uid in pairs(getSpectators(centerPos, width, height, false)) do
				if(isMonster(uid)) then
					doRemoveCreature(uid)
				end
			end
		end
	end
end
 
function onStatsChange(target, cid, changetype, combat, value)
	if((cid and isMonster(cid) and getCreatureName(cid) == "Zombie Event") or (isInRange(getThingPosition(target), ZE_spawnFromPosition, ZE_spawnToPosition) and changetype == STATSCHANGE_HEALTHLOSS and math.abs(value) >= getCreatureHealth(target))) then
		doCreatureAddHealth(target, getCreatureMaxHealth(target))
		loseOnZombieArena(target)
		return false
	end
	return true
end

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
 
Ok Im going to attempt this one last time :S
(1)Can anyone please tell some of us how to make the zombie script so that you MUST fight and kill all zombies.
(2) All remaining players get prizes.
would like zombies to come in several waves but for now the first two parts are most important.
 
Apparently no one is going to make an attempt to help explain this. So much for the open community help thing Mark discussed :S
Come on guys surely someone can explain how to do this?? give some pointers? hell just point me in a right direction and Ill do the work but I have no idea what to do. I think it all has to do with statschange or something but not sure.
 
Back
Top