Page 2 of 2
Re: How verify if there is a monster on a tile ?
Posted: Thu Nov 15, 2012 4:54 am
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.
Re: How verify if there is a monster on a tile ?
Posted: Thu Nov 15, 2012 10:01 am
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.
Re: How verify if there is a monster on a tile ?
Posted: Thu Nov 15, 2012 11:44 am
by montagneyaya
I had thought, but I did not use a pressure plate for some reason.
Re: How verify if there is a monster on a tile ?
Posted: Thu Nov 15, 2012 12:55 pm
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
Re: How verify if there is a monster on a tile ?
Posted: Thu Nov 15, 2012 1:01 pm
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
Re: How verify if there is a monster on a tile ?
Posted: Thu Nov 15, 2012 1:07 pm
by Neikun
..never thought of that one.
Attach an fx to the pit and it'll look like a vacuum! =D
Re: How verify if there is a monster on a tile ?
Posted: Thu Nov 15, 2012 2:15 pm
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 ?
Re: How verify if there is a monster on a tile ?
Posted: Thu Nov 15, 2012 2:23 pm
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

Re: How verify if there is a monster on a tile ?
Posted: Thu Nov 15, 2012 2:29 pm
by montagneyaya
Yes, it's work I had not thought to findEntity, thank you for help.