//Audio Datablock declarations for rain effects datablock AudioProfile(LightRainSound) { filename = "~/data/sound/rain.wav"; description = "AudioLooping2D"; }; datablock AudioProfile(NormalRainSound) { filename = "~/data/sound/rain.wav"; description = "AudioLooping2D"; }; datablock AudioProfile(HeavyRainSound) { filename = "~/data/sound/rain.wav"; description = "AudioLooping2D"; }; //Audio Datablock declarations for thunder datablock AudioProfile(ThunderCrash1Sound) { fileName = "~/data/sound/thunder1.wav"; description = "AudioSoft3D"; }; datablock AudioProfile(ThunderCrash2Sound) { fileName = "~/data/sound/thunder2.wav"; description = "AudioSoft3D"; }; datablock AudioProfile(ThunderCrash3Sound) { fileName = "~/data/sound/thunder3.wav"; description = "AudioSoft3D"; }; datablock AudioProfile(ThunderCrash4Sound) { fileName = "~/data/sound/thunder4.wav"; description = "AudioSoft3D"; }; //datablock lightning declarations datablock LightningData(LightningStorm) { strikeTextures[0] = "~/data/environment/lightning.dml"; thunderSounds[0] = ThunderCrash1Sound; thunderSounds[1] = ThunderCrash2Sound; thunderSounds[2] = ThunderCrash3Sound; thunderSounds[3] = ThunderCrash4Sound; }; //datablock sprinkling rain declarations datablock PrecipitationData(LightRain) { soundProfile = "LightRainSound"; dropTexture = "~/data/environment/rain"; splashTexture = "~/data/environment/water_splash"; dropSize = 0.75; splashSize = 0.2; useTrueBillboards = false; splashMS = 250; }; //datablock normal rain declarations datablock PrecipitationData(NormalRain) { soundProfile = "NormalRainSound"; dropTexture = "~/data/environment/mist"; splashTexture = "~/data/environment/water_splash"; dropSize = 5; splashSize = 0.2; useTrueBillboards = false; splashMS = 250; }; //datablock heavy misting rain declarations datablock PrecipitationData(HeavyRain) { soundProfile = "HeavyRainSound"; dropTexture = "~/data/environment/mist"; splashTexture = "~/data/environment/mist2"; dropSize = 10; splashSize = 0.1; useTrueBillboards = false; splashMS = 250; }; //create our sprinkling rain effect here function createLightRain() { //create an instance of the precipitation class //initialize our member variables here new Precipitation(myLightRain) { position = "-144.555 612.71 162"; rotation = "1 0 0 0"; scale = "1 1 1"; dataBlock = "LightRain"; minSpeed = "1.5"; maxSpeed = "2"; minMass = "0.75"; maxMass = "0.85"; maxTurbulence = "0.1"; turbulenceSpeed = "0.2"; rotateWithCamVel = "1"; useTurbulence = "0"; numDrops = "5000"; boxWidth = "200"; boxHeight = "100"; doCollision = "1"; name = "Light Rain"; }; } //create our normal rain here function createNormalRain() { //create an instance of the precipitation class //initialize our member variables here new Precipitation(myNormalRain) { position = "-144.555 612.71 162"; rotation = "1 0 0 0"; scale = "1 1 1"; dataBlock = "NormalRain"; minSpeed = "1.5"; maxSpeed = "2"; minMass = "0.75"; maxMass = "0.85"; maxTurbulence = "0.1"; turbulenceSpeed = "0.2"; rotateWithCamVel = "1"; useTurbulence = "0"; numDrops = "5000"; boxWidth = "200"; boxHeight = "100"; doCollision = "1"; name = "Normal Rain"; }; } //create our heavy misting rain here function createHeavyRain() { //create an instance of the precipitation class //initialize our member variables here new Precipitation(myHeavyRain) { position = "-851.738 808.676 112.863"; rotation = "1 0 0 0"; scale = "1 1 1"; dataBlock = "HeavyRain"; minSpeed = "2"; maxSpeed = "3"; minMass = "0.75"; maxMass = "0.85"; maxTurbulence = "0.1"; turbulenceSpeed = "0.2"; rotateWithCamVel = "1"; useTurbulence = "0"; numDrops = "5000"; boxWidth = "200"; boxHeight = "100"; name = "Heavy Rain"; doCollision = "1"; }; } //create our lightning here function createLightning() { //create an instance of the lightning class //initialize our member variables here new Lightning(ElectricalStorm) { position = "200 100 300"; rotation = "1 0 0 0"; scale = "2050 2000 2000"; dataBlock = "LightningStorm"; strikesPerMinute = "30"; strikeWidth = "2.5"; strikeRadius = "210"; color = "1 1 1 1"; fadeColor = "0.1 0.1 1 1"; chanceToHitTarget = "10"; boltStartRadius = "20"; useFog = "1"; name = "Lightning"; locked = "true"; }; } //create our weather effects here function createWeatherEffects() { //returns true if misting rain and lightning are created if($pref::Video::weatherEffects =="1") { //choose rain %myRandom = getRandom(0,3); switch (%myRandom) { //create sprinkling effect case 0: createLightRain(); echo("Implementation of Light Rain: complete"); //create rain effect case 1: createNormalRain(); echo("Implementation of Normal Rain: complete"); //create heavy misting rain case 2: createHeavyRain(); echo("Implementation of Heavy Rain: complete"); case 3: echo("Implementation of No Rain: complete"); default: error("WARNING: There is a problem with the weather switch statement! %myRandom is at: "@ %myRandom); } //Lightning condition met? if ((%myRandom>=0) &&(%myRandom<=2)) { %myRandom = getRandom(0,1); if(%myRandom ==0) { //create our lightning createLightning(); echo("Implementation of Lightning: Complete"); } }//end lightning condition }//end if weatherEffects }//end CreateWeatherEffects() //make sure we clean up function destroyWeatherEffects() { ElectricalStorm.delete(); myHeavyRain.delete(); myNormalRain.delete(); myLightRain.delete(); }