View Full Version : Killable NPCs
10-14-2007, 12:49 AM
I've got a question... I'm working on a map, and I want to give the player the ability to kill NPCs in a single player map. Basically you can walk up to them and shoot them if you so desire. At some points, it might actually be beneficial. Question is, how do I do this? I haven't seen anything in the flags or in digging through the Hammer documentation that says anything of the sort. It's not really a "one man against the world" map, but that doesn't mean all the NPCs are friendly. Or on your side. Or worth saving. So I want the player to have the ability to kill them. Any ideas?
10-14-2007, 12:57 AM
Which game are you refering to?
10-14-2007, 12:51 PM
Half-Life 2. Or perhaps I should take this to the Hammer forum is there is one.
10-14-2007, 02:06 PM
I don't think i've ever been able to kill friendly NPC's nor have an enemy as a friend.
10-14-2007, 02:34 PM
Well that's annoying. Kind of limits what you can actually do with the game, minus lots of coding. Maybe an OnHit or something like that. I have finally got the metro cops where they won't immediately shoot me, which is good. But I would like to make NPCs killable. I'll have to try some of the actions on them when I get back from work. If I can't kill friendly NPCs, then I'm going to have to come up with some other idea. And with my current idea, that basically means turning the entire map into a key hunt. I don't necessarily want a key hunt, either. Eh well. I may just go with my primary idea of having master keys. I don't really intend combat to be that important until much later. This isn't the HL2 world after all, just the models because I stink at modeling and skinning. Very annoying.
10-15-2007, 02:06 AM
For the NPC's that are enemies, and you don't want that:
You can set a relationship between the NPC and the player. These are set in code, but you can also change this in Hammer. The entity is called ai_relationship!
For the killable NPC's:
For practically every NPC there is a damage filter variable. I think that if you checked out how to enter this correctly (I thought it was something with !player) any NPC you want can receive damage from the player.
Hope this helps!! :cool:
10-15-2007, 07:56 AM
there are mods that allow the killing of NPCs so it can be done. I'm not sure whether it's done in editing scripts, or if it's handled with code.
vBulletin® v3.8.7, Copyright ©2000-2017, vBulletin Solutions, Inc.