Question

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
trancelistic
Posts: 275
Joined: Sat Jun 16, 2012 5:32 am

Question

Post by trancelistic »

Hey all, I've noticed something or I'm just plain stupid as useal.
If I would type a simple check script like:

Code: Select all

function checkPlate()
if plate_1:isDown() == true
then 
door1:open()
end
end
Works just fine.
How to do this with a light source like a ceiling lamp?

The following:

Code: Select all

function checkLamp()
if lamp_1:activated() == true 
then
door_1:open()
end
end
simply does nothing. I also noticed if I ran this script once then I can't even disable the lamp anymore with a button who is on toggle mode.
So what am I doing wrong?
Thanks.
User avatar
Isaac
Posts: 3172
Joined: Fri Mar 02, 2012 10:02 pm

Re: Question

Post by Isaac »

There was some kind of light tracking done in ORRR2 ~nothing by me. I think there wasn't really a lot of control or access to lights.
:lol: Until minmay replies, I would suggest recording the [assumed] state of any lights you are interested in when the game starts, and record whenever they are switched off, or reactivated; and hook into the light and darkness spells [ party:onCastSpell() ], so you can know when they are cast... and update your records.
trancelistic
Posts: 275
Joined: Sat Jun 16, 2012 5:32 am

Re: Question

Post by trancelistic »

I'm a bit confused mate.
What do you mean by: Record it?
User avatar
Isaac
Posts: 3172
Joined: Fri Mar 02, 2012 10:02 pm

Re: Question

Post by Isaac »

trancelistic wrote:I'm a bit confused mate.
What do you mean by: Record it?
I mean make a table of named true/false values that you manually update via script that connect with relevant triggers, and party hooks, so that later you can check to see if a light is on or off.

As in: [snippet]

Code: Select all

lights = {lamp_01 = true, lamp_02 = true, lamp_03 = true, lamp_04 = false, }
Done this way is a hassle, no doubt about it.

I haven't looked at the methods used in ORRR2, but I'd expect that it's something similar.
trancelistic
Posts: 275
Joined: Sat Jun 16, 2012 5:32 am

Re: Question

Post by trancelistic »

Thanks, ill try it:)
Post Reply