Page 1 of 2
how to spawn a monster only if a certain square is empty?
Posted: Sat Sep 15, 2012 1:32 pm
by Komag
I want to spawn a monster into a "monster closet" but only if there is not already a monster in there and also the party must not be in there (but if there are items in there it's okay.)
I know I can check the contents of a square with a script, but I want items tossed in by the party to not block the spawn, and I'm not quite sure how to set it all up anyway.
Re: how to spawn a monster only if a certain square is empty
Posted: Sat Sep 15, 2012 1:46 pm
by Akatana
Maybe try it with a hidden preasure plate?
Re: how to spawn a monster only if a certain square is empty
Posted: Sat Sep 15, 2012 1:53 pm
by Aazlan
Yep, the hidden pressure plates have check boxes for Triggered by... Party, Items, Monster. Just turn off Items and you should be good to go.
Re: how to spawn a monster only if a certain square is empty
Posted: Sat Sep 15, 2012 2:03 pm
by Komag
okay, that sounds like the best way to go, works great!
Here is my script
Code: Select all
function monstercloset()
if closetplate:isUp() == true then
closetspawn:activate()
end
end
EDIT - changed True to true
Re: how to spawn a monster only if a certain square is empty
Posted: Sat Sep 15, 2012 2:05 pm
by Billick
Komag wrote:okay, that sounds like the best way to go.
Here is my non-working script, how do I fix it?
Code: Select all
function monstercloset()
if closetplate:isUp() == True then
closetspawn:activate()
end
end
booleans have to be all lowercase maybe? Try changing "True" to "true".
Re: how to spawn a monster only if a certain square is empty
Posted: Sat Sep 15, 2012 2:06 pm
by Magus
yeah changing the True to true should work fine.
Re: how to spawn a monster only if a certain square is empty
Posted: Sat Sep 15, 2012 2:09 pm
by Komag
uh oh, flying monsters don't trigger pressure plates! HELP!
Re: how to spawn a monster only if a certain square is empty
Posted: Sat Sep 15, 2012 2:11 pm
by Magus
entitiesAt(level, x, y) i think this function will help you. Maybe add a timer that runs every 0.25 seconds.
EDIT:
I haven't used enemys yet so I don't know if this works but try somthing like this:
for i in entitiesAt(level, x, y) do
if i.name == "NAME OF THE ENEMY" then
...code...
else
...code...
end
end
Re: how to spawn a monster only if a certain square is empty
Posted: Sat Sep 15, 2012 2:14 pm
by Aazlan
How big is the closet? Just 1 square? Then you should be able to connect the plate to that lua script entity, and then just use spawn("your_choice_of_Monster", closet level, closet x, closet y, respawn rate) instead of closetspawn:activate()
Re: how to spawn a monster only if a certain square is empty
Posted: Sat Sep 15, 2012 2:30 pm
by Aazlan
The other option for flying enemies would be to use a blob spawner and a hidden receptor, and have the monster spawn if the blob activates the receptor. Pretty sure monsters block blobs. Otherwise, I'm not sure what you would connect Magus' lua script to exactly, maybe hidden pressure plate and a timer I guess.