Garry's Mod Wiki

Revision Difference

GM:ScaleNPCDamage#517784

<function name="ScaleNPCDamage" parent="GM" type="hook"> <ishook>yes</ishook> <description> Called when an NPC takes damage. <note>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 <page>GM:EntityTakeDamage</page> instead!</note> </description> <realm>Server</realm> <predicted>No</predicted> <args> <arg name="npc" type="NPC">The NPC that takes damage</arg> <arg name="hitgroup" type="number">The hitgroup (hitbox) enum where the NPC took damage. See &lt;page&gt;HITGROUP&lt;/page&gt;</arg>⤶ <arg name="hitgroup" type="number">The hitgroup (hitbox) enum where the NPC took damage. See <page>HITGROUP</page></arg>⤶ <arg name="dmginfo" type="CTakeDamageInfo">Damage info</arg> </args> </function> <example> <description>Double the damage whenever an NPC is hurt.</description> <code> hook.Add( "ScaleNPCDamage", "ScaleNPCDamageExample", function( npc, hitgroup, dmginfo ) dmginfo:ScaleDamage( 2 ) end ) </code> </example>