I have this script that finds monsters on all levels but can't figure out how to change it to find monsters on the current level only.
for x = 1, getMaxLevels() do
for monster in allEntities(x) do
if monster.name == "ogre" then
print( monster.id..":", " on level "..monster.level,"@", "X:"..monster.x, "Y:"..monster.y )
end
end
end
I'm sure it's obvious but I have tried many changes but still comes back with an error, can anyone point me in the right direction?
Help with find monster script please
- Zo Kath Ra
- Posts: 931
- Joined: Sat Apr 21, 2012 9:57 am
- Location: Germany
Re: Help with find monster script please
Does this work?
x
Code: Select all
for monster in allEntities(party.level) do
if monster.name == "ogre" then
print( monster.id..":", " on level "..monster.level,"@", "X:"..monster.x, "Y:"..monster.y )
end
end
Re: Help with find monster script please
Works fine, I thought I tried that but must have had some thing wrong as it came back with the old "global" error, thanks very much.Zo Kath Ra wrote: ↑Fri Nov 23, 2018 12:01 am Does this work?xCode: Select all
for monster in allEntities(party.level) do if monster.name == "ogre" then print( monster.id..":", " on level "..monster.level,"@", "X:"..monster.x, "Y:"..monster.y ) end end
Oh silly me, I had "for monsters in .........", duh.