-1

Trying to change damage modifier in Garry's Mod with lua, because sk_npc_head doesn't work. Here's the code I'm trying to use in Hammer Editor:

function FScaleNPCDamage( npc, hitgroup, dmginfo ) if ( hitgroup == HITGROUP_HEAD ) then dmginfo:ScaleDamage( 60 ) end end
  • that's just a syntactically correct function definiton. so if something is not behaving like you expect it either your expectations are wrong or you're using the function incorrectly. provide more code. – Piglet Mar 08 '21 at 09:55

1 Answers1

0

Example from the manual:

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

So your code should look something like

hook.Add("ScaleNPCDamage", "YourFancyNPCDamageHook", function (npc, hitgroup, dmginfo)
  if hitgroup == HITGROUP_HEAD then
    dmginfo:ScaleDamage(60)
  end
end)
Piglet
  • 27,501
  • 3
  • 20
  • 43