Garry's Mod Wiki

ENTITY:ImpactTrace

  boolean ENTITY:ImpactTrace( table traceResult, number damageType, string customImpactName = nil )

Description

Called when a bullet trace hits this entity and allows you to override the default behavior by returning true.

Arguments

1 table traceResult
The trace that hit this entity as a TraceResult structure.
2 number damageType
The damage bits associated with the trace, see DMG enum
3 string customImpactName = nil
The effect name to override the impact effect with. Possible arguments are ImpactJeep, AirboatGunImpact, HelicopterImpact, ImpactGunship.

Returns

1 boolean
Return true to override the default impact effects.

Example

Hides the original bullet impact effect and dispatches explosions instead.

function ENT:ImpactTrace(trace,dmgtype,customimpactname) local effectdata = EffectData() effectdata:SetOrigin( trace.HitPos ) util.Effect( "Explosion", effectdata ) return true end