Post 16: Stealth Kills: Part 1

This session was about implementing the ability for the player to kill enemies stealthfully. The end result would aim to encourage play such as in the video below

Of course this is quite a refined version of the stealth kill function, but mechanically it seems pretty easy to break down:

Player sneaks behind enemy (undetected) >>> Prompt to stealth kill >>> Player pushes >>> Controls are disabled >>> Stealth kill animation in player and enemy plays >>> Controls are enabled.

The good part of this is that I have implemented a sneak mechanic previously and so that is already taken care of.

The prompt was taken care of by:

  1. Creating a box infront of the player that will trigger the prompt on overlap
  2. Creating a UI element that would pop up, prompting the player to push the required input.
  3. Creating the input, in this case I assigned it to [F]

From there I created an OnInput event for [F] and assigned an animation montage to it that would be distinct to stealth kills. This let’s the player know that they are engaged in a stealth kill.

For now I assigned a fairly generic one and will go back and replace it with a double animation once I figure out the logistics of it. I’m also leaving out the disabling of controls for now – but I know how and when I would do that anyway.

Next I added hit scan notifiers on the animation montage and stacked ten on top of each other. I’m now CONVICED that this is not the method I will use down the road, but will replace this at a later date.

It’s not quite like the above video, but I’ll work on this tommorrow to refine it a bit and get it working a bit better.

I also fixed a previous problem to do with animation interuptions which involved setting a character’s ready status as to reset at the start of each animation. This prevented the permanent disabling of controls.

However, this fix messed with the stealth kill function as a character would not be deemed attackable until they were ready and they weren’t set ready until fight animation montages were played. I’ve set the starting state of this ready bool to ‘true’ as a fix, but I forsee problems as a potential outcome down the line. I’ll leave it like this for now though….