Information
This will show you how to add rain to your map.
Sound Files
Use the
Fastfile Extractor and extract
ber2.ff (
zone\english\) to get all of the rain and thunder effects. Otherwise, I have made a zip file with the sound files used in this tutorial:
Sound Files
Map GSC _FX
Open
yourmap_fx.gsc (
raw\maps\). Put this at the top of the file:
Code:
#include maps\_weather;
Now, inside of the
main() function, put this:
Code:
level._effect["lightning_strike"] = LoadFX( "maps/ber2/fx_ber2_lightning_flash" );
level._effect["rain_heavy_cloudtype"] = LoadFX( "weather/rain_heavy_cloudtype" );
level._effect["rain_10"] = LoadFX( "env/weather/fx_rain_sys_heavy" );
level._effect["rain_9"] = LoadFX( "env/weather/fx_rain_sys_heavy" );
level._effect["rain_8"] = LoadFX( "env/weather/fx_rain_sys_heavy" );
level._effect["rain_7"] = LoadFX( "env/weather/fx_rain_sys_heavy" );
level._effect["rain_6"] = LoadFX( "env/weather/fx_rain_sys_med" );
level._effect["rain_5"] = LoadFX( "env/weather/fx_rain_sys_med" );
level._effect["rain_4"] = LoadFX( "env/weather/fx_rain_sys_med" );
level._effect["rain_3"] = LoadFX( "env/weather/fx_rain_sys_med" );
level._effect["rain_2"] = LoadFX( "env/weather/fx_rain_sys_lght" );
level._effect["rain_1"] = LoadFX( "env/weather/fx_rain_sys_lght" );
level._effect["rain_0"] = LoadFX( "env/weather/fx_rain_sys_lght" );<br />
<br />
thread weather_control();
Next, create these functions:
Code:
weather_control()
{
rainInit( "hard" ); // get rain going
level thread rainEffectChange( 9, 0.1 ); // tweak initial rain strength
thread playerWeather(); // make the actual rain effect generate around the players<br />
<br />
addLightningExploder( 10000 );
addLightningExploder( 10001 );
addLightningExploder( 10002 );
addLightningExploder( 10003 );
addLightningExploder( 10004 );
addLightningExploder( 10005 );
level.nextLightning = GetTime() + 1;
thread lightning( ::lightning_normal, ::lightning_flash );
}
Code:
lightning_normal()
{
wait( 0.05 );
ResetSunLight();
setVolFog(250, 750, 400, -128, 0.44, 0.52, 0.44, 0);
}
Code:
lightning_flash()
{
SetSunLight( 4, 4, 4.5 );
setVolFog(250, 550, 400, -128, 0.6, 0.6, 0.7, 0);
SetSunLight( 1, 1, 1.5 );
setVolFog(250, 550, 400, -128, 0.45, 0.45, 0.5, 0); <br />
<br />
wait( 0.0014 );
SetSunLight( 3, 3, 3.5 );
setVolFog(250, 550, 400, -128, 0.55, 0.55, 0.6, 0);
SetSunLight( 2, 2, 2.5 );
setVolFog(250, 550, 400, -128, 0.65, 0.65, 0.7, 0);
SetSunLight( 1.5, 1.5, 2 );
setVolFog(250, 550, 400, -128, 0.7, 0.7, 0.75, 0);
wait( 0.0010 );
SetSunLight( 1, 1, 1.5 );
setVolFog(250, 550, 400, -128, 0.55, 0.55, 0.6, 0);
SetSunLight( 5, 5, 5.5 );
setVolFog(250, 550, 400, -128, 0.5, 0.5, 0.55, 0);
wait( 0.0011 );
SetSunLight( 4, 4, 4.5 );
setVolFog(250, 550, 400, -128, 0.55, 0.55, 0.6, 0);
SetSunLight( 1, 1, 1.5 );
setVolFog(250, 550, 400, -128, 0.55, 0.55, 0.6, 0);
wait( 0.0015 );
SetSunLight( 2.5, 2.5, 3 );
setVolFog(250, 550, 400, -128, 0.65, 0.65, 0.7, 0);
}
NOTE: You can change the settings in the lightning_flash() function to your needs. They are set to what I used in Chinatown.
Save / Close.
Weather GSC
Open
_weather.gsc (
raw\maps\) and look for the
player_weather_loop() function. Look for where it has this:
Code:
if( level.rainLevel != 0 )
{
// SRS 5/30/2008: removed forward vector specification
//PlayFX( level._effect["rain_drops"], self.origin + (0,0,650), self.origin + (0,0,680) );
PlayFX( level._effect["rain_drops"], self.origin + (0,0,650) );
// we can do extra FX calls here later if we want, for additional particles on harder rain, etc.
}
Now, inside of it, put the following:
Code:
self playloopsound("rain_pavement1");
So, the whole
player_weather_loop() function would look like this:
Code:
player_weather_loop()
{
self endon("death");
self endon("disconnect");
// SRS 5/3/2008: Make sure it doesn't run twice on anybody
if( IsDefined( self.playerWeatherLoopRunning ) && self.playerWeatherLoopRunning )
{
return;
}
self.playerWeatherLoopRunning = true;
for (;;)
{
// SRS 5/29/2008: don't rain if level.rainLevel is 0
if( level.rainLevel != 0 )
{
// SRS 5/30/2008: removed forward vector specification
//PlayFX( level._effect["rain_drops"], self.origin + (0,0,650), self.origin + (0,0,680) );
PlayFX( level._effect["rain_drops"], self.origin + (0,0,650) );
self playloopsound("rain_pavement1");
// we can do extra FX calls here later if we want, for additional particles on harder rain, etc.
}
wait( 0.3 );
}
}
Save / Close.
Sound Alias
Go to
raw\soundaliases\ and create a file named
rain.csv. Now, copy and paste this into it:
Code:
name,platform,file,sequence,vol_min,vol_max,dist_min,dist_max,limit_count,limit_type,entity_limit_count,entity_limit_type,bus,volume_min_falloff_curve,
volumefalloffcurve,reverb_send,dist_reverb_max,reverb_min_falloff_curve,reverb_falloff_curve,pitch_min,pitch_max,randomize_type,spatialized,type,
probability,loop,masterslave,loadspec,subtitle,compression,secondaryaliasname,chainaliasname,startdelay,speakermap,lfe percentage,center percentage,
envelop_min,envelop_max,envelop percentage,occlusion_level,occlusion_wet_dry,real_delay,distance_lpf,move_type,move_time,min_priority,max_priority,
min_priority_threshold,max_priority_threshold,subtitle,doppler<br />
<br />
thunder_closeL,,Stream\Level\ber2\thunder\thunder_closeL_00.wav,,0.85,0.95,1000,15000,1,oldest,,,ambience,,,1,40000,,curve4,0.7,1,,3d,streamed,,,,,,,
thunder_closeR,,,,0.5,,,,,0.15,,,no,
left_player,7,80,90,0.25,1
thunder_closeR,,Stream\Level\ber2\thunder\thunder_closeL_00.wav,,0.95,1,1000,15000,1,oldest,,,ambience,,,1,40000,,
curve4,0.7,1,,3d,streamed,,,,,,,,,,,0.5,,,,,0.15,,,no,right_player,7,80,90,0.25,1
thunder_farL,,Stream\Level\ber2\thunder\thunder_farL_00.wav,,0.8,1,3000,18000,1,reject,,,ambience,,,1,50000,,
curve4,0.7,1,,3d,streamed,,,,,,,thunder_farR,,,,0.5,,,,,0.15,,,no,left_player,
11,80,90,0.25,1
thunder_farR,,Stream\Level\ber2\thunder\thunder_farR_00.wav,,0.8,1,3000,18000,1,reject,,,ambience,,,1,50000,,
curve4,0.7,1,,3d,streamed,,,,,,,,,,,0.5,,,,,0.15,,,no,right_player,11,80,90,0.25,1<br />
<br />
rain_pavement1,,SFX\Amb\rain\on_stuff\on_pave\pave_rain_01.wav,,0.85,0.95,100,800,,,,,ambience,,curve2,,1000,,curve1,
0.8,1.1,pitch,3d,,,looping,,,,pcm,,,,,,,,,,0.2,,,,,,10,40,0.25,0.8
Save / Close.
Zone Source
Go to the
zone_source folder. Make a new file and name it "
rain.csv". Copy and paste this into it:
Code:
ignore,code_post_gfx
ignore,common<br />
<br />
// Sounds
sound,rain,all_sp
sound,rain,rain,all_sp<br />
<br />
// Weather FX<br />
<br />
fx,env/weather/fx_lightning_cloud_flash
fx,env/weather/fx_rain_med
fx,env/weather/fx_rain_sys_heavy
fx,env/weather/fx_rain_sys_med
fx,env/weather/fx_rain_sys_lght
fx,system_elements/fx_null
fx,env/water/fx_wtr_spill_sm_thin
fx,env/water/fx_water_splash_leak_md
fx,env/water/fx_water_rain_distortion
fx,env/water/fx_water_drips_hvy
fx,env/water/fx_water_drips_hvy_long<br />
<br />
// Player FX
fx,bio/player/fx_footstep_water
fx,env/weather/fx_rain_sys_heavy
Save / Close.
Map Zone Source
Open yourmap.csv (
zone_source\) and put the following into it:
Code:
include,rain
Save / Close.
Mod Folder
In order for the rain sounds to work, you must place _weather.gsc into your map's mod folder. Go to your map's mod folder (
mods\yourmap\) and make a new folder. Name it "
maps". Now, copy and paste the _weather.gsc file into it. So, the file structure would look like this:
mods\yourmap\maps\_weather.gsc
Mod Builder
Open
Launcher and go to the
Mod Builder. Now, check these options:
Build mod.ff Fastfile
Build IWD File
Then, in the "
IWD File List", check the "
maps" checkbox. Click "
Build MOD"
Credits
[HOG]Rampage
AintNoMeInTeam (Fastfile Extractor)
customcod.com
modsonline.com
edited on May. 25, 2009 12:07 am by Sgt.Rampage