Entity/TakeDamageInfo

From Garry's Mod
Revision as of 22:45, 23 February 2019 by Code gs (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
 Entity:TakeDamageInfo( )

Contents

Description

Applies the damage specified by the damage info to the entity.

WARNING

Calling this function on the victim entity in ENTITY:OnTakeDamage can cause infinite loops.

Arguments

CTakeDamageInfo damageInfo

The damage to apply.

Examples

Example

Dissolve the target into oblivion.

function DissolveIt( ent )
	local d = DamageInfo()
	d:SetDamage( ent:Health() )
	d:SetAttacker( ent )
	d:SetDamageType( DMG_DISSOLVE )

	ent:TakeDamageInfo( d )
end

DissolveIt( Entity( 1 ) )


Personal tools
Navigation