Garry's Mod Wiki

Garry's Mod Wiki

  boolean ENTITY:DoImpactEffect( table tr, number damageType )

Description

Called so the entity can override the bullet impact effects it makes. This is called when the entity itself fires bullets via Entity:FireBullets, not when it gets hit.

This hook only works for the "anim" type entities.

Arguments

1 table tr
A TraceResult structure from the bullet's start point to the impact point
2 number damageType
The damage type of bullet. See DMG enum

Returns

1 boolean
Return true to not do the default thing - which is to call UTIL_ImpactTrace in C++

Example

Makes the ENT have the AR2 bullet impact effect.

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

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated twice a day. Edits and history are not available.

Last Parsed: Loading...