Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- counter = 0
- local thunderSounds = {
- "ambient/ambience/rainscapes/thunder_close01.wav",
- "ambient/ambience/rainscapes/thunder_close02.wav",
- "ambient/ambience/rainscapes/thunder_close03.wav",
- "ambient/ambience/rainscapes/thunder_close04.wav",
- "ambient/ambience/rainscapes/thunder_distant01.wav",
- "ambient/ambience/rainscapes/thunder_distant02.wav",
- "ambient/ambience/rainscapes/thunder_distant03.wav",
- }
- local lightMul = 0
- local lightningStrike = false
- local function MakeThunder()
- lightMul = math.Rand(0.5,1)
- timer.Simple(math.Rand(0.5,2), function()
- local snd = thunderSounds[math.random(1,#thunderSounds)]
- LocalPlayer():EmitSound(snd)
- end)
- lightningStrike = true
- timer.Simple(math.Rand(30,60), MakeThunder)
- end
- timer.Simple(math.Rand(5,20), MakeThunder)
- //local emitter = ParticleEmitter(LocalPlayer():GetPos())
- -- emitter:SetParticleCullRadius(1)
- local emitter3d = ParticleEmitter(LocalPlayer():GetPos(), true)
- -- snd1:Play()
- -- snd2:Play()
- hook.Add("PreDrawSkyBox", "Rain PreDrawSkyBox", function()
- end)
- local mat = Material( "models/debug/debugwhite" )
- local mat = CreateMaterial( "WhiteMaterial", "UnlitGeneric", { -- Necessary to assign color by vertex
- ["$basetexture"] = "color/white",
- ["$vertexcolor"] = 1, -- Necessary to assign color by vertex
- ["$vertexalpha"] = 1, -- Necessary to assign alpha to vertex
- ["$model"] = 1
- } );
- local lightning =
- {
- {
- rad = 0,
- segments = {
- Vector(100,0,0),
- Vector(0,100,0),
- Vector(-25,50,0)
- },
- life = 1
- }
- }
- local nextCloudEmit = 0
- hook.Add("PostDrawSkyBox", "Rain PostDrawSkyBox", function()
- lightMul = math.Approach(lightMul, 0, FrameTime() * 3)
- local alpha = 200 + (55 * lightMul)
- cam.Start3D(LocalPlayer():EyePos(),LocalPlayer():EyeAngles())
- render.SuppressEngineLighting(true)
- local light = 255 * lightMul
- render.SetMaterial( mat )
- render.DrawQuadEasy( Vector(0,0,10240), --position of the rect
- Vector(0,0,-1), --direction to face in
- 20480, 20480, --size of the rect
- Color( light, light, light, alpha ), --color
- 90 --rotate 90 degrees
- )
- render.SetMaterial( mat )
- render.DrawQuadEasy( Vector(0,10240,0), --position of the rect
- Vector(0,-1,0), --direction to face in
- 20480, 20480, --size of the rect
- Color( light, light, light, alpha ), --color
- 90 --rotate 90 degrees
- )
- render.SetMaterial( mat )
- render.DrawQuadEasy( Vector(0,-10240,0), --position of the rect
- Vector(0,1,0), --direction to face in
- 20480, 20480, --size of the rect
- Color( light, light, light, alpha ), --color
- 90 --rotate 90 degrees
- )
- render.SetMaterial( mat )
- render.DrawQuadEasy( Vector(10240,0,0), --position of the rect
- Vector(-1,0,0), --direction to face in
- 20480, 20480, --size of the rect
- Color( light, light, light, alpha ), --color
- 90 --rotate 90 degrees
- )
- render.SetMaterial( mat )
- render.DrawQuadEasy( Vector(-10240,0,0), --position of the rect
- Vector(1,0,0), --direction to face in
- 20480, 20480, --size of the rect
- Color( light, light, light, alpha ), --color
- 90 --rotate 90 degrees
- )
- render.SuppressEngineLighting(false)
- cam.End3D()
- if(nextCloudEmit < CurTime()) then
- p = emitter3d:Add("particle/smokesprites_000" .. math.random(1,9), Vector(math.Rand(-8000,8000),math.Rand(-8000,8000),5000))
- p:SetColor(50, 50, 50)
- p:SetLifeTime(0)
- p:SetDieTime(30)
- p:SetStartSize(10500)
- p:SetEndSize(0)
- p:SetStartAlpha(0)
- p:SetEndAlpha(180)
- p:SetRoll(math.Rand(0,360))
- p:SetAngles(Angle(90,0,0))
- nextCloudEmit = CurTime() + 0.3
- end
- if(lightningStrike) then
- lightningStrike = false
- p = emitter3d:Add("particle/smokesprites_000" .. math.random(1,9), Vector(math.Rand(-8000,8000),math.Rand(-8000,8000),4900))
- p:SetColor(255, 255, 255)
- p:SetLifeTime(0)
- p:SetDieTime(0.1)
- p:SetStartSize(5500)
- p:SetEndSize(0)
- p:SetStartAlpha(255)
- p:SetEndAlpha(0)
- p:SetRoll(math.Rand(0,360))
- p:SetAngles(Angle(90,0,0))
- end
- end)
- hook.Add("Tick", "Test08", function()
- local p = nil
- local q = nil
- local w = nil
- local s = nil
- local emitter = ParticleEmitter(LocalPlayer():GetPos())
- local retr = LocalPlayer():GetPos() + (LocalPlayer():GetVelocity() * 0.5)
- for i=1,60 do
- local temp = retr
- temp = Vector(temp.x + math.random(-1500, 1500),temp.y + math.random(-1500, 1500),1000)
- p = emitter:Add("particle/snow", temp)
- p:SetCollide(true)
- p:SetLifeTime(0)
- p:SetDieTime(0.7)
- p:SetStartSize(1)
- p:SetStartAlpha(255)
- p:SetEndAlpha(255)
- p:SetStartLength(50)
- p:SetEndLength(50)
- p:SetVelocity(Vector(0,0,-3000 + math.random(0, 500)))
- p:SetCollideCallback(function(part, hitpos, hitnormal)
- q = emitter:Add("particle/smokesprites_000" .. math.random(1,9), hitpos)// + (hitnormal * Size))
- q:SetLifeTime(0)
- q:SetDieTime(0.4)
- q:SetStartSize(math.Rand(15,30))
- q:SetEndSize(0)
- q:SetStartAlpha(16)
- q:SetEndAlpha(0)
- q:SetRoll(math.random(0,360))
- q:SetRollDelta(math.Rand(-0.52,0.52))
- //if(math.random(0,50) == 0) then
- counter = counter+1
- if(counter >= 160) then
- local temp3 = 1 - 1/LocalPlayer():GetPos():Distance(hitpos)
- WorldSound("rain".. math.random(1,4) ..".wav", hitpos, (75*temp3), (50*temp3)+50)
- counter = 0
- end
- end)
- end
- for i=1,3 do
- local temp2 = retr
- temp2 = Vector(temp2.x + math.random(-5000, 5000),temp2.y + math.random(-5000, 5000),1000)
- w = emitter:Add("particle/snow", temp2)
- w:SetCollide(true)
- w:SetLifeTime(0)
- w:SetDieTime(0.7)
- w:SetStartSize(1)
- w:SetStartAlpha(255)
- w:SetEndAlpha(255)
- w:SetStartLength(50)
- w:SetEndLength(50)
- w:SetVelocity(Vector(0,0,-3000))
- w:SetCollideCallback(function(part, hitpos, hitnormal)
- local Size = math.Rand(180,480)
- s = emitter:Add("particle/smokesprites_000" .. math.random(1,9), hitpos + ((hitnormal/2) * Size))
- s:SetLifeTime(0)
- s:SetDieTime(10)
- s:SetStartSize(Size)
- s:SetEndSize(math.Rand(180,480))
- s:SetStartAlpha(5)
- s:SetEndAlpha(2)
- s:SetRoll(math.random(0,360))
- s:SetRollDelta(math.Rand(-0.2,0.2))
- end)
- end
- emitter:Finish()
- end)
Add Comment
Please, Sign In to add comment