Jump to content

Reactor or Generator Master Switches


Ninden

Recommended Posts

Hello,

 

I am making a mod which has a fission reactor or generator powering my bunker. I have multiple rooms and halls with separate light systems using the basic light script. They all work perfectly.

 

What I need help with is I would like to make it so that every light activator switch in the mod is controlled by one switch activator, i.e. they are disabled / enabled according to the state of a single master switch. I'm not sure if this is possible with just the basic light script and just setting up the lights and activators properly or if a custom script is needed.

 

Any help is appreciated.

 

Thank you,

Ninden

Edited by Ninden
Link to comment
Share on other sites

OK, I figured out what I needed to do. There is no scripting needed. "Set enable state to opposite of parent" was the key I was looking for. I simply needed to duplicate the switch for a room that already had a working light switch script then set this duplicated switch's "Enable Parent" to the switch I duplicated and check "Set enable state to opposite of parent". I then slide this switch back on top of the parent switch exactly. Both switches need to be set to Persistent. I do that for every room. I then made a main switch for my reactor lighting, sound and radiation and set every rooms switch to have my reactor light set as the parent.

 

This makes it so when the reactor main switch is turned on all the room lights are enabled. When the reactor switch is turned off the rooms working switch is hidden and a light switch which is not connected to any lights takes its place, effectively disabling the lights until the reactor is turned on.

 

Here is the basic light script for reference as well:

 

ScriptName BunkerLightSwitchScript

 

ref light

 

Begin OnActivate

if light == 0

set light to GetLinkedRef

endif

 

if light.GetDisabled

light.Enable

else

light.Disable

endif

Activate

End

 

 

Hope my trial and error to make this work helps somebody else. :)

 

Ninden

Link to comment
Share on other sites

  • Recently Browsing   0 members

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