Help with find monster script please

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
User avatar
HypnoToad
Posts: 70
Joined: Thu Sep 22, 2016 1:19 am
Location: Melbourne, Australia

Help with find monster script please

Post by HypnoToad » Thu Nov 22, 2018 10:30 pm

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?
Return of the Dark Lord - V3.5 Download:
https://www.nexusmods.com/grimrock/mods ... escription

Zo Kath Ra
Posts: 726
Joined: Sat Apr 21, 2012 9:57 am
Location: Germany

Re: Help with find monster script please

Post by Zo Kath Ra » Fri Nov 23, 2018 12:01 am

Does this work?

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 
x

User avatar
HypnoToad
Posts: 70
Joined: Thu Sep 22, 2016 1:19 am
Location: Melbourne, Australia

Re: Help with find monster script please

Post by HypnoToad » Fri Nov 23, 2018 12:38 am

Zo Kath Ra wrote:
Fri Nov 23, 2018 12:01 am
Does this work?

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 
x
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. :)

Oh silly me, I had "for monsters in .........", duh. :roll:
Return of the Dark Lord - V3.5 Download:
https://www.nexusmods.com/grimrock/mods ... escription

Post Reply