How verify if there is a monster on a tile ?

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
User avatar
montagneyaya
Posts: 103
Joined: Tue May 01, 2012 11:08 pm

Re: How verify if there is a monster on a tile ?

Post by montagneyaya »

Thanks Lark, finally I resolve the list problem like this

Code: Select all

function OpenAll()
   list_of_gates = {"portcullis_1", "portcullis_2", "portcullis_3"}
   for i =1, #list_of_gates do
      list_of_gates[i]:open()
   end
end
and I agree with Neikun, your script his really awesome.
User avatar
Adrageron
Posts: 203
Joined: Thu Nov 08, 2012 1:22 pm

Re: How verify if there is a monster on a tile ?

Post by Adrageron »

For this purpose I've used hidden pressure plates, wich is triggered only by monsters. But that trick don't work with flyers.
User avatar
montagneyaya
Posts: 103
Joined: Tue May 01, 2012 11:08 pm

Re: How verify if there is a monster on a tile ?

Post by montagneyaya »

I had thought, but I did not use a pressure plate for some reason.
User avatar
Neikun
Posts: 2457
Joined: Thu Sep 13, 2012 1:06 pm
Location: New Brunswick, Canada
Contact:

Re: How verify if there is a monster on a tile ?

Post by Neikun »

Adrageron wrote:For this purpose I've used hidden pressure plates, wich is triggered only by monsters. But that trick don't work with flyers.
If you clone a monster and change flying=true, to false they can effect pressure plates :3
"I'm okay with being referred to as a goddess."
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
  • Message me to join in!
User avatar
Komag
Posts: 3659
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: How verify if there is a monster on a tile ?

Post by Komag »

yeah that's the setting for it, but also keep in mind they will path around pits or fall down them if you open trap doors under them, so only mess with that if there are no pits in the area
Finished Dungeons - complete mods to play
User avatar
Neikun
Posts: 2457
Joined: Thu Sep 13, 2012 1:06 pm
Location: New Brunswick, Canada
Contact:

Re: How verify if there is a monster on a tile ?

Post by Neikun »

..never thought of that one.
Attach an fx to the pit and it'll look like a vacuum! =D
"I'm okay with being referred to as a goddess."
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
  • Message me to join in!
User avatar
montagneyaya
Posts: 103
Joined: Tue May 01, 2012 11:08 pm

Re: How verify if there is a monster on a tile ?

Post by montagneyaya »

Grr..
Finally this

Code: Select all

function OpenAll()
   list_of_gates = {"portcullis_1", "portcullis_2", "portcullis_3"}
   for i =1, #list_of_gates do
      list_of_gates[i]:open()
   end
end
not work

if I use

Code: Select all

function OpenAll()
   list_of_gates = {"portcullis_1", "portcullis_2", "portcullis_3"}
   for i =1, #list_of_gates do
     print(list_of_gates[i])
   end
end
I have

portcullis_1
portcullis_2
portcullis_3

But when I use list_ of_gates.level I have nil
And list_ of_gates:open() I have an error "attempt to call method 'open' (a nil value)"

Apparently variable can't replace entities, how can we use entities in a table ?
User avatar
Xanathar
Posts: 629
Joined: Sun Apr 15, 2012 10:19 am
Location: Torino, Italy
Contact:

Re: How verify if there is a monster on a tile ?

Post by Xanathar »

Because they are just the names, you have to get the original entity:

Code: Select all

function OpenAll()
	local list_of_gates = {"portcullis_1", "portcullis_2", "portcullis_3"}
	for i =1, #list_of_gates do
		local door = findEntity(list_of_gates[i])
		
		if (door == nil) then 
			print("Error: Can't find door ".. list_of_gates[i])
		else
			door:open()
		end
	end
end
should work. Not tested ;)
Waking Violet (Steam, PS4, PSVita, Switch) : http://www.wakingviolet.com

The Sunset Gate [MOD]: viewtopic.php?f=14&t=5563

My preciousss: http://www.moonsharp.org
User avatar
montagneyaya
Posts: 103
Joined: Tue May 01, 2012 11:08 pm

Re: How verify if there is a monster on a tile ?

Post by montagneyaya »

Yes, it's work I had not thought to findEntity, thank you for help.
Post Reply