As for npcs...
if (corpse.IsValid())Removing this doesn't fix it. It only appears to, but without this check it will just throw the NRE that you found by removing it.
I believe I've found the issue on why it works randomly, and fixed it in the next update. This is the fix:
if (entity is BasePlayer)
{
var npc = entity as BasePlayer;
var npcId = npc.userID;
var pos = npc.transform.position;
var entId = entity.net.ID;
NextTick(() =>
{
var corpses = Pool.GetList<NPCPlayerCorpse>();
Vis.Entities(pos, 3.0f, corpses);
var corpse = corpses.FirstOrDefault(x => x.playerSteamID == npcId);
if (corpse.IsValid())
{
damageInfos[entId].OnKilled();
lockInfos[corpse.net.ID] = new LockInfo(damageInfos[entId], Instance.config.LockNPCSeconds);
}
Pool.FreeList(ref corpses);
});
}
As for bradley and heli I am not sure yet. I believe it's because the initiator is lost somehow. I will check this further