Garry's Mod Wiki

Revision Difference

ENTITY:DoImpactEffect#515769

<function name="DoImpactEffect" parent="ENTITY" type="hook">⤶ <ishook>yes</ishook>⤶ <description>⤶ Called so the entity can override the bullet impact effects it makes.⤶ ⤶ <note>This hook only works for the "anim" type entities.</note>⤶ </description>⤶ <realm>Shared</realm>⤶ <predicted>No</predicted>⤶ <args>⤶ <arg name="tr" type="table">A &lt;page&gt;TraceResult&lt;/page&gt; from the bullet&#x27;s start point to the impact point</arg>⤶ <arg name="damageType" type="number">The damage type of bullet. See &lt;page&gt;DMG&lt;/page&gt;</arg>⤶ </args>⤶ <rets>⤶ <ret name="" type="boolean">Return true to not do the default thing - which is to call UTIL_ImpactTrace in C++</ret>⤶ </rets>⤶ </function>⤶ ⤶ <example>⤶ <description>Makes the ENT have the AR2 bullet impact effect.</description>⤶ <code>⤶ function ENT:DoImpactEffect( tr, nDamageType )⤶ ⤶ if ( tr.HitSky ) then return end⤶ ⤶ local effectdata = EffectData()⤶ effectdata:SetOrigin( tr.HitPos + tr.HitNormal )⤶ effectdata:SetNormal( tr.HitNormal )⤶ util.Effect( "AR2Impact", effectdata )⤶ ⤶ end⤶ </code>⤶ ⤶ </example>