Garry's Mod Wiki

GM:ScaleNPCDamage

  GM:ScaleNPCDamage( NPC npc, number hitgroup, CTakeDamageInfo dmginfo )

Description

Called when an NPC takes damage.

This hook is called only when a specific hit group of the NPC is hit. In cases where the hitgroup doesn't matter, you should use GM:EntityTakeDamage instead!

Arguments

1 NPC npc
The NPC that takes damage
2 number hitgroup
The hitgroup (hitbox) enum where the NPC took damage. See HITGROUP enum
3 CTakeDamageInfo dmginfo
Damage info

Example

Double the damage whenever an NPC is hurt.

hook.Add( "ScaleNPCDamage", "ScaleNPCDamageExample", function( npc, hitgroup, dmginfo ) dmginfo:ScaleDamage( 2 ) end )