Jump to content

Super Simple Light Switch Tutorial Expanded


cain071546

Recommended Posts

Here is my Super Simple Light Switch Tutorial Expanded.

it took me forever to figure this out so maybe this will help people.

 

Here is my original Tutorial.

 

http://forums.nexusmods.com/index.php?/topic/3295971-super-simple-light-switch-tutorial/

 

no persistant references.

no reference ID's.

no new forms required.

 

1 ) Start by placeing a GenElecSwitch01.

 

2 ) then place a xmarker.

 

3 ) then place a light, any light will work.

 

4 ) then place BOTH models (ON and OFF) for the Light Fixture.

 

5 ) connect the switch to the xmarker via LinkedRef.

 

6 ) connect the light to the xmarker via enable parent.

 

7 ) connect the TURNED OFF model of the light fixture to the xmarker via enable parent and set "enable state to opposite of parent"

 

8 ) connect the TURNED ON model of the light fixture to the xmarker via enable parent.

 

9 ) select the xmarker and set to initially disabled.

 

10 ) use this script on the switch.

scn AALIGHTSWITCH1SCRIPT
ref rLinkedRef
Begin OnActivate
if rLinkedRef == 0
set rLinkedRef to GetLinkedRef
endif
if rLinkedRef.GetDisabled
rLinkedRef.Enable 0
else
rLinkedRef.Disable 0
endif
Activate;  only required if the switch uses a default activation action
End

Now you have a light switch that turns a light on and off and switches out the models for the light fixture.

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

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