Mentor wanted?

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
MLE_muse
Posts: 5
Joined: Mon Aug 11, 2014 2:26 am
Location: midwest

Mentor wanted?

Post by MLE_muse »

Hi there, I'm a first time mod creator. I'm totally happy reading all the forums but if anyone would mind being able to help me along if I have specific questions I'd be super appreciative.
Here's my first question:
I have a secret door I want to activate once my three set monsters are killed. Obviously a really long timer will do the trick, but is there an easy lua way to set this?
User avatar
Chimera005ao
Posts: 187
Joined: Sun Jun 29, 2014 8:34 am

Re: Mentor wanted?

Post by Chimera005ao »

Hello, welcome.
Plenty of people around here are willing to help out I'm sure. :)
How I did it was by making a script entity in the editor.
Named my two snails and the door, and had a timer point to the script.

Code: Select all

function roomWatcher()
	--snail room check
	if (not findEntity("snail_1")) and (not findEntity("snail_2")) then
        door_1:open()
   end
I wouldn't mind trying to help, but I've only been at it for a bit more than a month, so my knowledge might be limited. :lol:
MLE_muse
Posts: 5
Joined: Mon Aug 11, 2014 2:26 am
Location: midwest

Re: Mentor wanted?

Post by MLE_muse »

Chimera thank you so much! I tried to insert the code but I get an error notice?

'end' expected (to close 'function' at line 2) near '<eof>' X

I have a feeling it's something dumb that I did wrong with typing but thank you so so much for help and sticking with me!
User avatar
Isaac
Posts: 3190
Joined: Fri Mar 02, 2012 10:02 pm

Re: Mentor wanted?

Post by Isaac »

MLE_muse wrote:Chimera thank you so much! I tried to insert the code but I get an error notice?

'end' expected (to close 'function' at line 2) near '<eof>' X

I have a feeling it's something dumb that I did wrong with typing but thank you so so much for help and sticking with me!
There should be another 'end' statement to close off the function. Just type the word end right after the existing one. It's an extremely easy and common mistake to make; I do it all the time. It helps to use an application that offers error and syntax highlighting to edit your scripts, like Notepad++ or SciTE. In larger scripts, they will make these kinds of mistakes a lot easier to notice.

Code: Select all

    function roomWatcher()
       --snail room check
       if (not findEntity("snail_1")) and (not findEntity("snail_2")) then
            door_1:open()
       end
end
________
An alternate way to do this is to add code to the monster's death event, and use that [hook] code to trigger the event to open the door.

The advantage is one less timer, and that the door's response could always be immediate upon the death of the last monster.

The disadvantage is that it's more work; the monsters should be custom creatures; so that the code in the hook runs only when those specific creatures are killed.

To use snails: place the code in the project's monsters.lua file (reload project), and on the map place or rename a door 'guardedGate'.
Place three gateKeeper snails, and run the preview. To change monster types, change the baseObject value to the name of a different monster.
I've defined health very low, that line can be erased or the value set higher.

Code: Select all

cloneObject {
	name= "gateKeeper",
	baseObject = "snail",
	health = 5,
	onDie = function()
				if gatekeepers == nil then
					spawn("counter", party.level, 1, 1, 1, "gatekeepers")
					else gatekeepers:increment()
				end
				if gatekeepers:getValue() > 1 then
					hudPrint("The doorway opens!")
					guardedGate:open()
					gatekeepers:destroy()
				end
			end,
}
** https://www.dropbox.com/s/zkilkq13dgzju ... 20Gate.zip
User avatar
Komag
Posts: 3659
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: Mentor wanted?

Post by Komag »

The custom monster is, I believe, a much better solution.
Finished Dungeons - complete mods to play
User avatar
Chimera005ao
Posts: 187
Joined: Sun Jun 29, 2014 8:34 am

Re: Mentor wanted?

Post by Chimera005ao »

My mistake, I copied it from a slightly longer script that checks for multiple rooms and deactivates parts so I can reclose the doors XP

I guess that's an advantage of the custom monster part, don't have to worry about it reopening the door after you decide to close it.
And you don't have to name every monster.

I imagine it could get a bit painful if you have multiple monster types for a door, and repeated monsters of the same type for different doors though.
MLE_muse
Posts: 5
Joined: Mon Aug 11, 2014 2:26 am
Location: midwest

Re: Mentor wanted?

Post by MLE_muse »

That makes sense. I'm just trying to think ahead for people who would kill the monsters in different orders. Perhaps just designating levers would be a better option then assigning monsters?
User avatar
Isaac
Posts: 3190
Joined: Fri Mar 02, 2012 10:02 pm

Re: Mentor wanted?

Post by Isaac »

MLE_muse wrote:That makes sense. I'm just trying to think ahead for people who would kill the monsters in different orders. Perhaps just designating levers would be a better option then assigning monsters?
The code that I posted isn't affected by the order they kill the snails. 8-)
Post Reply