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

Event doesn't work

Xyzyk

RudziutOTS Maker
Joined
Jun 14, 2008
Messages
39
Reaction score
0
Location
Poland
Hello, I have problem with my event in npc script;
this is part of this one:
function cleancave(param)

for cavex = 144, 155 do
for cavey = 816, 826 do
cavepos = {x=cavex, y=cavey, z=8, stackpos=253}

monster = getCreatureByName('Death')
if (getCreaturePosition(monster) == cavepos) then
doRemoveCreature(monster)
grave = {x=149, y=818, z=8, stackpos=2}
doRemoveItem(getThingfromPos(grave).uid, 1)
doItemSetAttribute(doCreateItem(4392, 1, grave), "aid", 8782)

end
end
end
end

First problem: Even if monster is in this cave(144, 155 corners x / 816, 826 corners y) script working as the creature is not in this cave.

Second problem:
this is error from my server when script try to do function doRemoveCreature(monster)
[05/02/2010 12:32:56] [Error - Npc interface]
[05/02/2010 12:32:56] In a timer event called from:
[05/02/2010 12:32:56] data/npc/scripts/banshee queen.lua:onCreatureSay
[05/02/2010 12:32:57] Description:
[05/02/2010 12:32:57] (luaGetThingPosition) Thing not found

[05/02/2010 12:32:57] [Error - Npc interface]
[05/02/2010 12:32:57] In a timer event called from:
[05/02/2010 12:32:57] data/npc/scripts/banshee queen.lua:onCreatureSay
[05/02/2010 12:32:57] Description:
[05/02/2010 12:32:57] (luaDoRemoveCreature) Creature not found
And this error is repeated 131 times and then stop. I think I know why - the tiles in this cave are 131. (the creature is in this room)
I really need help :rolleyes:.
 
Code:
local oldGraveID = 1406
function cleancave(param)
	local pos = getThingPos(getCreatureByName('Death'))
	for cavex = 144, 155 do
		for cavey = 816, 826 do
			local cpos = {x=cavex, y=cavey, z=8}
			if cpos.x == pos.x and cpos.y == pos.y and cpos.z == pos.z then
				doRemoveCreature(getCreatureByName('Death'))
				doRemoveItem(getTileItemById({x=149, y=818, z=8}, oldGraveID).uid)
				doItemSetAttribute(doCreateItem(4392, 1, {x=149, y=818, z=8}), "aid", 8782)
				return true
			end
		end
	end
end
 
Back
Top