Head Shots

By LadylexUK

Note: This is designed to be used with a First person shooter brain for your player which has a crosshair.

This was surprisingly more difficult than I thought it would be. The problem appears to be that projectiles will always hit the center of the character and therefore, even with the best detection methods of where the projectile hits – it is never going to hit the head, even if you aim there. I tried invisible attachments and changing the way the gun aimed,  and that didnt work either. This is the solution I finally came up with. In the kode I used a goblin character. It actually works better with humanoid characters as the head is harder to hit. For a KO:VIR rebel I used the skull at 196% and used an Ancient Pillar at 28%.

For a one off single enemy

Turn collidable off on your goblin. This is important or the target parts will push it into the ground.

Create a head target (I used an Enchanted skull at 462%) make it invisible. Make sure it is attackable and collidable
Create a body target (I used an Ancient Battlement at 24%) make it invisible. Make sure it is attackable and collidable but immortal

In the head target brain (Enchanted skull)

  1. WHEN [IWP:goblin][is dead] DO [destroy]
  2. WHEN DO [position][equals][IWP:goblin][head][position]
  3. WHEN [hit by attack] DO [boolvar:headshot][equals][true]
  4. WHEN [boolvar:headshot]
  5. …WHEN DO [play fx][fx:Berserk Start][on][me]
  6. …WHEN DO [kill][IWP:goblin]

In the body target brain (Ancient Battlement)

  1. WHEN [IWP:goblin][is dead] DO [destroy]
  2. WHEN DO [position][equals][IWP:goblin][center][position]
  3. WHEN [hit by attack] DO [boolvar:bodyshot][equals][true]

In the goblin brain

  1. WHEN [IWP:Ancient Battlement][bodyshot]
  2. …WHEN [started to] DO [damage][10]
  3. …/….WHEN DO [IWP: Ancient Battlement][bodyshot][=][false]

For a templated spawned enemy

Now this works fine for a single one off enemy. If you are spawning a few of them you have to change this to:

Make all your objects and character templates.

In the head target brain (Enchanted skull)

  1. WHEN [creator][is dead] DO [destroy]
  2. WHEN DO [position][equals][creator][head][position]
  3. WHEN [hit by attack] DO [boolvar:headshot][equals][true]
  4. WHEN [boolvar:headshot]
  5. …WHEN DO [play fx][fx:Berserk Start][on][me]
  6. …WHEN DO [kill][creator]

In the body target brain (Ancient Battlement)

  1. WHEN [creator][is dead] DO [destroy]
  2. WHEN DO [position][equals][creator][center][position]
  3. WHEN [hit by attack] DO [boolvar:bodyshot][equals][true]

In the goblin brain

  1. WHEN [once]
  2. …WHEN DO [objvar:head][equals][create][IWP:Enchanted skull]
  3. …WHEN DO [objvar:body][equals][create][IWP: body]
  4. WHEN [objvar:head][bodyshot]
  5. …WHEN [started to] DO [damage][10]
  6. …/….WHEN DO [objvar:head][bodyshot][=][false]

Comments are closed.

Website Powered by WordPress.com.

Up ↑

%d bloggers like this: