- Home /
Head Shot = Instant kill for FPS enemies
My "Alien Zombies" have nice big fat heads and I'm wondering if it's possible to make it so that if they were shot in the head it would be an instant kill? As it is right now they have 100 hitpoints and my shotgun does 50 damage so it takes two shots to kill them which is fine. But I was thinking it would be more interresting or a bit more difficult if maybe I gave them some more hit points but somehow made it so that a head shot was an instant kill. Don't know if that's possible or not. They are animated characters made in Max 8 so they have a biped if that helps information wise any ;)
Answer by Dreamer · May 16, 2011 at 01:36 AM
1 If your head is individual part of the zombie model, you just tag it to be "Head". When collision happens, if bullet is colliding with head, you give it 100 damage.
2 If your zombie model is all together. You could create a sphere collider with mesh rending disabled and place it at zombie head and make tag to "Head". Rest is same.
Add: That depends on how you calculate damage. If you use a collision detect way with bullet. You could add below script to your bullet:
function OnCollisionEnter(collision : Collision) {
if(collision.gameObject.tag=="Head")
Player.DoDamage(100);
Destory(this.gameOjbect);
}
Well like I say my alien's body is a single mesh with a biped skeleton inside that controlls the animation. I did manage to attach a sphere collider to the the Biped head and tag that as "Head" Now where would I make my code adjustments? Would I make them to the shotgun script and if so How?
Your answer
Follow this Question
Related Questions
Shooting and health Help 0 Answers
Deal damage on collision 2 Answers
How to create Enemy Health Bar ? 4 Answers
One enemy triggers all the enemies 2 Answers
Health Script 1 Answer