3 Keys, One Door- Resolved

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
User avatar
pinnguaq
Posts: 15
Joined: Tue Oct 16, 2012 4:33 pm
Location: Pangnirtung, Nunavut
Contact:

3 Keys, One Door- Resolved

Post by pinnguaq »

Hello,

My hope is that this is something basic in the scripting, but I'm having a devil of a time figuring it out. I have 1 door. Beside it are three locks on the wall. (Gold, Ornate and Circle). Spread around the dungeon are the three keys. I want the door to open only once all three keys have been put into their locks. What I am having a hard time figuring out is how to read if the locks have the keys in them. Is there an element in the scripting that will return "True" if the keys have been entered into the locks?

From the scripting reference I see we have this: Lock:setOpenedBy(key)

If I check the status of that, will it return True/False?

Any assistance on this is greatly appreciated.

EDIT: All that is required is a counter- See below.
Last edited by pinnguaq on Wed Oct 17, 2012 4:47 pm, edited 1 time in total.
User avatar
msyblade
Posts: 792
Joined: Fri Oct 12, 2012 4:40 am
Location: New Mexico, USA
Contact:

Re: 3 Keys, One Door

Post by msyblade »

I ran into this (TWICE!) and ended up just making a 3 door combo entry. Each lock does one door, all 3 to pass. Feel cheap and sold out for doing it, but got to move on building immediately :)
Currently conspiring with many modders on the "Legends of the Northern Realms"project.

"You have been captured by a psychopathic diety who needs a new plaything to torture."
Hotel Hades
User avatar
Phitt
Posts: 442
Joined: Tue Aug 14, 2012 9:43 am

Re: 3 Keys, One Door

Post by Phitt »

I've only started with scripting Grimrock, but I would try to do it like this:

1. Add a script

Code: Select all

counter = 0

function count()
	counter = counter + 1
	checkValue()
end

function checkValue()
	if counter == 3 then
	door_1:open()
end
end
2. Connect all three locks to the script and choose the 'count' function.

Didn't test it yet, but I think it should work. door_1 is your door ID of course, so choose whatever your door ID is.

EDIT: Ah, yes, read about counters now and indeed...all you need is a counter.
Last edited by Phitt on Wed Oct 17, 2012 4:44 pm, edited 1 time in total.
User avatar
Soaponarope
Posts: 180
Joined: Thu Oct 04, 2012 3:21 am

Re: 3 Keys, One Door

Post by Soaponarope »

Actually you don't need a script for this at all. Just use a counter.

Have all three locks activate the counter which opens the door. Set the counter at -3.
User avatar
msyblade
Posts: 792
Joined: Fri Oct 12, 2012 4:40 am
Location: New Mexico, USA
Contact:

Re: 3 Keys, One Door

Post by msyblade »

simple and genius, or set to 3 and connecter decrement.
Currently conspiring with many modders on the "Legends of the Northern Realms"project.

"You have been captured by a psychopathic diety who needs a new plaything to torture."
Hotel Hades
Decayer
Posts: 65
Joined: Sat Oct 13, 2012 3:19 pm

Re: 3 Keys, One Door

Post by Decayer »

Make a counter with an initial value of 3, set it to open the door when it is activated. Set the locks to decrement the counter when they are activated. The counter activates when it hits 0.
pinnguaq wrote:From the scripting reference I see we have this: Lock:setOpenedBy(key)

If I check the status of that, will it return True/False?
Nope, it sets the key; it doesn't check it.
User avatar
pinnguaq
Posts: 15
Joined: Tue Oct 16, 2012 4:33 pm
Location: Pangnirtung, Nunavut
Contact:

Re: 3 Keys, One Door

Post by pinnguaq »

Soaponarope wrote:Actually you don't need a script for this at all. Just use a counter.

Have all three locks activate the counter which opens the door. Set the counter at -3.
It is as frustrating as it is satisfying when the answer is so simple. :) Thanks so much.
User avatar
Soaponarope
Posts: 180
Joined: Thu Oct 04, 2012 3:21 am

Re: 3 Keys, One Door- Resolved

Post by Soaponarope »

Sure thing. I know just what you mean by that, I often overlook the small things. :)
Post Reply