• 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 Death?

Majeski20

New Member
Joined
Apr 21, 2008
Messages
602
Reaction score
4
Location
Sweden
Hello.. ^_^

About Zombie event.

The zombies are hitting me down to 0 hp, but i'm not dead, i can still move with 0 hp. But if i enter the teleport that leads to temple i die immediatly.

How can i fix this bug?

creaturescript.lua
Code:
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 config = {
	arena = {
		frompos = {x = 1131, y = 913, z =7},
		topos = {x = 1161, y = 930, z=7}
	}
}

function onPrepareDeath(cid, deathList)
if (isInRange(getCreaturePosition(cid), config.arena.frompos, config.arena.topos)) then
	if (isMonster(deathList[1]) and isPlayer(cid)) then
		if (getCreatureName(deathList[1]) == "Deadly Zombie") then
			if #getPlayersfromArea(config.arena.frompos, config.arena.topos) == 1 then
				doTeleportThing(cid, temple)
				doSendMagicEffect(getCreaturePosition(cid),10)
				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 after approximately 2 hours.", MESSAGE_EVENT_ADVANCE)
				doCreatureAddHealth(cid, getCreatureMaxHealth(cid), CONST_ME_MAGIC_BLUE, TEXTCOLOR_BLUE, true)
				local v = math.random(1, 15)
				if v < 15 then
					doPlayerAddItem(cid, t.items[math.random(#t.items)], 1)
				else
					doPlayerAddExp(cid, t.exp)
				end
			else
				doTeleportThing(cid, temple)
				doSendMagicEffect(getCreaturePosition(cid),10)
				doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You got owned!")
			doBroadcastMessage("".. getCreatureName(cid) .." got owned and was kicked from arena.", MESSAGE_EVENT_ADVANCE)
				doCreatureAddHealth(cid, getCreatureMaxHealth(cid), CONST_ME_MAGIC_BLUE, TEXTCOLOR_BLUE, true)
				return false
			end
		end
		
	elseif isPlayer(deathList[1]) and isPlayer(cid) and isInRange(getCreaturePosition(cid), config.arena.frompos, config.arena.topos) then
		doTeleportThing(cid, temple)
		doSendMagicEffect(getCreaturePosition(cid),10)
		doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You got owned by playa!")
		doCreatureAddHealth(cid, getCreatureMaxHealth(cid), CONST_ME_MAGIC_BLUE, TEXTCOLOR_BLUE, true)
		return false
	end
else
return true
end
	return false
end

login.lua
Code:
	registerCreatureEvent(cid, "onPrepareDeath")
	registerCreatureEvent(cid, "deadlyArena")

creaturescript.xml
HTML:
<event type="preparedeath" name="deadlyArena" event="script" value="deadlyArena.lua"/>

I'll REP YOU! :rolleyes:
Please help.
 
try
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 = 1131, y = 913, z =7}
local to = {x = 1161, y = 930, 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
			if #getPlayersfromArea(from, to) == 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 by playa!')
		end
		f(cid)
		return false
	end
	return true
end
post results/errors
 
It's not working! :(

This error in console.

Code:
[11/05/2011 15:33:21] [Error - CreatureScript Interface] 
[11/05/2011 15:33:21] data/creaturescripts/scripts/deadlyArena.lua:onPrepareDeath
[11/05/2011 15:33:21] Description: 
[11/05/2011 15:33:21] data/creaturescripts/scripts/deadlyArena.lua:20: attempt to call global 'getPlayersfromArea' (a nil value)
[11/05/2011 15:33:21] stack traceback:
[11/05/2011 15:33:21] 	data/creaturescripts/scripts/deadlyArena.lua:20: in function <data/creaturescripts/scripts/deadlyArena.lua:17>
 
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 = 1131, y = 913, z =7}
local to = {x = 1161, y = 930, 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 by playa!')
		end
		f(cid)
		return false
	end
	return true
end
 
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 = 1131, y = 913, z =7}
local to = {x = 1161, y = 930, 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 by playa!')
		end
		f(cid)
		return false
	end
	return true
end

Thanks Cyko that one works, but only this now!

[12/05/2011 07:54:30] [Error - GlobalEvent Interface]
[12/05/2011 07:54:30] In a timer event called from:
[12/05/2011 07:54:30] data/globalevents/scripts/deadlyArena.lua:onThink
[12/05/2011 07:54:30] Description:
[12/05/2011 07:54:30] data/globalevents/scripts/deadlyArena.lua:43: attempt to call global 'getMonstersfromArea' (a nil value)
[12/05/2011 07:54:30] stack traceback:

The zombies are there all the time, they do not get deleted :o!?
 
deadlyArena.lua globalevent??

oh my bad.. :p

globalevents.lua

Code:
local TilePos = {x=1005, y=1002, z=7}
local spawn = {x=1145, y=922, z=7}
 
local from = {x = 1131, y = 913, z =7}
local to = {x = 1161, y = 930, 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, 1387).uid, 'aid', 7796)
	doBroadcastMessage('The event started and Deadly Zombie 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, 20 * 1000)
				doCreateMonster('Deadly Zombie', spawn)
				doSendMagicEffect(spawn, CONST_ME_TELEPORT)
				return true
			end
		end
	end
	doItemSetAttribute(getTileItemById(TilePos, 1387).uid, 'aid', 7795)
	for _, f in ipairs(getMonstersfromArea(from, to)) do
		doRemoveCreature(f)
		return true
	end
end

creaturescript.lua

Code:
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 = 1131, y = 913, z =7}
local to = {x = 1161, y = 930, 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 by playa!')
		end
		f(cid)
		return false
	end
	return true
end
 
Back
Top