Triggerable Weather class ver 1
HOW:
1) Copy and paste the below QC in a text document and save it as WEATHER.QC
2) Use a NON weather-modified Quake source (any source) and add DPEXTENSIONS.QC after DEFS.QC in PROGS.SRC
3) add WEATHER.QC anywhere you like after DPEXTENSIONS in PROGS.SRC
4) compile and enjoy
WEATHER.QC
Here is the Entity definition. Just copy and paste it at the end of your .FGD
HOW DOES THIS WORK:
Make a block primitive the size of your weather area, convert it to an entitity and choose func_weather as it's classname. If you want rain, set the rain flag. If you want snow set the snow flag. I have no idea what will happen if you set both. If you want the weather to be set off by a trigger simply give it a name and put its name in some entity's target field. If the weather has no name it becomes automatic and constant.
POSSIBLE USES:
1) create multiple rain blocks with separate triggers, as the triggers are set off more rain/snow will fall as more weather is activated
2) simply turn the rain/snow on and then turn it off at a later event
3) use multiple triggers and weather blocks to change from snow to rain or vise versa
ASIDES:
1) all .ent files will work the exact same with this class
2) sounds only get cached if rain is ever used
3) one thunderclap happens as rain is initiated
4) you have to have Sevens rain and thunder sounds (or sounds named the same)
5) If you are using a weather-modded quake you will have to delete ALL weather functions at the end of MISC.QC and you can delete the precaches in WORLD.QC before you compile WEATHER.QC into your quake
6) This class only depends on DPEXTENSIONS.QC.
HOW:
1) Copy and paste the below QC in a text document and save it as WEATHER.QC
2) Use a NON weather-modified Quake source (any source) and add DPEXTENSIONS.QC after DEFS.QC in PROGS.SRC
3) add WEATHER.QC anywhere you like after DPEXTENSIONS in PROGS.SRC
4) compile and enjoy
WEATHER.QC
Code:
/*__________> TRIGGERABLE WEATHER ver 1.0 <__________*/ /* modified from Lord Havoc's rain and snow */ /* includes Sevens sound mods */ /*__________> Gypsy - BREAK QUAKE MOD <__________*/ float SPAWN_RAIN = 1; float SPAWN_SNOW = 2; // ideas to do: // float SPAWN_ADD_WIND = 4; // float SPAWN_ACID_RAIN = 8; // float SPAWN_FIRE_RAIN = 16; float CLEAR = 0; float FORECAST = 1; .float weather; .float weather_cached; /*=============================================== Sounds ===============================================*/ void() precache_weather { precache_sound ("ambience/rain.wav"); precache_sound ("ambience/thunderrain.wav"); }; void() regenton = { if (random()> 0.94) sound (self, CHAN_VOICE, "ambience/rain.wav", 1, ATTN_NORM); else return; }; void() blitzton = { if (random()> 0.997) sound (self, CHAN_WEAPON, "ambience/thunderrain.wav", 1, ATTN_NORM); else return; }; /*=============================================== Thinks ===============================================*/ void() snow_think = { self.nextthink = time + 0.1; te_particlesnow(self.absmin, self.absmax, self.dest, self.count, self.cnt); }; void() rain_think = { if(!self.weather_cached) { self.weather_cached = 1; precache_weather(); } self.nextthink = time + 0.1; te_particlerain(self.absmin, self.absmax, self.dest, self.count, self.cnt); blitzton(); regenton(); }; /*=============================================== Activator ===============================================*/ void() weather_use = { if(!self.weather || self.weather == CLEAR) { self.weather = FORECAST; if (self.spawnflags & SPAWN_RAIN) { sound (self, CHAN_WEAPON, "ambience/thunderrain.wav", 1, ATTN_NORM); self.think = rain_think; } else if (self.spawnflags & SPAWN_SNOW) { self.think = snow_think; } self.nextthink = time + 0.1; return; } self.weather = CLEAR; self.think = SUB_Null; }; /*=============================================== Mother Nature ===============================================*/ void() func_weather = { self.dest = self.velocity; self.velocity = '0 0 0'; if (!self.dest & SPAWN_RAIN) self.dest = '0 0 -700'; else if (!self.dest & SPAWN_SNOW) self.dest = '0 0 -100'; self.angles = '0 0 0'; self.movetype = MOVETYPE_NONE; self.solid = SOLID_NOT; setmodel(self, self.model); setorigin(self, self.origin); setsize(self, self.mins, self.maxs); self.model = ""; if (!self.cnt) self.cnt = 12; if (!self.count) self.count = (self.absmax_x - self.absmin_x)*(self.absmax_y - self.absmin_y)/8192; if (self.count < 1) { remove(self); return; } // convert from per second to per 0.1 sec, self.count = ceil(self.count * 0.1); if(!self.targetname) weather_use(); else self.use = weather_use; };
Here is the Entity definition. Just copy and paste it at the end of your .FGD
Code:
// // func_weather mod - Gypsy // @SolidClass base(Targetname) = func_weather: "func_weather" [ spawnflags(Flags) = [ 1 : "Rain" : 1 2 : "Snow" : 0 ] velocity(string): "velocity" : "0 0 -700" count(integer): "count" : 4 cnt(integer): "cnt" : 2 ]
Make a block primitive the size of your weather area, convert it to an entitity and choose func_weather as it's classname. If you want rain, set the rain flag. If you want snow set the snow flag. I have no idea what will happen if you set both. If you want the weather to be set off by a trigger simply give it a name and put its name in some entity's target field. If the weather has no name it becomes automatic and constant.
POSSIBLE USES:
1) create multiple rain blocks with separate triggers, as the triggers are set off more rain/snow will fall as more weather is activated
2) simply turn the rain/snow on and then turn it off at a later event
3) use multiple triggers and weather blocks to change from snow to rain or vise versa
ASIDES:
1) all .ent files will work the exact same with this class
2) sounds only get cached if rain is ever used
3) one thunderclap happens as rain is initiated
4) you have to have Sevens rain and thunder sounds (or sounds named the same)
5) If you are using a weather-modded quake you will have to delete ALL weather functions at the end of MISC.QC and you can delete the precaches in WORLD.QC before you compile WEATHER.QC into your quake
6) This class only depends on DPEXTENSIONS.QC.
Comment