Light Switches - A Easier Method

Post » Tue Jan 01, 2013 8:19 am

the script:

bool bToggle
ObjectReference Property LightBase Auto
Auto STATE Waiting
EVENT onActivate (objectReference triggerRef)
bToggle = !bToggle ; Set Bool to whatever it's not
If bToggle ; True
LightBase.Enable()
Else ; False
LightBase.Disable()
Endif
endEVENT
endState


the script name can be whatever, this is just what mines named.

add a light to your scene, then click edit, set the light to Initially disabled. then click ok and close it out

add a Lever, pull chain, or swtich and right click on it and click edit, then go to the last tab, script, click add, then new, and click ok, type in the name 'simpleSwitch' (or what ever you want it to be) and paste the above into the edit box, then click ok, you should now be back to the script tag, click on the script you just added and click properties.

on the left side you'll see 'lightBase' click that then click edit value. Click 'pick reference in Render Window' and click on the light you added.

click ok.

Congrats you have a working light switch. The light will be initially off when the cell loads, you click the switch and the light will come on, click it again and it will go off.

To make the switch effect multiple lights is simple as well, do the above then....

Add your other lights for the switch, right click on each one and click edit, then go to the 'Enable Parent' tab, click on 'Select Reference in Render Window' and click on the light that you setup for the switch in the render window, click okay.

Multiple lights that can be turned on or off by the same switch yay!


This method works a better then the toggle light tutorial and doesn't require a bunch of editing.

Switches that shouldn't be used are 'noname' switches / levers / pullchains. Any trap switch / lever / pull chain will work with this method, using it in a mod im working on right now :smile:


EDIT IN:
This could really be used for anything that you want to toggle on/ off like say a water faucet or the like.
User avatar
Heather beauchamp
 
Posts: 3456
Joined: Mon Aug 13, 2007 6:05 pm

Post » Tue Jan 01, 2013 10:11 am

Nice! If the toggle light tutorial isn't very good would you consider adding the above to the article?
User avatar
Marquis T
 
Posts: 3425
Joined: Fri Aug 31, 2007 4:39 pm


Return to V - Skyrim