While this isn’t something I’m particularly good with, I’ll try to summarize how I’ve been able to use the functions and what you could possibly do with them.
Starting off, you’ll probably want to know how to pass data along to the effect telling it what to do specifically to that time that you are spawning it. You can do this when spawning an effect using some of the functions found here. For instance, if you wanted to spawn your effect at the origin of the map you would want to do something along these lines.
local origin = Vector(0,0,0)
local ed = EffectData()
ed:SetStart( origin )
util.Effect( "myeffect", ed )
Now, on to actually creating the effect. You’ll need to have a folder directory similar to “…/gamemode_or_addon/entities/effects/myeffect” in order to actually spawn your effect, also note that the folder name of the effect is what you call when spawning it using util.Effect(). Inside the folder is only a single init.lua file including the 3 hooks found here. Generally, if you’re doing particle effects (Which is most likely), you’ll only really be using the init hook. Here’s a snippet of code with comments from a quick effect to show you how to use the functions that Chessnut had linked as well as this.
function EFFECT:Init( data )
self.Target = data:GetStart() // Grabs the vector that was set before the effect was created.
local Tar = self.Target
local emitter = ParticleEmitter( Tar ) // Creates the actual emitter
for i=1, 100 do // For loop to create 100 different particles
particle = emitter:Add( "sprites/light_glow02_add", Tar ) // Sets the particle's texture and starting position
local spawnpos = Vector(math.random(-512,512),math.random(-512,512),math.random(-206,206)) // Sets the ending position for the particle; done differently on each particle, pushing them all in different directions, effectively making a sphere.
local velvec = spawnpos:GetNormalized() // Normalizes the ending position
local velmult = math.random(300,350) // Speed in which the particle travels toward it's ending position
particle:SetVelocity(velvec*velmult) // Pushes the particle toward it's ending position at the randomized speed.
particle:SetDieTime(1) // Destroys the particle after 1 second
particle:SetStartAlpha(255) // Starts at fully visible
particle:SetEndAlpha(0) // Moves to not visible over the span of it's lifetime
particle:SetStartSize(math.random(5, 20)) // Randomly sets a starting size
particle:SetEndSize( 0 ) // Shrinks down to nothing at the end of it's lifetime
particle:SetColor( 255, 255, 255 ) // Leaves the color as white
particle:VelocityDecay( true )
emitter:Finish() // End's the emitter
function EFFECT:Think( )
With everything that I just showed you, the effect should look something like this in game if you were to change the starting point from the origin of the map to a players position. Of course you can’t see the particles below the player in that picture because of the platform below blocking it.
Of course there are a lot of other ways you can manipulate the particles to give any real effect you’d like. I hope that typing all of this out has been able to help you a decent amount on learning how to make effects, it really was a bitch to try to learn on my own and having a tutorial would have been useful.