Tutorial written by [FR] Sparks. Mirrored here for archival purposes.
Adding Rain to your SP Map
Courtesy of [FR] Sparks
Simplified the rain code so all you have to do is just change the RainLevel value between integers 0-10 with 10 being hard rain.
MAPNAME.GSC
#include maps\_utility;
#include maps\_anim;
#using_animtree("generic_human");
main()
{
maps\_load::main();
mapsMAPNAME_fx::main();
}
MAPNAME_fx.GSC
#include maps\_utility;
main()
{
// Rain
level._effect["rain_heavy_cloudtype"] = loadfx ("fx/misc/rain_heavy_cloudtype.efx");
level._effect["rain_10"] = loadfx ("fx/misc/rain_heavy.efx");
level._effect["rain_9"] = loadfx ("fx/misc/rain_9.efx");
level._effect["rain_8"] = loadfx ("fx/misc/rain_8.efx");
level._effect["rain_7"] = loadfx ("fx/misc/rain_7.efx");
level._effect["rain_6"] = loadfx ("fx/misc/rain_6.efx");
level._effect["rain_5"] = loadfx ("fx/misc/rain_5.efx");
level._effect["rain_4"] = loadfx ("fx/misc/rain_4.efx");
level._effect["rain_3"] = loadfx ("fx/misc/rain_3.efx");
level._effect["rain_2"] = loadfx ("fx/misc/rain_2.efx");
level._effect["rain_1"] = loadfx ("fx/misc/rain_1.efx");
level._effect["rain_0"] = loadfx ("fx/misc/rain_0.efx");
thread rainControl(); // level specific rain settings.
thread playerWeather(); // make the actual rain effect generate around the player
}
rainControl()
{
level.rainLevel = 10; // rain level
level._effect["rain_drops"] = level._effect["rain_" + level.rainLevel];
}
playerWeather()
{
player = getent("player","classname");
for (;;)
{
playfx ( level._effect["rain_drops"], player.origin + (0,0,650), player.origin + (0,0,680) );
if (level.rainLevel >= 8)
playfx ( level._effect["rain_heavy_cloudtype"], player.origin + (0,0,650));
wait (0.3);
}
}