Lightning: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
(Cleaned up the article a bit. Will continue after I'm finished *crying* over its previous state.)
Line 1: Line 1:
{{pov}}{{cleanup}}
{{pov}}{{cleanup}}
Ever wanted to add lightning to your map? Well now you can! Just follow this tutorial and you to can add Lightning to your Source Map.
'''Note:''' ''This article is under construction today. I'm just making a temp save and taking a breather.''


[http://files.filefront.com/Lightning_Tutorial_Files/;5261042;;/fileinfo.html Required Files]
[[image:Lightning_test_01_screenshot0003.jpg|thumb|400px]]


Ok to start this tutorial off, this will automatically start the lightning you'll have to do some random triggers if you want it to only be on at a certain part of the map.  
This is a tutorial for adding a lightning storm to a map.


{{note|Before you go through this tutorial create a [[3D Skybox|3D skybox]] (The one used in this tutorial is 1322x1674x??? Units) with fog disabled.}}
It will use custom made lightning sprites (''lightning.vmt'' and ''lightningglow.vmt'') which can be downloaded [http://files.filefront.com/Lightning_Tutorial_Files/;5261042;;/fileinfo.html here] (along with an example map). However, the following sprites already included in the SDK can simulate lightning suffciently too:


==Step One==
* bluelight1
* lgtning
* lgtning_noz
* physcannon_bluelight1b


Ok place 2 [[env_sprite|sprites]] about 2-10 units away from each other. (Make sure ones in front of the other) Select the one closes to the skycamera entity. In the Sprite Name box write (Not Including Quotation Marks) "materials/sprites/lightningglow.vmt"
It is assumed that the reader knows how to create a [[3D Skybox|3D skybox]] before reading this tutorial.
Then click on scale and type in 7. After that make sure Render Mode is addictive and that the FX amount is 50. Also change the Name to (Not including Quote Marks) "lightning1glow". After that click apply and then Cancel.


http://img291.imageshack.us/img291/9894/step101gf2.jpg


Now goto the properties on the other sprite. Type in the name "lightning1" and change the sprite name to "materials/sprites/lightning.vmt" and also make sure the Render Mode is Addictive and also that the FX Amount is 255. Change the scale amount (Under Scale) to .75
This setup will make the lightning automatically start on. You will have to do some random triggers if you want it to only be on at a certain part of the map.  


http://img81.imageshack.us/img81/8363/step102ul0.jpg


==Step Two==


Now that you've setup your sprites you must setup a logic_timer. This will take longer than placing the sprites. Ok first place a logic_timer somewhere near your sprites. Open it up in properties and set its name to "lightning1timer". Now make sure "Use Random Time" is set to yes and that Min Random Interval is set to 1 and Max Random Interval is set to 10. Then set Refire Interval to "0.35". Now click on outputs tab and add some things to make it look like this:
==Setting up the sprites==
 
Unless lightning is intended to be close enough to strike within the playing area, create the 3D skybox that will house the lightning storm. Make sure that its fog is disabled.
 
# Place 2 [[env_sprite]]s about 2-10 units away from each other. (Make sure ones in front of the other.)
# Select the one closest to the skycamera entity.
# In the Sprite Name box write the name of the glow sprite to use for the lightning glow. (The pictures will use the custom ''materials/sprites/lightningglow.vmt'' sprite.)
# Set its ''Scale'' to ''7''.
# Make sure ''Render Mode'' is ''additive''.
# Make sure that the ''FX Amount'' is ''50''.
# Also change the ''Name'' to ''lightning1glow''.
# After that click ''Apply'' and then ''Cancel''.
 
Open the properties of the other sprite.
# Type a name (like ''lightning1'') in its ''Name'' field.
# Change the ''Sprite Name'' to the name of the lightning sprite to use. (''materials/sprites/lightning.vmt'')
# Make sure the ''Render Mode'' is ''Additive''
# Make sure that the ''FX Amount'' is ''255''.
# Change the ''Scale'' to ''.75''.
 
==Timing between strikes==
 
Place a logic_timer in the map, preferably somewhere near your sprites.
Open its properties and make the following alterations:
# Name it. (''lightning1timer'')
# Make sure ''Use Random Time'' is set to ''yes''.
# Make sure ''Min Random Interval'' is set to ''1''.
# Make sure ''Max Random Interval'' is set to ''10''.
# Set ''Refire Interval'' to ''0.35''.
# Click on the ''Outputs'' tab and add some things to make it look like this:


http://img162.imageshack.us/img162/6269/step202af5.jpg
http://img162.imageshack.us/img162/6269/step202af5.jpg
Line 28: Line 56:
Once you're done that click on the flags tab and make sure the only flag that showing is checked!
Once you're done that click on the flags tab and make sure the only flag that showing is checked!


Ok!! You're Done!! Yay! Save it and test it out or follow these optional steps and add some cool additions to your map!
Done. Save it and test it out. The steps below are optional.


==Optional==
==Adding thunder==


Ok wanna add some Thunder to your lightning? well simply place an ambient_generic (Soundscape recommended but not covered by this tutorial sorry!) in a part of your map (not in the 3d skybox) and change it's name to Thunder.01 change its sound name to "k_lab.teleport_post_thunder" or another good thunder sound. Then go back to that logic_timer and add  
To add some thunder sounds it is recommended to use a soundscape (which is not covered by thia tutorial), but a quicker way is to place an [[ambient_generic]] somewhere in the map - not in the 3D skybox - and change its name to ''Thunder.01'', change its sound name to ''k_lab.teleport_post_thunder'' or another good thunder sound. Then go back to the logic_timer and add  
"OnTimerLow"
"OnTimerLow"
"Thunder.02"
"Thunder.02"
"PlaySound"
"PlaySound"
to the output tab and thats it  :).
to the output tab. You can also set a delay that will reflect on how far away that the lighting is.
 
==Randomized lightning==
 
To prevent the lightning from hitting the same spot twice, you can make the sprites rotate around the skybox. (This doesn't actually show the lightning strikes moving.)


Wanna make your Lightning rotate around the skybox? (doesn't actually show the sprite moving great effect since lightning usually never hits the same spot twice.)
# Create a small brush textured with the ''invisible'' tool texture.
Well make a small brush using tool_invisible and make it a func_rotating and call it lightningrotator change the max rotating speed to 3 and change the friction to 20. Click apply and then close the window. go back to your two sprites and change their parent to lightningrotator. After your done that add a logic_auto to the map (Not sure if this is needed or not...) Then in the outputs tab add this:
# Turn it into a ''func_rotating'' entity.
# Call it ''lightningrotator''
# Change the ''max rotating speed'' to ''3''.
# Change the ''friction'' to ''20''.
# Click ''Apply'' and close its window.
# Go back to your two sprites and change their parent to ''lightningrotator''.
# Add a [[logic_auto]] to the map (Not sure if this is needed or not...)
# In its ''Outputs'' tab add this:
"OnMapSpawn"
"OnMapSpawn"
"lightningrotator"
"lightningrotator"
"Start"
"Start"
and then save your map and test it out!!!
# Save and test the map.
Congrads your finish!!
 
[[image:Lightning_test_01_screenshot0003.jpg]]

Revision as of 07:09, 19 August 2006

Broom icon.png
This article or section should be converted to third person to conform to wiki standards.
Broom icon.png
This article or section needs to be cleaned up to conform to a higher standard of quality.
For help, see the VDC Editing Help and Wikipedia cleanup process. Also, remember to check for any notes left by the tagger at this article's talk page.

Note: This article is under construction today. I'm just making a temp save and taking a breather.

Lightning test 01 screenshot0003.jpg

This is a tutorial for adding a lightning storm to a map.

It will use custom made lightning sprites (lightning.vmt and lightningglow.vmt) which can be downloaded here (along with an example map). However, the following sprites already included in the SDK can simulate lightning suffciently too:

  • bluelight1
  • lgtning
  • lgtning_noz
  • physcannon_bluelight1b

It is assumed that the reader knows how to create a 3D skybox before reading this tutorial.


This setup will make the lightning automatically start on. You will have to do some random triggers if you want it to only be on at a certain part of the map.


Setting up the sprites

Unless lightning is intended to be close enough to strike within the playing area, create the 3D skybox that will house the lightning storm. Make sure that its fog is disabled.

  1. Place 2 env_sprites about 2-10 units away from each other. (Make sure ones in front of the other.)
  2. Select the one closest to the skycamera entity.
  3. In the Sprite Name box write the name of the glow sprite to use for the lightning glow. (The pictures will use the custom materials/sprites/lightningglow.vmt sprite.)
  4. Set its Scale to 7.
  5. Make sure Render Mode is additive.
  6. Make sure that the FX Amount is 50.
  7. Also change the Name to lightning1glow.
  8. After that click Apply and then Cancel.

Open the properties of the other sprite.

  1. Type a name (like lightning1) in its Name field.
  2. Change the Sprite Name to the name of the lightning sprite to use. (materials/sprites/lightning.vmt)
  3. Make sure the Render Mode is Additive
  4. Make sure that the FX Amount is 255.
  5. Change the Scale to .75.

Timing between strikes

Place a logic_timer in the map, preferably somewhere near your sprites. Open its properties and make the following alterations:

  1. Name it. (lightning1timer)
  2. Make sure Use Random Time is set to yes.
  3. Make sure Min Random Interval is set to 1.
  4. Make sure Max Random Interval is set to 10.
  5. Set Refire Interval to 0.35.
  6. Click on the Outputs tab and add some things to make it look like this:

http://img162.imageshack.us/img162/6269/step202af5.jpg

(Important Note: The example shows the number 2 but in this tutorial number 1 is used so just replace the 2 with 1. Also the Last line is an optional part of this tutorial!) Once you're done that click on the flags tab and make sure the only flag that showing is checked!

Done. Save it and test it out. The steps below are optional.

Adding thunder

To add some thunder sounds it is recommended to use a soundscape (which is not covered by thia tutorial), but a quicker way is to place an ambient_generic somewhere in the map - not in the 3D skybox - and change its name to Thunder.01, change its sound name to k_lab.teleport_post_thunder or another good thunder sound. Then go back to the logic_timer and add "OnTimerLow" "Thunder.02" "PlaySound" to the output tab. You can also set a delay that will reflect on how far away that the lighting is.

Randomized lightning

To prevent the lightning from hitting the same spot twice, you can make the sprites rotate around the skybox. (This doesn't actually show the lightning strikes moving.)

  1. Create a small brush textured with the invisible tool texture.
  2. Turn it into a func_rotating entity.
  3. Call it lightningrotator
  4. Change the max rotating speed to 3.
  5. Change the friction to 20.
  6. Click Apply and close its window.
  7. Go back to your two sprites and change their parent to lightningrotator.
  8. Add a logic_auto to the map (Not sure if this is needed or not...)
  9. In its Outputs tab add this:

"OnMapSpawn" "lightningrotator" "Start"

  1. Save and test the map.