Warning: include(): http:// wrapper is disabled in the server configuration by allow_url_include=0 in /var/www/vhosts/own3mall/mohaaaa.co.uk/httpdocs/mohaa/tutorials/rain.php on line 3

Warning: include(http://map.planetmedalofhonor.gamespy.com/mohaa/poll/poll_cookie.php): failed to open stream: no suitable wrapper could be found in /var/www/vhosts/own3mall/mohaaaa.co.uk/httpdocs/mohaa/tutorials/rain.php on line 3

Warning: include(): Failed opening 'http://map.planetmedalofhonor.gamespy.com/mohaa/poll/poll_cookie.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/vhosts/own3mall/mohaaaa.co.uk/httpdocs/mohaa/tutorials/rain.php on line 3
.map :: Mapping for MoHAA

 
IRC :: #.map on Quakenet.org or simply go to irc://irc.quakenet.eu.org/.map
 

 
Warning: include(): http:// wrapper is disabled in the server configuration by allow_url_include=0 in /var/www/vhosts/own3mall/mohaaaa.co.uk/httpdocs/mohaa/tutorials/rain.php on line 57

Warning: include(http://map.planetmedalofhonor.gamespy.com/mohaa/leftindex.php): failed to open stream: no suitable wrapper could be found in /var/www/vhosts/own3mall/mohaaaa.co.uk/httpdocs/mohaa/tutorials/rain.php on line 57

Warning: include(): Failed opening 'http://map.planetmedalofhonor.gamespy.com/mohaa/leftindex.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/vhosts/own3mall/mohaaaa.co.uk/httpdocs/mohaa/tutorials/rain.php on line 57
 
 

Rain :: Innkeeper
-------------------------------------------------------------------------------

This tutorial describes how to add rain to your maps. It covers both single player and multi-player maps. This tutorial assumes that you have fundamental MohRadiant skills and know how to create a basic map.

SIDE EFFECT: To make it rain in this tutorial, we will use 'weather.scr' which has a side effect that should be known. When the script starts, it assigns the world.farplane values to level.farplane and assigns the world.farplane_color values to level.farplane_color thus eliminating the creator's ability to set these values. It does this to restore the world.farplane and world.farplane_color values after lightning flashes.

-------------------------------------------------------------------------------
Step 1 : Working on the Map
-------------------------------------------------------------------------------

Lets start out by making a small map. Then we add a shelter to get out of the rain and to demonstrate the interior sounds associated with 'weather.scr'. The picture below may help to visually understand what I am talking about.

Once we have that done, lets create 4 brushes around our shed, leaving about 64 units away from the shed on the back and left, and about 16 units from the front and right. The reason for this is because the weather function tends to blow that rain at an angle of 45°. This will keep the rain from coming through the walls of the shed. Make the brushes so that they go from the sky to the ground.We want to have it rain above the shed but not in it, so we will create a brush to fill in the hole above the shed from the sky down to about 64 units above the shed. Select all 5 brushes and select the rain texture as shown in the next pictures.



Now with all 5 brushes still selected we need to make them an entity of func_rain. To do this right click in the 2D window and select "func->rain" as shown in the following picture.

If you bring up the entity box by pressing 'N' you will see this.

There is nothing we need to add here.

We want to add a couple of trigger_multiple so that the rain sounds will change when we are inside or out. These same triggers will also operate 'ambient.scr' sounds. Make the brushes large enough that the player cant avoid hitting them when entering or exiting the shed. They also need to be far enough apart that a player can not trigger both at once.

Open the entity window and give the trigger_multiple outside the shed a key of "targetname" and a value of "exterior", then a key of "#set" and a value of "1". Do the same for the trigger_multiple inside except the value for targetname is interior. The #set is the same.

When you add your player spawn point, have it touch one of the triggers so that the sound effects will start up correctly.

Now lets add something special. With all this rain, one would expect it to collect somewhere. There is a depression in the ground that we have slowly fill with water. It isn't raining when you first enter the map, so this wont look that unrealistic. In this example a brush is created 256 x 256 x 24 and placed under the terrain a couple units centered on the depression. The reason it is 24 units thick, is that we will be raising it that much as the depression is filled with water. If it were thin, the visual would be the same, but when you walk though the bottom you would hear the sound effect of walking on grass not water. Texture it with no_draw and then only on the top surface texture it with a liquid texture. I used subpen_clear from Spearhead for this example. The color was about right and it does not have any vertical animation. It does have animation that appears like ripples that can pass for rain drops hitting it.

To have the effects follow the same general direction of the rain, the texture needed to be rotated -135°.

 

Now it need to be made a script object. With the brush selected, right click in the 2D view and select script->object. pressing the 'n' key will bring up the entity box where we need to give it a target name. In the key field enter "targetname" and press enter now enter the value of "rainpuddle".


That's about it for the map, now we need to work on the map's script.

-------------------------------------------------------------------------------
Step 2 : The Map's Script File
-------------------------------------------------------------------------------

Single Player :

There is not a whole lot needed to enable weather. Just add the following to your map's script under level waittill prespawn. Unfortunately to get the rain sounds to work properly, ambient sounds needs to be loaded as well. Just make sure it is called first so that the triggers are setup correctly.

level waittill prespawn

exec global/ambient.scr m5l1b
exec global/weather.scr

To enable our rain puddle we need to add a bit to the script. Add a call to the rain puddle function below level waittill spawn.

level waittill spawn
thread puddle

Now below the end of the main portion of the map's script we will write the puddle function.

puddle:
wait 120 // wait 2 minutes before starting
$rainpuddle moveup 24 // elevate the script object 24 units
$rainpuddle time 600 // take 10 minutes to do it
$rainpuddle waitmove
end

The rain does not start immediately when entering the map so the wait will let some time pass before it starts.

Because I used a texture for the rain puddle from Spearhead, the actual textures and shader need to be added to the .pk3 file for them to show up in MOHAA. You just need to add a copy of the shader to the scripts folder of your .pk3 and the proper textures in the same folders as are in Spearhead to your .pk3

NOTE: To get the best visual effect of the rain puddle, you need to set the curve detail and terrain detail as high as they will go in the game's settings.

Multi-Player :

Multi-player is just about as simple. Just add the same information as the single-player script uses. Only problem is that 'ubersound.scr' that comes with MOHAA does not include dm maps for the thunder and rain sounds. This was corrected for Spearhead. To correct for this a modified version of 'ubersound.scr' is needed. Add a copy of 'ubersound.scr' to your .pk3 file with the following changes.

alias thunder1 sound/amb/Amb_Thunder_01.wav soundparms 1.0 0.0 1.0 0.0 3000 6000 auto streamed maps "m5l1 dm obj"

alias thunder2 sound/amb/Amb_Thunder_02.wav soundparms 1.0 0.0 1.0 0.0 3000 6000 auto streamed maps "m5l1 dm obj"

alias thunder3 sound/amb/Amb_Thunder_03.wav soundparms 1.0 0.0 1.0 0.0 3000 6000 auto streamed maps "m5l1 dm obj"

alias rain_ext sound/amb/Amb_RainExt_01.wav soundparms 1.0 0.0 1.0 0.0 3000 6000 local streamed maps "m5l1 dm obj"

alias rain_int sound/amb/Amb_RainInt_01.wav soundparms 1.0 0.0 1.0 0.0 3000 6000 local streamed maps "m5l1 dm obj"

alias rain_roof sound/amb/Amb_RainRoof_02.wav soundparms 1.0 0.0 1.0 0.0 160 320 local streamed maps "m5l1 dm obj"

alias rain_window sound/amb/Amb_RainWindow_01.wav soundparms 1.0 0.0 1.0 0.0 160 320 local streamed maps "m5l1 dm obj"

alias rain_puddle sound/amb/Amb_RainPuddle_01.wav soundparms 1.0 0.0 1.0 0.0 3000 6000 local streamed maps "m5l1 dm obj"

alias rain_plant sound/amb/Amb_RainPlant_01.wav soundparms 1.0 0.0 1.0 0.0 3000 6000 local streamed maps "m5l1 dm obj"

The items in red are those that need to be added. I don't generally advocate making changes to 'ubersound.scr', but other methods were unsuccessful.

NOTE: That your .pk3 needs to have a name that starts with a letter greater than 'P' for even this method to work.

NOTE: Although the example multi-player map has the interior and exterior triggers, it is not recommended to use them because 'ambient.scr' does not work properly for multi-player maps. The sound changes are propagated to all players at the same time.

-------------------------------------------------------------------------------
Step 3 : The Map's .pk3 File
-------------------------------------------------------------------------------

Because a Spearhead texture was used for the rain puddle we need to add some images and a shader to the .pk3 file so that the map can be run in MOHAA and have the texture to show up.

Looking in the status bar in mohradiant, with the puddle texture selected, we see that it's shader is 'water.shader'. Opening 'water.shader' we look for the shader for subpen_clear and copy it to a new file. I named the new file 'water.shader' as it will not conflict with spearhead because nothing was changed in the shader itself. You can actually give it any name you want. You can also just include the entire .shader file if you wish.

Now we need to examine the shader for the images that need to be included in the .pk3 file. There are 6 that must be included. It is also wise to include the .dds (mipmap) files as well. These are image files that contain multiples of the same image in various scales that the game engine uses when the player is far away from the brush to save resources. So this makes 12 files that should be included in the .pk3 file. Add them to same folder structure that they are found in Spearhead.

Also note that shaders almost always call for targa images but in reality are jpegs, so just look for the file name with disreguard to the extension when locating images.

After all this, you should be good to go. Check out the example maps.

[ Download the Single-Player Example Map ]
[ Download the Multi-Player Example Map ]

Need any help : Ask in the Forum

 


 
Warning: include(): http:// wrapper is disabled in the server configuration by allow_url_include=0 in /var/www/vhosts/own3mall/mohaaaa.co.uk/httpdocs/mohaa/tutorials/rain.php on line 384

Warning: include(http://map.planetmedalofhonor.gamespy.com/mohaa/rightindex.php): failed to open stream: no suitable wrapper could be found in /var/www/vhosts/own3mall/mohaaaa.co.uk/httpdocs/mohaa/tutorials/rain.php on line 384

Warning: include(): Failed opening 'http://map.planetmedalofhonor.gamespy.com/mohaa/rightindex.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/vhosts/own3mall/mohaaaa.co.uk/httpdocs/mohaa/tutorials/rain.php on line 384


 


Warning: require(): open_basedir restriction in effect. File(/home/map/cgi-bin/mohaa/poll/include/config.inc.php) is not within the allowed path(s): (/var/www/vhosts/own3mall/mohaaaa.co.uk:/usr/share/php:/usr/share/pear) in /var/www/vhosts/own3mall/mohaaaa.co.uk/httpdocs/mohaa/tutorials/rain.php on line 395

Warning: require(/home/map/cgi-bin/mohaa/poll/include/config.inc.php): failed to open stream: Operation not permitted in /var/www/vhosts/own3mall/mohaaaa.co.uk/httpdocs/mohaa/tutorials/rain.php on line 395

Fatal error: require(): Failed opening required '/home/map/cgi-bin/mohaa/poll/include/config.inc.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/vhosts/own3mall/mohaaaa.co.uk/httpdocs/mohaa/tutorials/rain.php on line 395