This function prints 'not nil' but it wont print 'looping' and I dont get why. Also, how would one target a monster inside the spectate (monsters) and get the monsters health? As the monsters[v] is simple a number/id.
Lua:
function startup(level)
local setArea = nil
local lizardDungeon = {
[1] = {tpPos = {x = 1937, y = 859, z = 12}, specPos = {x = 1904, y = 879, z = 12}, specAreaY = 60, specAreaX = 40},
[2] = {tpPos = {x = 2062, y = 859, z = 12}, specPos = {x = 2029, y = 879, z = 12}, specAreaY = 60, specAreaX = 40},
[3] = {tpPos = {x = 2190, y = 859, z = 12}, specPos = {x = 2157, y = 879, z = 12}, specAreaY = 60, specAreaX = 40},
}
for i = 1, #lizardDungeon do
local sP = getSpectators(lizardDungeon[i].specPos, lizardDungeon[i].specAreaX, lizardDungeon[i].specAreaY, true, true)
if sP == nil then
setArea = i
break
end
end
local monsters = Game.getSpectators(lizardDungeon[setArea].specPos, true, false, lizardDungeon[setArea].specAreaX, lizardDungeon[setArea].specAreaY)
if monsters ~= nil then
print("not nil")
for v = 1, #monsters do
print("looping")
if isMonster(monsters[v]) then
getCreatureHealth(monsters[v])
print("suck me dack")
print(monsters[v]:getName())
end
end
end
player:teleportTo(lizardDungeon[setArea].tpPos)
end