Jump to content

1 switch activating multiple lights/doors?


Messmer

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...