1 switch activating multiple lights/doors?

Post » Fri May 13, 2011 10:58 am

I have a basic script for getting a switch to trigger a light (will post it at the end). But I have a few questions. I was wondering if there are any tips to getting 1 switch to turn on multiple lights, as well as toggling the glow effects related to them. Also, I'm having trouble actually linking to the light even with a 1-1 connection. I've tried going to the enable parent tab and using select reference in render window, both ways (either selecting the light and trying to ref the switch, or selecting the switch and trying to reference the light, both result in only red crosshairs). I am relatively new to all of this, any help would be greatly appreciated.

edit:after tinkering a bit it seems there is a way to do this without any scripts. but I have a new problem. I am able to assign all the lights I want controlled to use the switch as a parent, but when I hit the switch, it vanishes. o_O



ScriptName LightSwitchScript

ref light

Begin onactivate
if light == 0
set light to GetLinkedRef
endif

if light.GetDisabled
light.Enable
else
light.Disable
endif
Activate
End
User avatar
Amy Melissa
 
Posts: 3390
Joined: Fri Jun 23, 2006 2:35 pm

Post » Fri May 13, 2011 4:43 pm

Take a look at the player homes to see how Bethesda rigged the Themes.

Rather than have your switch directly enabled/disabled, use the switch to enable\disable a marker designated the parent for all the lights you want to control. That way your light switch won't disappear when you turn off the lights.
User avatar
carley moss
 
Posts: 3331
Joined: Tue Jun 20, 2006 5:05 pm

Post » Fri May 13, 2011 10:42 am

You can only choose persistent references (controlled via a checkbox in the "Reference" window) to be enable parents, which is probably why you couldn't select one before.

When it comes to mass enabling or disabling lights, using an enable parent that is the linked reference of the "switch" reference is a good approach, and the script that you posted should work with the correct setup.

P.S. Please use "code" tags when posting scripts. It maintains indentation and forces it to be displayed in a fixed-width font, making it much easier to read.

Cipscis
User avatar
He got the
 
Posts: 3399
Joined: Sat Nov 17, 2007 12:19 pm

Post » Fri May 13, 2011 1:15 pm

I concur with Cipscis, I use XMarkers as enable parents for dozens and dozens of lights within cells (and anything else that needs to be on an enable parent). Works Very well and is simple to setup.

Just take the same script your using now for a single light, but Linked Ref it to an Xmarker instead. Then link all of the lights, light sources, etc to the Xmarker as an Enable parent and you should be off to the races.

Miax
User avatar
Ross Thomas
 
Posts: 3371
Joined: Sat Jul 21, 2007 12:06 am

Post » Fri May 13, 2011 7:41 pm

I concur with Cipscis, I use XMarkers as enable parents for dozens and dozens of lights within cells (and anything else that needs to be on an enable parent). Works Very well and is simple to setup.

Just take the same script your using now for a single light, but Linked Ref it to an Xmarker instead. Then link all of the lights, light sources, etc to the Xmarker as an Enable parent and you should be off to the races.

Miax


I just gave this a shot and if I set the Xmarker to Initially disabled or enabled, the lights all behave right along with it, so I know I have that part set up right. now I'm having trouble with the switch. when I walk up to it I get no 'E' dialog to click it. I have the Xmarker as the Linked Ref in the switch, I have the switch and the marker as Persistent References. I must be doing something pretty basically wrong.

edit:nevermind that last problem, it was an issue with the collision mesh. stupid enclave tunnels... everything is working great, thank you all SO much for the help!
User avatar
Angela
 
Posts: 3492
Joined: Mon Mar 05, 2007 8:33 am

Post » Fri May 13, 2011 4:58 pm

Your switch is probably hidden behind the collision geometry of another tile. Press the F4 button to toggle the collision geometry and take a look. Just move your switch so its geometry isn't behind other geometry and you should be good to go.
User avatar
Genocidal Cry
 
Posts: 3357
Joined: Fri Jun 22, 2007 10:02 pm


Return to Fallout 3