Let's Code Some Effect-Based Weapons (that don't suck)
0 replies, posted
Alright, so I really want to know if anyone can help me with some effects. These include but are not limited to, muzzle flashes, tracers and hit effects. I think I know how to do hit decals.
under the bullet callback function:
[CODE]util.Decal( "FadingScorch", tr.HitPos + tr.HitNormal * 2, tr.HitPos - tr.HitNormal * 2 );[/CODE]
I have an example of a muzzle flash taken from a weapon that works; under the primary attack function:
[CODE]
local effect = EffectData();
effect:SetOrigin( self.Owner:GetShootPos() );
effect:SetEntity( self.Weapon );
effect:SetAttachment( 1 );
util.Effect( "NomadMuzzle", effect ); -- it's from the pulse weapons, which are nice.[/CODE]
and finally, I learned how to code hit impacts by using this:
[CODE]local HitImpact = function(attacker, tr, dmginfo)
local hit = EffectData()
hit:SetOrigin(tr.HitPos)
hit:SetNormal(tr.HitNormal)
hit:SetScale(20)
util.Effect( "AR2Impact", hit )
end[/CODE]
--and this--
Inside the SWEP.ShootBullet table...
[CODE]bullet.Callback = HitImpact[/CODE]
in order to call the hit impact on each bullet.
So I just want to ask the community, am I doing it right?
Sorry, you need to Log In to post a reply to this thread.