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

Zombie event

bybbzan

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

I need some help from you guys with a Zombie Event script, not whole tho.
I have the globalevent and creaturescript. I think i just need the movements
and maybe some changes aswell.

The event.

The script will launch every 3h. Like "Zombie event will start in 1 minute."
During that minute all players can join by walking on a tile that goes into the arena.
And also during that minute a text will show above that tile like "Zombie!".
Finally when that minute has past you cannot walk on that tile anymore,
you will just bounce back and a orange text will show "You can not enter".
And inside the arena the zombies are spawning every 15 sec. When a zombie hits you you don't die
just get teleported to temple and ofcouse can't enter until next event.
When someone "dies" every player will get an orange message in Default like "There are [amount of players in arena] players left."
When the last player gets hit he/she will be rewarded with a random price.
Also a text will show "[playername] won the event, congratulations."

GLOBALEVENT.
LUA:
local TilePos = {x=1005, y=1000, z=7}
local spawn = {x=1107, y=931, z=7}
 
local from = {x = 1089, y = 922, z =7}
local to = {x = 1124, y = 942, z=7}
 




function onThink(interval, lastExecution, thinkInterval)
	doBroadcastMessage('Deadly Zombie event will start after 3 minutes! The teleport to arena is located in temple.', MESSAGE_EVENT_ADVANCE)
	addEvent(BC2, 1 * 60 * 1000)
	return true
end
 
function BC2()
	doBroadcastMessage('Deadly Zombie event will start after 2 minutes! The teleport to arena is located in temple.', MESSAGE_EVENT_ADVANCE)
	addEvent(BC3, 1 * 60 * 1000)
end
 
function BC3()
	doBroadcastMessage('Deadly Zombie event will start after 1 minutes! The teleport to arena is located in temple. You can\'t enter arena during the event, so hurry up and don\'t be late!', MESSAGE_EVENT_ADVANCE)
	addEvent(BC4, 1 * 60 * 1000)
end
 
function BC4()
	doItemSetAttribute(getTileItemById(TilePos, 11063).uid, 'aid', 7796)
	doBroadcastMessage('The event started and Deadly Zombies are being summoned. Winner is the player who dies last. Good luck!', MESSAGE_EVENT_ADVANCE)
	doSendMagicEffect(TilePos, 6)
	Spawn()
end
 
function Spawn()
	for x = from.x, to.x do
		for y = from.y, to.y do
			local a = getTopCreature({x=x, y=y, z=7}).uid
			if a ~= 0 and isPlayer(a) then
				addEvent(Spawn, 15 * 1000)
				doCreateMonster('Deadly Zombie', spawn)
				doSendMagicEffect(spawn, CONST_ME_TELEPORT)
				return true
			end
		end
	end
	doItemSetAttribute(getTileItemById(TilePos, 11063).uid, 'aid', 7795)
	for _, f in ipairs(getMonstersfromArea(from, to)) do
		doRemoveCreature(f)
		return true
	end
end

CREATURESCRIPT.
LUA:
local temple = {x=1000, y=1000, z=7}
 
local t = {
	items = {11234, 11237, 11238, 2514, 2472, 2470, 7405, 7453, 7431, 6433, 2542, 6391, 3972, 8918, 5903},
	exp = 10000000
}
 
local from = {x = 1089, y = 922, z =7}
local to = {x = 1124, y = 942, z=7}
 
local function f(cid)
	doTeleportThing(cid, temple)
	doSendMagicEffect(temple, CONST_ME_TELEPORT)
	doCreatureAddHealth(cid, getCreatureMaxHealth(cid), CONST_ME_MAGIC_BLUE, TEXTCOLOR_BLUE, true)
end
 
function onPrepareDeath(cid, deathList)
	if isInRange(getThingPos(cid), from, to) then
		if isMonster(deathList[1]) and getCreatureName(deathList[1]):lower() == 'deadly zombie' then
			local n = 0
			for x = from.x, to.x do
				for y = from.y, to.y do
					local f = getTopCreature({x=x, y=y, z=from.z}).uid
					if f ~= 0 and isPlayer(f) then
						n = n + 1
					end
				end
			end
			if n == 1 then
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Congratulations, you won! Enjoy your reward!')
				doBroadcastMessage('Congratulations! ' .. getCreatureName(cid) ..' won Deadly Zombie arena event! This event is over, next event in approximately 2 hours.', MESSAGE_EVENT_ADVANCE)
				if math.random(15) == 1 then
					doPlayerAddExp(cid, t.exp)
				else
					doPlayerAddItem(cid, t.items[math.random(#t.items)], 1)
				end
			else
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You got owned!')
				doBroadcastMessage(getCreatureName(cid) .. ' got owned and was kicked from arena.', MESSAGE_EVENT_ADVANCE)
			end
		elseif isPlayer(deathList[1]) then
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You got owned!')
		end
		f(cid)
		return false
	end
	return true
end

MOVEMENTS.
LUA:
Empty for now.

This is probably not the easiest thing to script. But i'm VERY thankful if someone gives it a try.
Thanks in advance! :p

Bybbzan
 
Back
Top