Entity/TakeDamageInfo

From Garry's Mod
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