Weather System



  • Is it possible to implement a weather system (ex. Hail, Snow, Rain)? Just a thought.

    Also adding a time of day regulator that could change the color of the sky would be pretty cool too.



  • Is it possible to implement a weather system (ex. Hail, Snow, Rain)? Just a thought.

    Also adding a time of day regulator that could change the color of the sky would be pretty cool too.



  • I would LOVE if there was snow



  • I suppose it could be possible, since there is an entity for weather, which means it might be changeable by lua but what would be the point besides aesthetics?
    Also the color of the sky thing is also possible, but why put effort into stuff that is just a nice little effect?



  • It could effect the entire game the same way it effects real life. For example it starts to rain. This could erode away your weapons/equipments durability faster if its not made of water resistant materials. It could also cause things like fog, increased water gathering, or even make plants grow faster. Hail could probably do damage to anything if big enough.

    Those are just the things on the top of my mind, there’s plenty more it could be capable of.



  • Better idea. It rains. You are now wet.

    The end.

    That sounded less sexual in my head.



  • Imagination, its a great thing.

    Hey, like I said it’s just a thought. I don’t care if it’s rejected or accepted, just thought it was worth mentioning.

    Edit: Oh, well okay then.



  • Was referring to the kid above me. I want some weather too.



  • Might be neat to have certain herbs grow only at certain seasons, but other than that the only thing I could care about is if they affect monsters’ ability to fight. (night/fog making it harder for humans to see, slower stamina regen during rain or something).



  • Look at all the pretty particles lagging the server, tell the kids it’s snowing.



  • I doubt a func_precipitation set to like 15-20% will cause lag.



  • I wouldn’t use the hl2 entities if I did.



  • Adding in a a weather system opens a huge can of worms. For instance, if it can snow, it obviously is supposed to be cold. Is this supposed to affect your stats and abilities? Will you lose health from being too cold/hot? Ect ect. Just add rain and let it go at that.



  • Sure, whatever floats your boat. It is probably too much of a hassle to add hail, snow and such.



  • @JetBoom:

    I wouldn’t use the hl2 entities if I did.

    dont make me env_fire your ass



  • @Gir:

    Look at all the pretty particles lagging the server, tell the kids it’s snowing.

    I’m pretty sure func_precipitation is client-side



  • Weather would be great for having different stuff available to gather.  Ever time it rains a patch of mushrooms will appear somewhere, stuff like that.  This wouldn’t lag the server at all, since the effects are client-side the most it would do is lag you.  But obviously the particles will only fall in a small area around you, not across the whole map.  So it shouldn’t lag at all.



  • i hope it affects my HUD like in crysis



  • If there is a Weather System going up, I hope its going to be made well, I mean im sure it will be, but last time i got happy over Weather in Gmod was about 2 years ago, when this pile of crap got shat out on to the laps of GMod players “http://www.garrysmod.org/downloads/?a=view&id=19929

    Im a fan of LuaPineapple’s Lua coding, But that addon was just plain … bad



  • @Mystry:

    Adding in a a weather system opens a huge can of worms. For instance, if it can snow, it obviously is supposed to be cold. Is this supposed to affect your stats and abilities? Will you lose health from being too cold/hot? Ect ect. Just add rain and let it go at that.

    It really isn’t. I expanded upon the gamemode hooking so your active weapon and any status effects also get called in the hook. Everything in this is all connected and mingled together at a very low level. It’s designed from the ground up to be a sandbox capable of small or huge additions without having to edit existing code.

    Lets say I wanted to make it so you took extra cold damage and less fire damage when it was snowing in your particular zone. OK, couple of ways to do that. Here’s the simplest.

    
    function GM:EntityTakeDamage(ent, inflictor, attacker, amount, dmginfo)
    	if attacker == inflictor and attacker:IsProjectile() and dmginfo:GetDamageType() == DMG_CRUSH then -- Fixes projectiles doing physics-based damage.
    		dmginfo:SetDamage(0)
    		dmginfo:ScaleDamage(0)
    		return
    	end
    
    	if dmginfo:GetDamageType() == DMGTYPE_ENERGY then
    		dmginfo:SetDamage(dmginfo:GetDamage() * (1 + ent:WaterLevel() * 0.125))
    	end
    
    	if ent.ProcessDamage then
    		ent:ProcessDamage(attacker, inflictor, dmginfo)
    	end
    end
    
    

    That’s the current EntityTakeDamage. ProcessDamage lets the entity itself play with the dmginfo. The player for instance calls a bunch of global hooks (explained above) which lets everything from worn items, the weapon, any status entities (like protect from fire, haste, stun, hat_angelichalo, item_helmet_plate are all status entities) also play with dmginfo. We could then let zones also play with dmginfo:

    function GM:EntityTakeDamage(ent, inflictor, attacker, amount, dmginfo)
    	if attacker == inflictor and attacker:IsProjectile() and dmginfo:GetDamageType() == DMG_CRUSH then -- Fixes projectiles doing physics-based damage.
    		dmginfo:SetDamage(0)
    		dmginfo:ScaleDamage(0)
    		return
    	end
    
    	if dmginfo:GetDamageType() == DMGTYPE_ENERGY then
    		dmginfo:SetDamage(dmginfo:GetDamage() * (1 + ent:WaterLevel() * 0.125))
    	end
    
    	zone.ProcessDamage(ent, attacker, inflictor, dmginfo)
    
    	if ent.ProcessDamage then
    		ent:ProcessDamage(attacker, inflictor, dmginfo)
    	end
    end
    

    And then I could just stick this in the zones script:

    
    function zone.ProcessDamage(ent, attacker, inflictor, dmginfo)
    	local zonedata = zones[ent:GetZone]
    	if zonedata then
    		if zonedata.Weather == WEATHER_SNOW then
    			if dmginfo:GetDamageType() == DMGTYPE_COLD then
    				dmginfo:SetDamage(dmginfo:GetDamage() * 1.25)
    			elseif dmginfo:GetDamageType() == DMGTYPE_FIRE then
    				dmginfo:SetDamage(dmginfo:GetDamage() * 0.75)
    			end
    		end
    	end
    end
    
    

    That’s rough code and could definitely be modulated more but I don’t actually have a weather system to base off of.


Log in to reply
 

8
Online

11064
Users

15297
Topics

297973
Posts

Looks like your connection to NoXiousNet was lost, please wait while we try to reconnect.