Hard Rain

From Valve Developer Community
Jump to: navigation, search
English (en)中文 (zh)Translate (Translate)

Creating the Hard Rain Campaign's Rain Storm Effect

The thunderstorm effect in the Hard Rain campaign is a very cool effect, and it is actually simpler to get it working than you might think. The information in this article is based on a tutorial, that can be found here. However, I had to make some changes to get it working. Instead of editting the storm entities instance files yourself as in the tutorial linked above, here is a .zip file containing the already updated files for your convenience.
StormEnts.zip

Note.pngNote:The updated c4m4_storm_ents.vmf file in this .zip file has been replaced with storm entities I copied out of a decompiled version of one of the Hard Rain maps. If you use the c4m4_storm_ents.vmf file that comes with the Authoring Tools, then the skybox gets very glitchy during storms. Using this updated version of c4m4_storm_ents.vmf fixes that problem and will also give you the movement in the clouds that you see in the Hard Rain campaign. And if you would like the decompiled versions of the L4D2 campaign maps, they can be downloaded from here

After downloading the storm_ents.zip file, go into your Left 4 Dead 2 \mapsrc\ folder. Create a new folder called \myinstances\ or something similar, and unzip the storm_ents.zip file into it. This is to ensure that these files won't get overwritten the next time the L4D2 Authoring Tools get updated.

Getting Started

First, you need to have a map with a 3D Skybox. Once you have a 3D skybox setup in your map, go into your Map Properties and set the SkyBox Texture Name to sky_l4d_c4m4_hdr. This is the skybox texture that Valve used in the Hard Rain campaign.


Creating the Storm

We are going to use the func_instance entity to setup the storm, by instancing the storm instance files that you downloaded (in StormEnts.Zip above). First, go to the center of the playable area of your map. Create a func_instance entity.

Note.pngNote:You may want to place these first two func_instance entities high above the ground so they're out of the way, as it doesn't really matter where you put them.


Now set up the following properties on the func_instance entity:

  • Set the Fix Up Name field to "c4m4_storm_logic"
  • Set the VMF Filename field to "myinstances/c4m4_storm_logic.vmf"
    Note.pngNote:Change "myinstances" to the folder you unzipped StormEnts.zip into
  • Set the Entity Name Fix Up field to "None"


Next, create a second func_instance entity somewhere nearby, and setup its properties like this:

  • Set the Fix Up Name field to "c4m4_environment_ents"
  • Set the VMF Filename field to "myinstances/c4m4_environment_ents.vmf"
    Note.pngNote:Change "myinstances" to the folder you unzipped StormEnts.zip into
  • Set the Entity Name Fix Up field to "None"


For the third and final func_instance entity, go to the sky_camera entity in your 3D skybox. Place a func_instance at about the same place as the sky_Camera entity and set up its properties like this:

  • Set the Fix Up Name field to "c4m4_storm_ents"
  • Set the VMF Filename field to "myinstances/c4m4_storm_ents.vmf"
    Note.pngNote:Change "myinstances" to the folder you unzipped StormEnts.zip into
  • Set the Entity Name Fix Up field to "None"

Creating the Rain

Now we just need to add the rain into the map. To do this, create a brush that covers your entire playable area, cover it with the tools/trigger texture, and make this brush a func_precipitation entity. Set its Precipitation Type property to "Particle Rain Storm", and set its Name property to "rain".

Note.pngNote:If your rain doesn't show up in-game, you may need to make your func_precipitation brush taller. A height of 1024 units was suggested in the steam sdk forums, but I don't know how tall the func_precipitation actually has to be to work.
Note.pngNote:The func_precipiation entity automatically detects the presence of buildings, so that it won't rain inside your building. But if you need to block rain in other areas (like under large props), you can use func_precipitation_blocker entities to do so. To make one, you just make a brush covered with the tools/trigger texture and make it a func_precipitation_blocker entity, then move and resize it as needed.

Next, we want to keep the rain fog out of our buildings. To do this, create a brush and cover it with the tools/fogvolume texture. Make this brush a fog_volume entity. Then move and resize the brush so it covers all of the interior area of your building. Use multiple fog brushes if you have multiple indoor rooms and corridors. Set up your fog_volume entity (or entities) like this:

  • Set the Fog Name field to "foginteriorcontroller"
  • Set the Postprocess Name field to "fx_settings_interior"
Note.pngNote:When you type these in, they will appear red, but don't worry they will work fine. It's just doing that since we used instances instead of copying and pasting the storm entities into our map.


Lastly, we just need to add the sound effects for the rain. For this, go to where you placed the first two func_instance entities. Somewhere nearby, create an env_soundscape_triggerable entity and set up its properties like this:

  • Set the Name field to "rain_interior"
  • Set the Radius field to "0"
  • Set the Soundscape field to "rain.interior.med"
Note.pngNote:If you would like some different soundscapes, a list of them can be found here: List of L4D2 Soundscapes


Now create a second env_soundscape_triggerable entity here and setup its properties like this:

  • Set the Name field to "rain_exterior"
  • Set the Radius field to "0"
  • Set the Soundscape field to "rain.water.med"
Note.pngNote:If you would like some different soundscapes, a list of them can be found here: List of L4D2 Soundscapes


All that's left to do now, is trigger these rain sounds. For this, go to the entrance of your building.

Note.pngNote:You will need to do this at each entrance to an interior area in your map.

Place a trigger brush covering the entrance on the outside of the doorway. This brush should be covered with the tools\trigger texture, and make it a trigger_soundscape entity. Set its Soundscape field to "rain_exterior".

Now place a second trigger brush covering the entrance on the inside of the doorway. This brush should be covered with the tools\trigger texture, and make it a trigger_soundscape entity. Set its Soundscape field to "rain_interior".

These two triggers will switch the soundscape when the player enters or exits the doorway. This makes the rain sound different when you are outside, than it does when you are in an interior area. Now, make a copy of the trigger that you placed on the inside of the doorway. Move and resize this copy so that it covers most of the starting room. This way the survivors will spawn inside this trigger, and it will then activate the interior rain soundscape. Otherwise, when the map starts, the player will not hear the rain until they go outside.


Testing Your Storm

That's it! You should now have a working storm in your map. To test it, you can setup a button and have it target the entity "relay_storm_start" via the input "Trigger".

Note.pngNote:If you do this, the output on your button will appear red in the editor, but don't worry it will work. It's just doing that since we used instances instead of copying and pasting the storm entities into our map.
Note.pngNote:If you just sit and wait in your map, it will storm periodically by itself.


A second way to test your storm is by opening the console (make sure sv_cheats is set to "1") and type in the following command: ent_fire relay_storm_start trigger

Here is a sample map with the storm working. The button just outside the saferoom door will trigger a storm. The other button further away simply triggers a panic event. There is also a ladder near the safe room door, allowing you to get onto the safe room roof.
L4D2_StormSampleMap.zip

If you want to tweak this setup, there is a lot you can do. You'll probably want to make copies of the storm instance files to experiment with so you still have the originals from the StormEnts.zip file (the download link is at the top of this page).


See also