1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
function occupied(x,y,monsterid) for n, m in pairs (MONSTERS) do if monsterid ~= n and math.sqrt(math.pow(math.abs(m.x-x),2) + math.pow(math.abs(m.y-y),2)) <= m.size then return true end end return false end
function occupied(x,y,monsterid) for n, m in pairs (MONSTERS) do if monsterid ~= n and math.sqrt(math.pow(math.abs(m.x-x),2) + math.pow(math.abs(m.y-y),2)) <= m.size then return true end end return false end
LUA ERROR: sys/lua/cs2dtibia/functions.lua:36: attempt to compare number with nil -> sys/lua/cs2dtibia/functions.lua:36: in function 'occupied' -> sys/lua/cs2dtibia/monsters.lua:1450: in function 'pos' -> sys/lua/cs2dtibia/monsters.lua:1476: in function 'move' -> sys/lua/cs2dtibia/monsters.lua:1428: in function <sys/lua/cs2dtibia/monsters.lua:1354>
LUA ERROR: sys/lua/cs2dtibia/functions.lua:445: attempt to index field '?' (a nil value) -> sys/lua/cs2dtibia/functions.lua:445: in function 'gettile' -> sys/lua/cs2dtibia/monsters.lua:1372: in function <sys/lua/cs2dtibia/monsters.lua:1354>
function gettile(x,y) 	return TILEZONE[y][x] --LINE 445 end
LUA ERROR: sys/lua/cs2dtibia/functions.lua:36: attempt to compare number with nil -> sys/lua/cs2dtibia/functions.lua:36: in function 'occupied' -> sys/lua/cs2dtibia/monsters.lua:1450: in function 'pos' -> sys/lua/cs2dtibia/monsters.lua:1476: in function 'move' -> sys/lua/cs2dtibia/monsters.lua:1428: in function <sys/lua/cs2dtibia/monsters.lua:1354>
function occupied(x,y,monsterid) for n, m in pairs (MONSTERS) do if monsterid ~= n and math.sqrt(math.pow(math.abs(m.x-x),2) + math.pow(math.abs(m.y-y),2)) <= m.size then --LINE 36 return true end end return false end
{ 		name = 'Bulbasaur', health = 100, image = 'gfx/weiwen/pokemon/1.png', scalex = 2, scaley = 2, r = 136, g = 224, b = 32, 		atk = 1.9, def = 2.1, spd = 6, atkspd = 8, x = 0, y = 0, ang = 0, imgang = 0, runat = 0, size = 32, -- HERE 		spawnchance = {['rpg_mapb'] = {5}}, 		spawn = { 			['rpg_mapb'] = {SPAWNS.BOTTOMHALF} 		}, 		exp = 15, money = 100, loot = {{chance = 5000, id = 102}, {chance = 250, id = 221}}, 		spc = {1500, function(self) 			radiusmsg("Bulbasaur casts heal!", self.x, self.y) 			parse("effect \"colorsmoke\" " .. self.x .. " " .. self.y .. " 5 5 255 255 255") 		end}, 	}
LUA ERROR: sys/lua/cs2dtibia/monsters.lua:1413: attempt to index a nil value -> sys/lua/cs2dtibia/monsters.lua:1413: in function <sys/lua/cs2dtibia/monsters.lua:1395>
addhook("ms100", "MONSTERms100") function MONSTERms100() 	t = t + 1 	if t % 100 == 0 then 		while #MONSTERS < CONFIG.MAXMONSTERS do 			local rand, spawnNo, mapName 			while true do 				rand = math.random(#CONFIG.MONSTERS) 				mapName = CONFIG.MONSTERS[rand].spawn[map'name'] and map'name' or CONFIG.DEFAULTMAP 				spawnNo = math.random(#CONFIG.MONSTERS[rand].spawn[mapName]) 				if math.random(0, 100) < CONFIG.MONSTERS[rand].spawnchance[mapName][spawnNo] then 					break 				end 			end 			local m = deepcopy(CONFIG.MONSTERS[rand]) 			local x, y, tilex, tiley 			local spawn = m.spawn[mapName][spawnNo] 			repeat 				tilex, tiley = math.random(spawn[1][1], spawn[2][1]), math.random(spawn[1][2], spawn[2][2]) 			until not gettile(tilex, tiley).SAFE and 																	--LINE 1413 				 not gettile(tilex, tiley).NOMONSTERS and 				 tile(tilex, tiley, "walkable") and 				 tile(tilex, tiley, "frame") ~= 34 			m.x, m.y = math.floor(tilex*32+16), math.floor(tiley*32+16) 			Monster:new(m) 		end 	end 	for _, m in ipairs(MONSTERS) do if t % m.atkspd == 0 then m.target = nil local closest for _, p in ipairs(table.shuffle(player(0, 'table'))) do if player(p, 'health') > 0 and not gettile(PLAYERS[p].x, PLAYERS[p].y).SAFE and not gettile(PLAYERS[p].x, PLAYERS[p].y).NOMONSTERS then local dist = math.sqrt((player(p, 'x')-m.x)^2 + (player(p, 'y')-m.y)^2) if dist < 400 then if not closest or dist < closest[2] then closest = {p, dist} end end end end if closest then local dist = closest[2] if dist < 400 then m.target = closest[1] if m.spc and math.random(10000) <= m.spc[1] then m.spc[2](m, m.target, dist) elseif dist <= (m.range or 32) then m:hit(m.target, 10) end end end end m.imgang = math.sin(t/2.5*math.pi) * 15 if m.target and player(m.target, 'exists') and player(m.target, 'health') > 0 and not gettile(PLAYERS[m.target].x, PLAYERS[m.target].y).SAFE and not gettile(PLAYERS[m.target].x, PLAYERS[m.target].y).NOMONSTERS then xdist, ydist = player(m.target, 'x') - m.x, player(m.target, 'y') - m.y local dist = math.sqrt(xdist^2 + ydist^2) if dist < 400 then m.ang = math.atan2(ydist, xdist)-math.pi/2+math.random(-1, 1)/2 					for k,v in pairs (rotate_to_player) do 						if m.name == v then 							m.imgang = math.deg(math.atan2(ydist, xdist))+90 						end 					end else m.target = nil end end if not m.target then m:rot(math.random(-1, 1)/2) end if not m:move(m:rot(), m.health > m.runat and 1 or -1) then repeat until m:move(math.rad(math.random(360)), 1) end end end
LUA ERROR: sys/lua/cs2dtibia/functions.lua:36: attempt to compare number with nil -> sys/lua/cs2dtibia/functions.lua:36: in function 'occupied' -> sys/lua/cs2dtibia/monsters.lua:1450: in function 'pos' -> sys/lua/cs2dtibia/monsters.lua:1476: in function 'move' -> sys/lua/cs2dtibia/monsters.lua:1428: in function <sys/lua/cs2dtibia/monsters.lua:1354>
function occupied(x,y,monsterid) for n, m in pairs (MONSTERS) do if monsterid ~= n and math.sqrt(math.pow(math.abs(m.x-x),2) + math.pow(math.abs(m.y-y),2)) <= m.size then --LINE 36 return true end end return false end