A class used to store and modify all the data concerning a damage event. An empty CTakeDamageInfo object can be created with DamageInfo
List of hooks that this object is passed to:
List of functions that use this object:
Returns the ammo type used by the weapon that inflicted the damage.
Returns the attacker ( character who originated the attack ), for example a player or an NPC that shot the weapon.
Returns the initial unmodified by skill level ( game.GetSkillLevel ) damage.
Gets the custom damage type. This is used by Day of Defeat: Source and Team Fortress 2 for extended damage info, but isn't used in Garry's Mod by default.
Returns a vector representing the damage force. Can be set with CTakeDamageInfo:SetDamageForce.
Returns the position where the damage was or is going to be applied to. Can be set using CTakeDamageInfo:SetDamagePosition.
Returns a bitflag which indicates the damage type(s) of the damage. Consider using CTakeDamageInfo:IsDamageType instead. Value returned by this function can contain multiple damage types.
Returns the inflictor of the damage. This is not necessarily a weapon. For hitscan weapons this is the weapon. For projectile weapons this is the projectile. For a more reliable method of getting the weapon that damaged an entity, use GetAttacker with GetActiveWeapon.
Returns the initial, unmodified position where the damage occured.
boolean CTakeDamageInfo:IsDamageType( number dmgType )
Returns whenever the damageinfo contains the damage type specified.
Returns whenever the damageinfo contains explosion damage.
CTakeDamageInfo:SetAmmoType( number ammoType )
Changes the ammo type used by the weapon that inflicted the damage.
CTakeDamageInfo:SetAttacker( Entity ent )
Sets the attacker ( character who originated the attack ) of the damage, for example a player or an NPC.
CTakeDamageInfo:SetBaseDamage( number )
Sets the initial unmodified by skill level ( game.GetSkillLevel ) damage. This function will not update or touch CTakeDamageInfo:GetDamage.
CTakeDamageInfo:SetDamageBonus( number damage )
Sets the bonus damage. Bonus damage isn't automatically applied, so this will have no outer effect by default.
CTakeDamageInfo:SetDamageCustom( number DamageType )
Sets the custom damage type. This is used by Day of Defeat: Source and Team Fortress 2 for extended damage info, but isn't used in Garry's Mod by default.
CTakeDamageInfo:SetDamagePosition( Vector pos )
Sets the position of where the damage gets applied to.
CTakeDamageInfo:SetInflictor( Entity inflictor )
Sets the inflictor of the damage for example a weapon. For hitscan/bullet weapons this should the weapon. For projectile ( rockets, etc ) weapons this should be the projectile.