What I'm trying to do is have a set number of skeleton patrols patrolling an area almost constantly and I figured out I could use Shroom's little script for checking things in an area. I couldn't figure out how to check how many things are in the given area so I thought I would make a 3 new specific monster for the task and check each one of them individually. So I cloned 3 skeleton patrols.
eg.
Code: Select all
cloneObject{
name = "Patrol_1",
baseObject = "skeleton_patrol",
}
and so on.
Then I added connector from a hidden plate to the lua script.
Shroom's script was this:
Code: Select all
function checkPatrol1()
if checkForThings("Patrol_1",12,21,1,16) then
spawn("Patrol_1", party.level, 13, 15, 1)
end
end
function checkForThings(thing,xMin,xMax,yMin,yMax)
for x = xMin,xMax do
for y = yMin,yMax do
for object in entitiesAt(1,x,y) do
if object.name == thing then
return false
end
end
end
end
return true
end
Problem is that it won't spawn any new Patrol_1's after the initially placed Patrol_1 is dead. In this way or tied to a spawner (eg. I replaced the "spawn" -line with spawner_1:activate() -command). Is there something wrong with the "spawn" -line? When replaced with the spawner activation it doesn't allow me to spawn my new creature type or if I try to spawn a new skeleton_patrol with the name "Patrol_1" it doesn't do that either.