WEAPON:DoImpactEffect

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

Contents

Description

Called so the weapon can override the impact effects it makes.

Arguments

table tr

A TraceResult structure from player's eyes to the impact point

Arguments

number damageType

The damage type of bullet

Returns

boolean

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

Examples

Example

Makes the SWEP have the AR2 bullet impact effect.

function SWEP: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