Killing the Citizen17 NPCs.

D

Dairun Cates

Guest
Hi. I'm a student at a college working on a project for a computer game development class. In our game we want to make it possible to kill the regular citizens walking around. It seems that it is possible to kill them when they are part of your squad, and other people can kill them, but the player can't. I have put about 15 hours into figuring out how to let them take damage from the player when they're not in your squad, but it has ended up being a long series of wild goose chases. Could someone with a bit of experience possibly tell me what you need to do to allow the npcs in npc_citizen17.cpp to die?
 
Why would your computer development class ask you to make the NPCs of HL2 become killable? I don't see how that would make sense. Unless you are just trying to fool me.
 
It's to do with the classify they're using. Search for all examples of 'Class_player_ally' or 'Class_resistance' or whatever they use. You'll come across a line that prevents damage.

-Angry Lawyer
 
Alright. I'll check that. Thanks. Also, to answer your question Judgeworm, our team leader wanted to make the NPC's killable simply because there's not going to be any instances where an NPC is important and we decided it would be more iteresting if you could kill NPCs with friendly fire.
 
I'm the author of the HL2 Friendly Fire mod which does just that, and then some. It was pretty simple really, the problem is, Valve seems to have put in a lot of blanket checks to make sure they can't take damage from the player.

To strictly make them take damage, you need to remove these checks. (npc_citizen17)

To make them fight back, you need to change their relationship with the player (hl2_gamerules)

To make them change sides once fired upon, there is a bit of code that needs to get added to the OnTakeDamage function.

If you have any specific questions, i can probably help you.

You can check out my mod here: http://www.pcgamemods.com/9738/ as a reference.

Adam
 
fifty7var said:
To make them change sides once fired upon, there is a bit of code that needs to get added to the OnTakeDamage function.

Do you mean the OnTakeDamage function in the npc_citizen17.cpp file or is there another one elsewhere? Also, not all npc's have a OnTakeDamage function, such as Breen. I want to be able to add code that will change relationships when a Class is fired upon, meaning if I shoot not a citizen but any ally of a citizen. Any ideas?
 
Yes, i was refering the the NPC_Citizen17.cpp one

you need to add an OnTakeDamage function for each class you want to damage.
 
Back
Top