Re: how to spawn a monster only if a certain square is empty
Posted: Sat Sep 15, 2012 3:03 pm
I'm trying to make the spawn be a few seconds delay, so I use a timer which then triggers a spawner. I don't think I can use a blob because I don't want the party being hit by a blob. I could possible use a combination of a hidden pressure plate to detect the party, and a separate room faraway with a spawner, teleport, and blob, and if the blob hits the receptor the teleport turns on, but that's sorta crazy.
Anyway, here is my code that has a problem, enemies keep getting spawned on top of themselves, but I don't see why?
The testtimer waits a couple seconds then activates the spawner. When I trigger this test script, the gate does NOT immediately open, which is correct, and then two seconds later a wyvern is spawned there, good. Then when I trigger the script again the gate opens, which is correct, so it's correctly reading "wyvern" with the entitiesAt, but then another wyvern gets spawned in there two seconds later! what gives? It's firing the testtimer again, why?
Anyway, here is my code that has a problem, enemies keep getting spawned on top of themselves, but I don't see why?
Code: Select all
function testmonst()
for i in entitiesAt(2, 17, 8) do
if i.name == "wyvern" then
testgate:open()
else
testtimer:activate()
end
end
end