ENTITY/DoImpactEffect

From Garry's Mod
Jump to: navigation, search
 ENTITY:DoImpactEffect( )

Contents

Description

Called so the entity can override the bullet impact effects it makes.

Next Update Change

This feature is only available in the next update.
NOTE

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

Arguments

table tr

A TraceResult structure from the bullet's start point to the impact point

Arguments

number damageType

The damage type of bullet. See DMG_ Enums

Returns

boolean

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

Examples

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


Personal tools
Navigation