[HL2 Ep2] npc_manhack death is not reported to npc_template_maker
I created a scenario where I wanted to have Manhacks attack the player. I wanted to have 18 total, but only have 3 active at a time. Using an npc_template_maker, I had the following numbers:
Num of NPCs: 18 Frequency: -1 Max Live NPCs: 3 Name of Template NPC: (the name of my npc_manhack, flagged as a Template NPC) Name of Destination Group: (the shared name of several info_npc_spawn_destinations)
The problem was, I would only get 3 Manhacks to appear and no further Manhacks would spawn on killing any of the initial 3. As such, I would never reach the Num of NPCs limit and any OnAllSpawnedDead outputs would never happen.
The two other observations I made which lead me to believe this is a bug:
- I would always get Max Live NPCs and nothing more. If I set it to 6, I get 6. If I set it to 18, I get all 18.
- Swapping the npc_manhack for an npc_combine_s, with no changes to the npc_template_maker, works correctly. I kill a Combine Soldier, another one appears, all the way until 18 are dead. The problem appears to be specific to npc_manhack.
I've made an example .vmf available at: http://www.sendspace.com/file/o5vxml
In this example, moving forward between the two posts will Enable the npc_template_maker. The maker is linked to four info_npc_spawn_destinations in the four corners of the room. It is told to spawn the entity named "metrocop" which happens to be an npc_manhack. You should see the problem manifest as watching 3 Manhacks spawn, and then no further Manhacks ever appearing when any of those Manhacks are killed. There is an npc_combine_s included in the .vmf. If you remove the "metrocop" name on the Manhack and give it to the Combine Soldier, you should see that the Combine Soldier will continually spawn new soldiers, keeping 3 active all the time, until the limit of 18 is reached.
To follow-up on a point, the npc_manhacks themselves seem to know when they die. Their OnDeath events fire correctly, they just aren't reporting it to the npc_template_maker.
It would also appear that if you have Max Live NPCs = Num of NPCs, killing the last of the spawned Manhacks does not trigger the OnAllSpawnedDead output either.
For what it's worth, this fellow reported a similar issue: https://github.com/Facepunch/garrysmod-issues/issues/1344
According to his observations, it seems like it has to do with killing them with the Gravity Gun as opposed to other means,.