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

Lua Zombie Error

Majeski20

New Member
Joined
Apr 21, 2008
Messages
602
Reaction score
4
Location
Sweden
Hello :)

Everything seems to work good except this error.
It's when the zombies should be deleted, they dont :(

imagehjm.jpg


Here are globalevent.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

Please help me, i would be very thankful. ;)
Rep for you guys! +
 
I dont think it's hard to search for getMonstersfromArea and add it to your libs, you could've done it days ago
 
put this in lib:
Code:
function getMonstersfromArea(from, to)
	local t = {}
	for x = from.x, to.x
	do
		for y = from.y, to.y
		do
			for z = from.z, to.z -- slower...
			do
				local creature = getTopCreature({x = x, y = y, z = z}).uid
				if isMonster(creature)
				then
					table.insert(t, creature)
				end
			end
		end
	end

	return t
end
 
put this in lib:
Code:
function getMonstersfromArea(from, to)
	local t = {}
	for x = from.x, to.x
	do
		for y = from.y, to.y
		do
			for z = from.z, to.z -- slower...
			do
				local creature = getTopCreature({x = x, y = y, z = z}).uid
				if isMonster(creature)
				then
					table.insert(t, creature)
				end
			end
		end
	end

	return t
end
>mfw line break inb4 then/do
>mfw getTopCreature() - will fail if monsters stack
 
Allright guys, now i got this error.



[Error - GlobalEvent Interface]
[18/05/2011 16:12:10] In a timer event called from:
[18/05/2011 16:12:10] data/globalevents/scripts/deadlyArena.lua onThink
[18/05/2011 16:12:10] Description:
[18/05/2011 16:12:10] (luaDoRemoveCreature) Creature not found
 
Last edited:
Code:
	for _, f in ipairs(getMonstersfromArea(from, to)) do
		doRemoveCreature(f)
		return true
	end
try removing return true
 
Code:
	for _, f in ipairs(getMonstersfromArea(from, to)) do
		doRemoveCreature(f)
		return true
	end
try removing return true

Still same error :(

[24/05/2011 21:05:17] [Error - GlobalEvent Interface]
[24/05/2011 21:05:17] In a timer event called from:
[24/05/2011 21:05:17] data/globalevents/scripts/deadlyArena.lua:onThink
[24/05/2011 21:05:17] Description:
[24/05/2011 21:05:17] (luaDoRemoveCreature) Creature not found

[24/05/2011 21:05:17] [Error - GlobalEvent Interface]
[24/05/2011 21:05:17] In a timer event called from:
[24/05/2011 21:05:17] data/globalevents/scripts/deadlyArena.lua:onThink
[24/05/2011 21:05:17] Description:
[24/05/2011 21:05:17] (luaDoRemoveCreature) Creature not found
 
Back
Top