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.
3 Keys, One Door- Resolved
3 Keys, One Door- Resolved
Last edited by pinnguaq on Wed Oct 17, 2012 4:47 pm, edited 1 time in total.
Re: 3 Keys, One Door
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
"You have been captured by a psychopathic diety who needs a new plaything to torture."
Hotel Hades
Re: 3 Keys, One Door
I've only started with scripting Grimrock, but I would try to do it like this:
1. Add a script
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.
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
endDidn'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.
- Soaponarope
- Posts: 180
- Joined: Thu Oct 04, 2012 3:21 am
Re: 3 Keys, One Door
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.
Have all three locks activate the counter which opens the door. Set the counter at -3.
Re: 3 Keys, One Door
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
"You have been captured by a psychopathic diety who needs a new plaything to torture."
Hotel Hades
Re: 3 Keys, One Door
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.
Nope, it sets the key; it doesn't check it.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?
Re: 3 Keys, One Door
It is as frustrating as it is satisfying when the answer is so simple.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.
- Soaponarope
- Posts: 180
- Joined: Thu Oct 04, 2012 3:21 am
Re: 3 Keys, One Door- Resolved
Sure thing. I know just what you mean by that, I often overlook the small things. 