Garry's Mod Wiki

Revision Difference

ENTITY:ImpactTrace#555115

<function name="ImpactTrace" parent="ENTITY" type="hook"> <description>Called when a bullet trace hits this entity and allows you to override the default behavior by returning true.</description> <realm>Client</realm> <args> <args> <arg name="traceResult" type="table">The trace that hit this entity as a <page>Structures/TraceResult</page>.</arg> <arg name="damageType" type="number">The damage bits associated with the trace, see <page>Enums/DMG</page></arg> <arg name="customImpactName" type="string" default="nil">The effect name to override the impact effect with. Possible arguments are ImpactJeep, AirboatGunImpact, HelicopterImpact, ImpactGunship.</arg> </args> <rets> <ret name="" type="boolean">Return true to override the default impact effects.</ret> </rets> </function> <example> <description>Hides the original bullet impact effect and dispatches explosions instead.</description> <code> function ENT:ImpactTrace(trace,dmgtype,customimpactname) local effectdata = EffectData() effectdata:SetOrigin( trace.HitPos ) util.Effect( "Explosion", effectdata ) return true end </code> </example>