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 Enums/HITGROUP
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 )

Page Links


Special Pages


Wikis

?

Render Time: 104ms

DB GetPage 52
Generate Html 11
SaveChanges (1) 24
Render Body 0
Render Sidebar 14