Because i was being stupid ?
I've made a nice big red firework now.. now to make it appear at the trace of the payer view.. i wonder.
Oh.. I made the snow, but i dont know how to make it all spread out when it starts. It starts in a little circle.
[lua]
local centr = Vector(1.91,89.58,494.33)
local em = ParticleEmitter(centr)
for i=1, 20 do
local part = em:Add("sprites/light_glow02_add",centr)
if part then
part:SetColor(255,255,255,math.random(255))
part:SetVelocity(Vector(math.random(-1,1),math.random(-1,1),math.random(-1,1)):GetNormal() * 20)
part:SetDieTime(500)
part:SetLifeTime(200)
part:SetStartSize(10)
part:SetEndSize(0)
part:SetGravity(Vector(0,0,-200))
end
end
em:Finish()
[/lua]
to make it a bigger "bang" change that *20 to *1000 and mess with the Velocity.
[lua]
if CLIENT then
function startthesnows()
timer.Stop("snowtimerz")
local em = ParticleEmitter(Vector(0,0,100))
timer.Create("snowtimerz",0.1,0,function()
for i=1, 50 do
local par = em:Add( "particle/snow",LocalPlayer():GetPos() + Vector(0,0,1000) )
par:SetVelocity( Vector(math.random(-700,700),math.random(-700,700),math.random(-100,-30)) )
par:SetDieTime(20)
par:SetStartAlpha(0)
par:SetEndAlpha( 255 )
par:SetStartSize( 4 )
par:SetEndSize( math.random(0,3) )
par:SetColor(255,255,255 )
par:SetRoll( math.random( 0, 360 ) )
end
end)
end
else
AddCSLuaFile( "spensnow.lua" )
function dafurztspwn(ply)
ply:SendLua("startthesnows()")
end
hook.Add( "PlayerInitialSpawn", "playtehsnow", dafurztspwn )
end[/lua]
Put it in your server's lua/autorun folder and name it spensnow.lua (or you can rename it to whatever and change the AddCSLuaFile)
I'm sure people have done better, but that's my attempt at snow.
[editline]12:41AM[/editline]
Ignore the crappy function names. It was just to practice the particle emitter.
This is what i've achieved.
Here's some pics.
[img]http://i154.photobucket.com/albums/s249/wracc2/gm_construct0050.jpg[/img]
I have them bound to keys.
I put this:
[lua]
function startthesnows()
timer.Stop("snowtimerz")
local em = ParticleEmitter(Vector(0,0,400))
timer.Create("snowtimerz",0.1,0,function()
for i=1, 50 do
local par = em:Add( "particle/snow",LocalPlayer():GetPos() + Vector(0,0,1000) )
par:SetVelocity( Vector(math.random(-700,700),math.random(-700,700),math.random(-100,-30)) )
par:SetDieTime(20)
par:SetStartAlpha(0)
par:SetEndAlpha( 255 )
par:SetStartSize( 4 )
par:SetEndSize( math.random(0,3) )
par:SetColor(255,255,255 )
par:SetRoll( math.random( 0, 360 ) )
end
end)
end
[/lua]
into my cl_init.lua and i dont see anything
-SNIP- Made some errors.
Now works fine for me.
[lua]
function startthesnows()
timer.Stop("snowtimerz")
local em = ParticleEmitter(Vector(0,0,400))
timer.Create("snowtimerz",0.1,0,function()
for i=1, 50 do
local par = em:Add( "particle/snow",LocalPlayer():GetPos() + Vector(0,0,1000) )
par:SetVelocity( Vector(math.random(-700,700),math.random(-700,700),math.random(-100,-30)) )
par:SetDieTime(20)
par:SetStartAlpha(0)
par:SetEndAlpha( 255 )
par:SetStartSize( 4 )
par:SetEndSize( math.random(0,3) )
par:SetColor(255,255,255 )
par:SetRoll( math.random( 0, 360 ) )
end
end)
em:Finish()
end
concommand.Add( "snow", startthesnows )
[/lua]
[editline]01:02AM[/editline]
run the lua file or however your doing it then do snow in console
[editline]01:07AM[/editline]
Also i got a really nice effect with this.
[lua]
function startthesnows()
timer.Stop("snowtimerz")
local em = ParticleEmitter(Vector(0,0,400))
timer.Create("snowtimerz",0.1,0,function()
for i=1, 2000 do
local par = em:Add( "particle/snow",LocalPlayer():GetPos() + Vector(0,0,1000) )
par:SetVelocity( Vector(math.random(-700,700),math.random(-700,700),math.random(-100,-30)) )
par:SetDieTime(20)
par:SetStartAlpha(0)
par:SetEndAlpha( 255 )
par:SetStartSize( 6 )
par:SetEndSize( math.random(0,6) )
par:SetColor(255,255,255 )
par:SetRoll( math.random( 0, 360 ) )
end
end)
em:Finish()
end
concommand.Add( "snow", startthesnows )
[/lua]
With Post proc too.
[IMG]http://i154.photobucket.com/albums/s249/wracc2/gm_construct0056.jpg[/IMG]
[IMG]http://i154.photobucket.com/albums/s249/wracc2/gm_construct0058.jpg[/IMG]
With the script I posted, it will start the snow for players as soon as they join. Not sure why you changed it.
[IMG]http://i154.photobucket.com/albums/s249/wracc2/gm_construct0059.jpg[/IMG]
[editline]01:10AM[/editline]
I just made the snow heavier, more realistic.
Ah cool cool, I haven't really messed with particles too much. They're pretty fun though and you can make really cool things on accident :)
Yeh!, i have only just learned geteyetrace from this!
Sorry, you need to Log In to post a reply to this thread.