Wind affecting physic?

Is there anykind of addons that add random wind based on time?
Where the wind also have an effect on the physic props for exemple?

Like, we have a wind blast, barrel is pushed.

If there’s none, is this possible to make? If it’s, any indication on how I could make it? Or help.

Thanks

I Think is was possible with conna’s Fan tool, but its broken for me, but i think people can fix it, ill go try…

I checked a bit the conna’s fan stool, but, I wondered, would it be possible to include that into the init.lua file, so it happen randomly in the game?

Holy fucking hell…Wolves I freaking love you, you just gave me possibly the best Idea I have ever had. But, I actually need the same thing you do now…:psylon:

Hehe o.o, tho I wonder if anyone can make a thing like this xP

Surely it’d just be a case of applying force to everything in a single direction for a time, and then changing that direction randomly from time to time. And varying the strength of the force, and add some woosh woosh sounds when the force goes above a certain level.

Ohhh, pick me! I made something similar to this a while ago (not finished), but it has that kind of idea.

[lua]concommand.Add(“wind”,function()
local function ClampVector(vec,x,y,z)
vec.x = math.Clamp(vec.x,-x,x)
vec.y = math.Clamp(vec.y,-y,y)
vec.z = math.Clamp(vec.z,-z,z)
end

local WIND = {}
WIND.nextwind = 0
WIND.moverate = 0.1
WIND.dir = Vector(0,0,0)
WIND.strength = 10
WIND.currentstage = "gusty"
WIND.stage_run = 0
WIND.stages = {
	["calm"] = { 
		intensity = 1,
		sounds = {
			Sound("ambient/wind/wasteland_wind.wav"),
			Sound("ambient/wind/wind_snippet1.wav"),
			Sound("ambient/wind/wind_snippet2.wav"),
		},
		soundwait = 10,
	},
	
	["medium"] = { 
		intensity = 2,
		sounds = {
			Sound("ambient/wind/wind_snippet3.wav"),
			Sound("ambient/wind/wind_med1.wav"),
			Sound("ambient/wind/wind_hit2.wav"),
			Sound("ambient/wind/wind_moan2.wav")
		},
		soundwait = 7,
	},
	
	["gusty"] = { 
		intensity = 4,
		sounds = {
			Sound("ambient/wind/wind_hit1.wav"),
			Sound("ambient/wind/wind_med2.wav"),
			Sound("ambient/wind/wind_snippet2.wav"),
			Sound("ambient/wind/wind_snippet5.wav"),
		},
		soundwait = 4,
	},
	
	["storm"] = {
		intensity = 8,
		sounds = {
			Sound("ambient/wind/wind_hit3.wav"),
			Sound("ambient/wind/windgust.wav"),
			Sound("ambient/wind/windgust_strong.wav"),
			Sound("ambient/levels/canals/windmill_wind_loop1.wav"),
		},
		soundwait = 2,
	},
}

hook.Add("Think","BlowWind",function()
	if CurTime() >= WIND.nextwind || CurTime() - WIND.nextwind > 20 then
	
		local poss_stage = math.random(1,20)
		if WIND.stage_run > 3 then
			if poss_stage == 10 then 
				WIND.currentstage = "medium"
				WIND.stage_run = 0
			elseif poss_stage == 11 then 
				WIND.currentstage = "gusty"
				WIND.stage_run = 0
			elseif poss_stage == 12 then 
				WIND.currentstage = "storm"
				WIND.stage_run = 0
			elseif poss_stage < 10 then 
				WIND.currentstage = "calm"	
				WIND.stage_run = 0
			end
		end
			
		local stageinfo = WIND.stages[WIND.currentstage]
		WIND.dir = WIND.dir + VectorRand()
		ClampVector(WIND.dir,1,1,0.1)
	
		WIND.strength = math.Rand(1 + stageinfo.intensity * 2,15 + stageinfo.intensity * 3) * math.pow(stageinfo.intensity,2)
		
		local snd = table.Random(stageinfo.sounds)
		for _,v in ipairs(player.GetAll()) do v:SendLua( "surface.PlaySound(\""..snd.."\")" ) end
		
		local velocity_inc = 0
		
		local orig_vels = {}
		for _,v in ipairs(ents.FindByClass("prop_physics")) do orig_vels[v:EntIndex()] = v:GetPhysicsObject():GetVelocity() end
		
		timer.Create("windMovement",WIND.moverate,SoundDuration(snd) / WIND.moverate,function()
		
			velocity_inc = math.Clamp( velocity_inc + 1 / (SoundDuration(snd) / WIND.moverate), 0, 1 )
			local objs = ents.FindByClass("prop_physics")
			for _,v in ipairs( objs ) do
				local index = v:EntIndex()
				if not orig_vels[index] then orig_vels[index] = Vector(0,0,0) end
				local phys = v:GetPhysicsObject()
				if phys:IsValid() || ValidEntity(v) then
					local vel = WIND.dir * WIND.strength * velocity_inc / ( math.Clamp(phys:GetMass(),5,10000) / 5 )
					if phys:GetVelocity():Length() < orig_vels[index]:Length() then orig_vels[index] = phys:GetVelocity() end
					phys:SetVelocity( orig_vels[index] + vel ) 
				end
			end
			
		end)
		
		WIND.nextwind = CurTime() + SoundDuration(snd) + math.Rand(0,stageinfo.soundwait)
		WIND.stage_run = WIND.stage_run + 1
		PrintTable(WIND)
	end
end)

[/lua]

It moves all prop_physics in a certain direction with a certain velocity, and plays sounds according to the intensity of the wind.

I looked a bit onto it, fixed up a case of missing end) apparently, now it has no errors. It work as it should. (Edited, after fixing another thing)

Edit: Tho most of the props just push down on the grounds.