spawner/spawning problem

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
User avatar
zeltak
Posts: 119
Joined: Fri May 04, 2012 2:33 am

Re: spawner/spawning problem

Post 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.
User avatar
zeltak
Posts: 119
Joined: Fri May 04, 2012 2:33 am

Re: spawner/spawning problem

Post 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.
User avatar
Komag
Posts: 3659
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: spawner/spawning problem

Post 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
Finished Dungeons - complete mods to play
User avatar
zeltak
Posts: 119
Joined: Fri May 04, 2012 2:33 am

Re: spawner/spawning problem

Post 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.
User avatar
Komag
Posts: 3659
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: spawner/spawning problem

Post 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?
Finished Dungeons - complete mods to play
User avatar
zeltak
Posts: 119
Joined: Fri May 04, 2012 2:33 am

Re: spawner/spawning problem

Post 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.
User avatar
zeltak
Posts: 119
Joined: Fri May 04, 2012 2:33 am

Patrol/Swarm ID problem

Post 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?
User avatar
petri
Posts: 1917
Joined: Thu Mar 01, 2012 4:58 pm
Location: Finland

Re: spawner/spawning problem

Post 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.
User avatar
zeltak
Posts: 119
Joined: Fri May 04, 2012 2:33 am

Re: spawner/spawning problem

Post 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.
User avatar
SpiderFighter
Posts: 789
Joined: Thu Apr 12, 2012 4:15 pm

Re: spawner/spawning problem

Post 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.
Post Reply