Difference between revisions of "Light switch tutorial"

1,131 bytes added ,  10:35, 15 April 2010
no edit summary
imported>Puf the majic dragon
m (Added editor marker notation)
imported>Darkness X
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Many users have requested information on setting up a light switch in the game. This tutorial explains in detail with screenshots how to set up a generic light switch which can easily be replicated throughout your mod with only one simple script.
Many users have requested information on setting up a light switch in the game. This tutorial explains in detail with screenshots how to set up a generic light switch which can easily be replicated throughout your mod with only one simple script.
{{Tools|req0=[[The Elder Scrolls Construction Set|Construction Set]]}}


== Create Your Switch ==
== Create Your Switch ==
First you will need to create a new [[activator]] world object which will act as your switch. This can be any object you desire such as a Welkynd stone or a new mesh of your design. This tutorial uses a .nif file with only a dome shaped collision object and editor marker, which appears as an invisible object in game which the player can still interact with.
First you will need to create a new [[activator]] world object which will act as your switch. This can be any object you desire such as a Welkynd stone or a new mesh of your design. This tutorial uses a .nif file with only a dome shaped collision object and [[Editor Marker]], which appears as an invisible object in game which the player can still interact with. This file can be downloaded from TESNexus [http://www.tesnexus.com/downloads/file.php?id=22549 here]


<pre>
<pre>
Line 8: Line 9:
</pre>
</pre>
<pre>
<pre>
If your activator has no visible mesh, make sure to add an [[Editor Marker]]to the mesh so you can see it when you place it in the render window.
If your activator has no visible mesh, make sure to add an editor marker to the mesh so you can see it when you place it in the render window.
</pre>
</pre>


Line 57: Line 58:


[[Image:Lighttutflamerender.jpg|thumb|right|A flame placed as a light source activated by the switch]]
[[Image:Lighttutflamerender.jpg|thumb|right|A flame placed as a light source activated by the switch]]
<pre>
Rather than duplicating your activator, you can place only one activator and then place an xmarker or any other object of your choice (even one of your lights). Parent your activator to the xmarker and modify the activator script to only enable/disable its parent. In the next section, you will need to parent all of your lights to the xmarker rather than the switch. There is no real advantage to either method, it's up to your personal preference.
</pre>
== Placing Your Lights ==
== Placing Your Lights ==


Line 68: Line 73:
<pre>
<pre>
You can place a "light" version of the candle, found under World Objects > Light > Lights in the Object Window, however the more lights you place in a cell, the lower your framerate will be. It is best to place several "fake" candles and then only one real light to improve performance.  
You can place a "light" version of the candle, found under World Objects > Light > Lights in the Object Window, however the more lights you place in a cell, the lower your framerate will be. It is best to place several "fake" candles and then only one real light to improve performance.  
</pre>
<pre>
There is a bug in the lighting system when using objects as light sources that sometimes causes the lighting to not update properly after the object has been disabled. Again, using the "Fake" version of a light source combined with a regular "light bulb" light will work around this issue.
</pre>
</pre>


== How It Works ==
== How It Works ==
When you enter the game and approach the switch, the lights will be off. By activating the switch, which will be the "off" switch, it disables itself which automatically enables the "On" switch. The "On" switch can be activated repeating the process in reverse. Now by parenting all of your light sources to either switch, they will be enabled or disabled (turned on or off) according to which switch is enabled or disabled. Any number of light sources or other objects can be added to the switch simply by parenting them to the switches or daisy-chaining them together without ever editing the script. Also, you can select the switches and light sources in the render window and duplicate them (ctrl+d) and move the copies anywhere you wish and the copied lights will work with the copied switch without any additional editing.
When you enter the game and approach the switch, the lights will be off. By activating the switch, which will be the "off" switch, it disables itself which automatically enables the "On" switch. The "On" switch can be activated repeating the process in reverse. Now by parenting all of your light sources to either switch, they will be enabled or disabled (turned on or off) according to which switch is enabled or disabled. Any number of light sources or other objects can be added to the switch simply by parenting them to the switches or daisy-chaining them together without ever editing the script. Also, you can select the switches and light sources in the render window and duplicate them (ctrl+d) and move the copies anywhere you wish and the copied lights will work with the copied switch without any additional editing. Finally, you can set up multiple sets of switches to activate the same lights, for example a set of switches on each end of a long hallway, simply by parenting the second set of switches to the first "Off" switch.
[[Image:Lighttutgame1.jpg|thumb|left|The switch turned off in game]]
[[Image:Lighttutgame1.jpg|thumb|left|The switch turned off in game]]
[[Image:Lighttutgame2.jpg|thumb|left|The switch turned on in game]]
[[Image:Lighttutgame2.jpg|thumb|left|The switch turned on in game]]




[[Category:Getting Started]]
[[Category:World Objects]]
[[Category:Tutorials]]
[[Category:Tutorials]]
[[Category:Scripting_Tutorials]]
Anonymous user