Page 2 of 3

Re: spawner/spawning problem

Posted: Mon Sep 17, 2012 11:08 pm
by zeltak
I think, but I'm not sure, that LoG handles warriors and patrols as different monsters altogether. As LoG's skeletons don't merge into patrols as for example in Dungeon Master, warriors never come into same square with each other (except if you spawn them into one apparently :D ). Same goes for other type of "swarm" creatures. At least what I've experienced in the game.

Re: spawner/spawning problem

Posted: Wed Sep 19, 2012 7:29 pm
by zeltak
Ok, now that the spawner bug was corrected I could continue modding the place I wanted to be under constant patrol. But lo, the script keeps spawning patrol_1, whenever I step on the pressure plate, even when it finds the monster on the area. And now I'm lost again, what is wrong in my logic? I tested the scrip also in a new dungeon as I doubted that would the script need to include which level it needs to test, but no, it just keeps spawning them even if there's just one level on the dungeon.

Re: spawner/spawning problem

Posted: Wed Sep 19, 2012 8:43 pm
by Komag
I tested it and I was on level three and it kept spawning no matter what, so I changed a certain "1" to "party.level" and now it works perfectly. Here is my example:

Code: Select all

    function checkPatrol1()
       if checkForThings("snail",26,29,8,11) then
          spawn("snail", party.level, 27, 9, 1)
       end
    end

    function checkForThings(thing,xMin,xMax,yMin,yMax)
       for x = xMin,xMax do
          for y = yMin,yMax do
             for object in entitiesAt(party.level,x,y) do
                if object.name == thing then
                   print("monster found")
                   return false
                end
             end
          end
       end
       return true
    end
I have the pressure plate connected to a timer with a 5 second delay which is then connected to the script. So every 5 seconds the timer triggers the script to run and do the check. I added the "monster found" console message just for testing

Re: spawner/spawning problem

Posted: Thu Sep 20, 2012 4:48 am
by zeltak
Ok, the swarms/patrols are still bugged somehow. I tried the script and was dumbfounded when it acted the same way again, it just kept spawning patrol after patrol. I double checked the script. I changed my custom patrol to vanilla patrol with same results. I changed the patrol to skeleton warrior. NOW IT WORKED! O.O I tried again with patrols and again with swarms, and they just kept coming.. So the game handles those patrols/swarms somehow differently, so that the script doesn't recognise them I presume.

Re: spawner/spawning problem

Posted: Thu Sep 20, 2012 5:23 am
by Komag
hmm, yeah, it must be that. They are unique things, and you kill them one at a time, so when the script does the search it must be coming back with something else.

Have you tried making the script search for the individuals even as you make it spawn the groups?

Re: spawner/spawning problem

Posted: Thu Sep 20, 2012 6:19 am
by zeltak
Yes, that's it! I made my patrols consist of special skeletons and searched for them. Now everything works as they should. Thanks for an advice.

Patrol/Swarm ID problem

Posted: Thu Sep 20, 2012 7:13 am
by zeltak
..but now I've encountered a different problem concerning patrols. I try to change the AI state of one of the skeleton patrols, but it apparently changes the ID of those things O.o

I've used this script succesfully with other non-patrol/swarm creatures, but with these swarm creatures it gives me an error.

Code: Select all

function relPatrols()
	if skelsReleased ~= "true" then
		patrols()
	end
end

function patrols()
	patrol1:setAIState("default")
	patrol2:setAIState("default")
	patrol3:setAIState("default")
	skelsReleased = "true"		
end
	
if gives me the message: "attempt to index global 'patrol1' (a nil value) X
so if I understand correctly it sais that there's no creature with that ID, even if those ID:s are correct. Any suggestions?

Re: spawner/spawning problem

Posted: Thu Sep 20, 2012 7:20 am
by petri
When the game starts monster groups are processed and converted to individual monsters. So the monster group only exists in the editor. If you know the location of the group you can use entitiesAt and find the members of the group that you are looking for.

Re: spawner/spawning problem

Posted: Thu Sep 20, 2012 7:43 am
by zeltak
Thank you for the answer. Now that I paid attention, it even shows that on the map when you test the level (4 creatures merging into one). As I'm not yet familiar enough with entitesAt function, I spawn the creatures instead as that works as well in my case.

Re: spawner/spawning problem

Posted: Thu Nov 29, 2012 3:04 am
by SpiderFighter
petri wrote:When the game starts monster groups are processed and converted to individual monsters. So the monster group only exists in the editor. If you know the location of the group you can use entitiesAt and find the members of the group that you are looking for.
Is there a way to call them in a script? I created a special skeletal warrior and then the patrol from those warriors. I then tried to refer to them individiually (as there are no other examples of them in the map, I assumed they were numerical):
SpoilerShow

Code: Select all

	
function specialPatrolRemove
   special_skeleton_warrior_1:destroy()
	special_skeleton_warrior_2:destroy()
	special_skeleton_warrior_2:destroy()
	special_skeleton_warrior_4:destroy()
end
That didn't work and, of course, niether does trying to destroy the patrol by name. I've tried spawning, scripting a spawn...nothing seems to work, and I'm starting to stress a bit, as this is the main focus of my map.