• Scripted Effects (quick help)
    2 replies, posted
I know how to make scripted entities and scripted weapons, but how do I make scripted [I]effects[/I]?? Just looking for how I set up the table and client, server, and shared files.
This would be a shared script that you throw into [b]entities/effects/[/b] as [b]myeffectname.lua[/b]. (Not in its own folder) Effects don't [i]have[/i] to be particle emitters, they can be used to draw models and all sorts of stuff. [lua] function EFFECT:Init( Data ) local vPos = Data:GetOrigin(); local iParticles = 32; local fSpeed = 512; -- Create dat emitter local Emitter = ParticleEmitter( vPos, true ); -- Emit dem particles yo. for i = 0, iParticles do -- Create da particaul local Particle = Emitter:Add( "particles/balloon_bit", vPos ); -- If it wer created success if ( Particle ) then local vDir = Vector( math.Rand( -1, 1 ), math.Rand( -1, 1 ), math.Rand( -1, 1 ) ); Particle:SetVelocity( vDir * fSpeed ); Particle:SetLifeTime( 0 ); Particle:SetDieTime( 10 ); Particle:SetStartAlpha( 255 ); Particle:SetEndAlpha( 255 ); Particle:SetStartSize( 1 ); Particle:SetEndSize( 1 ); Particle:SetRoll( math.Rand( 0, 360 ) ); Particle:SetRollDelta( math.Rand( 0.8, 1.0 ) ); -- They're rainbow particles. Particle:SetColor( math.random( 255 ), math.random( 255 ), math.random( 255 ) ); -- The balloon bits quickly lose speed and fall to the ground. Particle:SetAirResistance( 50 ); Particle:SetGravity( Vector( 0, 0, -300 ) ); -- They run into solid objects. Particle:SetCollide( true ); -- Other stuffffs Particle:SetBounce( 1 ); Particle:SetLighting( true ); end end -- After we emit the particles, we should destroy the emitter. Emitter:Finish(); end function EFFECT:Think() return false; -- No thinking for this particle. end function EFFECT:Render() -- In-case you made an effect that did other things like render a laser or model then -- you could put that shit right in here and WAH-BAM. pootis end [/lua]
Thanks!! :D
Sorry, you need to Log In to post a reply to this thread.