CTakeDamageInfo

From GMod Wiki

Revision as of 17:25, 10 February 2011 by garry :D (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

"CTakeDamageInfo" is a class describing damage to be applied, or being applied to an entity.

Object Methods

NewerShared.png CTakeDamageInfo:__index
NewerShared.png CTakeDamageInfo:AddDamage
NewerShared.png CTakeDamageInfo:GetAmmoType
NewerShared.png CTakeDamageInfo:GetAttacker
NewerShared.png CTakeDamageInfo:GetBaseDamage
NewerShared.png CTakeDamageInfo:GetDamage
NewerShared.png CTakeDamageInfo:GetDamageForce
NewerShared.png CTakeDamageInfo:GetDamagePosition
NewerShared.png CTakeDamageInfo:GetDamageType
NewerShared.png CTakeDamageInfo:GetInflictor
NewerShared.png CTakeDamageInfo:GetMaxDamage
NewerShared.png CTakeDamageInfo:GetReportedPosition
NewerShared.png CTakeDamageInfo:IsBulletDamage
NewerShared.png CTakeDamageInfo:IsDamageType
NewerShared.png CTakeDamageInfo:IsExplosionDamage
NewerShared.png CTakeDamageInfo:IsFallDamage
NewerShared.png CTakeDamageInfo:ScaleDamage
NewerShared.png CTakeDamageInfo:SetAttacker
NewerShared.png CTakeDamageInfo:SetDamage
NewerShared.png CTakeDamageInfo:SetDamageForce
NewerShared.png CTakeDamageInfo:SetDamagePosition
NewerShared.png CTakeDamageInfo:SetDamageType
NewerShared.png CTakeDamageInfo:SetInflictor
NewerShared.png CTakeDamageInfo:SetMaxDamage
NewerShared.png CTakeDamageInfo:SubtractDamage

Additional Notes

CTakeDamageInfo.AddDamage Adds Damage to the current damage amount
CTakeDamageInfo.GetMaxDamage Returns the maximum damage possible.***
CTakeDamageInfo.GetAttacker Returns the attacker
CTakeDamageInfo.GetDamage Returns the current damage amount
CTakeDamageInfo.GetReportedPosition Where is the bullet hitpos.* **
CTakeDamageInfo.GetDamageForce Returns the force that the bullet (or whatever) has.
CTakeDamageInfo.GetDamagePosition Origin of the damage
CTakeDamageInfo.GetInflictor Returns the Inflictor, in most cases the Attacker.
CTakeDamageInfo.GetDamageType Returns the damage type as a Damagetype Enum.
CTakeDamageInfo.GetBaseDamage Gets the base damage. Appears to return the same value as GetDamage.
CTakeDamageInfo.GetAmmoType Returns the ammo type that did it
CTakeDamageInfo.IsExplosionDamage Returns true if an explosion did it
CTakeDamageInfo.IsFallDamage Returns true if a fall did it
CTakeDamageInfo.IsBulletDamage Returns true if a bullet did it
CTakeDamageInfo.IsDamageType Returns true if the specified damagetype enum did it
CTakeDamageInfo.ScaleDamage Scales the damage by the number given
CTakeDamageInfo.SetDamagePosition Set the position returned by GetDamagePosition
CTakeDamageInfo.SetMaxDamage Set the maximum damage
CTakeDamageInfo.SetDamageType Set the damage type
CTakeDamageInfo.SetDamageForce Set the damage force
CTakeDamageInfo.SetInflictor Set the inflictor
CTakeDamageInfo.SetAttacker Set the attacker
CTakeDamageInfo.SetDamage Set the damage amount
CTakeDamageInfo.SubtractDamage Remove this much damage from the damage amount

* Seems to be broken.
** For HL2 grenades this returns the position of the player who threw the grenade.
*** This will return max damage based on distance - In otherwords, the further you walk away, the less damage you take - Imagine point_hurt

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox