Player damage & NPCs + Teams


Running into an issue trying to add NPC’s to a team-based gamemode. From my testing it looks like melee weapon hits made by NPCs on a player are removed, preventing any damage from being done or modifying the damage through typical hooks like PlayerShouldTakeDamage(), etc. Here’s what I’m seeing in my tests, where I used a stock sandbox instead of the gamemode I’m actually working on, to avoid any conflicts or surprises:

  1. Run traditional sandbox, add an npc_zombie. Zombie attacks player with melee weapon (slashes).
  2. Add rudimentary team capabilities (actually, simply doing ply:AddTeam(1) during initial spawn is enough to create the problem)
  3. Add an npc_zombie. The zombie will swing at the player, but no contact is made. (no bounce, no damage, no hit sound)
  4. Change the AddTeam to ply:AddTeam(0), and everything works again.

If I use an npc_combine_s, the npc can fire his ranged weapon and inflict damage without issue, but again, at close range his melee weapon (elbow) does nothing.

This feels like a bug, but I don’t want to go there yet. Can anyone else comment on NPC melee weapon usage when players are assigned to teams?


Never mind. Confirmed it’s a bug or at the least some undocumented aspect of Team IDs 1 through 4.