2

It seems like a very simple thing, but I just can't find the answer.

In the Source Hammer Editor, how does one change the health of an NPC?

I don't really think there is anything else I can add.

1 Answer 1

1

There's two ways to do this:

If you want to change an individual NPC's health, you can use the SetHealth or AddHealth inputs -- hook them up to a logic_auto for it to trigger on map spawn.

If you want to change the health of every NPC of a certain class, there's usually a ConVar associated with it which you can look up on the Valve Developer Wiki. For npc_combine_s (Combine Soldiers) for instance, it's sk_combine_s_health.

6
  • I have finally tried the first option, to set the health of an individual NPC, and that works - thanks. However, I just realised that I do need to set the health of all NPC's of a class. Do you think you could give more elaboration of how to set the health of a class? Thanks. Oct 1, 2017 at 5:42
  • @PlanetAlexander What NPC is this? Is this for a standalone mod or are you just mapping? Do you want to change it across all maps or just a specific one? Oct 1, 2017 at 16:48
  • I'm looking to change it for both npc_citizen and npc_metropolice. I'm just creating a map, and I'm only wanting it to be a single map. Oct 1, 2017 at 20:30
  • @PlanetAlexander Hmm that's tough because the ConVar has to be changed before all the NPCs spawn, and HL2 doesn't have map config files like CS:GO. You can try a logic_auto hooked up to a point_servercommand Command "sk_metropolice_health <health>" but I don't think it'll work because the logic_auto will fire after the NPCs spawn. Oct 4, 2017 at 2:46
  • 1
    @PlanetAlexander Oh, that's easier then. You can use a filter_damage_type. Bitwise or all of the different damage types listed (they're bit flags) together and set the filter to Disallow, then set your NPC's Damage Filter property to the filter's target name. Oct 11, 2017 at 19:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .