Sorry I’ve been looking for 20 minutes, I must be brain dead.
I can tell you my way, don’t know any other.
Source SDK > Valve Hammer Editor > Texture selection tool > Type in search box: ‘particles/’ or ‘sprites/’
Thanks dude! I am working with a ParticleEmitter for the first time. Can you use sprites, particles, and effects with it?
Yes, pretty much.
[editline]20th June 2013[/editline]
Are these something I can use or am I way off?
These are basic effects already done, you can modify them like their size, color, sound, but nothing else.
Creating own effect looks quite different, if you want I can paste one of my effects here.
Sweet that’s what I was looking for, and ya why not It’s always nice to see how they operate rather then straight up jacking them =D
Future reference for anyone looking for particles here is a list for the orange box games:
local NumParticles = 64 local emitter = ParticleEmitter(data:GetOrigin()) for i = 0, NumParticles do local Pos = (data:GetOrigin()) local particle = emitter:Add("particle/particle_smokegrenade", Pos) -- Add particle to the emitter if (particle) then particle:SetVelocity(VectorRand() * math.Rand(200, 400)) -- Setup variables particle:SetLifeTime(0) particle:SetDieTime(1.5) particle:SetColor(255, 255, 255) particle:SetStartAlpha(255) particle:SetEndAlpha(0) particle:SetStartSize(10) particle:SetEndSize(25) particle:SetRoll(math.Rand(-360, 360)) particle:SetRollDelta(math.Rand(-0.21, 0.21)) particle:SetAirResistance(math.Rand(500, 800)) particle:SetGravity(Vector(0, 0, -50)) particle:SetCollide(true) particle:SetBounce(0.45) end end emitter:Finish()
Oh sweet that’s how you actually make one? I thought that was how you would simply spawn one, here is my code:
concommand.Add("idkwhatimdoing", function() local centr = LocalPlayer():GetPos() local em = ParticleEmitter(centr) for i=1, 20 do local part = em:Add("sprites/light_glow02_add",centr) if part then part:SetColor(255,0,0,math.random(255)) part:SetVelocity(Vector(math.random(-1,1),math.random(-1,1),math.random(-1,1)):GetNormal() * 20) part:SetDieTime(20.5) part:SetLifeTime(0) part:SetStartSize(10) part:SetEndSize(0) end end em:Finish() end)
[editline]20th June 2013[/editline]
Stupid question but how do I use one of the particles from the valve developer website I linked in the previous post?
One thing to note that when creating ParticleEmitter using Lua, make sure you only create one and then update the position if one exists. If you create one every time you want to do an effect you will overflow the linked list after a while.
You can also do
[lua]local em = em or ParticleEmitter(centr)[/lua]
This way you won’t be creating a new PE unless it doesn’t exist
Thanks for all the info I really appreciate it it man! Also how do I use one of these particles?
local part = em:Add("particle/bday_1balloon",centr)
Also tried it a few other ways, how do you properly do this?
Here’s my post on the subject which you may use: http://forum.facepunch.com/showthread.php?t=1258949&p=40858568&viewfull=1#post40858568
I’m considering doing a pull request with a new function name ( SafeParticleEmitter ), but the problem with not overwriting the current function is that existing improper use will still break. So, the code I posted will work to resolve incorrect client-side implementations of ParticleEmitter.
Instead of using a fix like this though, it’s better to code it properly from the start, hopefully the OP can use this code to see what I did and adapt it for his/her own benefit
Thanks for the info Acecool! Any responses to my previous post?