Creating a light switch

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
Periodiko
Posts: 19
Joined: Fri Oct 19, 2012 2:45 am

Creating a light switch

Post by Periodiko »

I've been having some problems with dynamic light sources, and I was wondering if someone could help.

I'm trying to implement some dynamic light sources that can be turned off and on by scripts. The important part is that the light status must persist between saving and loading. Generating an fx object via a spawn script or direct placement then destroying the fx object when the light is off doesn't work, because fx objects do not record to saved data. Further, creating Lightsource objects like the temple_ceiling_lamp objects, and tweaking them via fx functions doesn't seem to work either - it crashes the script editor/game.

I feel like I have to be missing an obvious solution.

Oh, one other question: I created some custom light source objects, and one thing I noticed was they flicker slightly. Is there some setting that controls whether lights flicker? Brightness perhaps?
Batty
Posts: 509
Joined: Sun Apr 15, 2012 7:04 pm

Re: Creating a light switch

Post by Batty »

You should be able to use spawn(object, level, x, y, facing, ID) and destroy() with your LightSource objects to add/remove on the fly and persist through saves. As for the flickering, I know that's been discussed elsewhere so do a flicker search. 8-)
Periodiko
Posts: 19
Joined: Fri Oct 19, 2012 2:45 am

Re: Creating a light switch

Post by Periodiko »

Well, regardless, I just discovered that Lightsource objects have a different set of functions from fx objects, including a very simple Activate() Deactivate(), so I feel like a dummy. I'm not sure what you describe specifically would work with fx objects, though - I'm pretty sure spawned fx objects do not get saved, which was how I was doing some of the lights.
Post Reply