Does this zombie want peace or is he about to claw at me? I spent some time recently playing my Zombie Walkers mod on survival and reall...

Slower Attack Animations

Does this zombie want peace or is he about to claw at me?
I spent some time recently playing my Zombie Walkers mod on survival and really enjoyed it. One thing that bothered me though was how often I died whenever I attempted to use melee. I guess I didn't realize that even though the zombie move slow, they still swing their arms and bite at ninja speed and it is difficult to get the very important first hit in.

Attack Animations

Attacks, like other actions, are tied to animations associated with an actor. Animation is one area I hadn't delved into yet in the Creation Kit other than disabling a few. Bethesda used an SDK called Havok to create them and the tooling to customize them is not made available to modders.

As a result, the options are limited. I tried experimenting with various settings on the Unarmed Feral Ghoul weapon used by the zombies to lower attack speed, but none of the settings seemed to have any effect. It appeared the attack speed was linked to the actual animations.

Bethesda Forum to the Rescue

I eventually came upon this forum post where others had observed the same things I did:


The 19th post on this thread states the following:
The best solution so far is to:
1. Make a magic effect with Peak Value Modifier and AnimationMult (set other parameters to your liking)
2. Give a melee weapon or some armor piece that magic effect via an enchantment
3. On the enchantment, add a condition to trigger the effect only if IsAttacking = 1 and some keyword that links back to that weapon
That should essentially give what you're looking for, except the very first swing of the weapon.
AnimationMult is the key. This is a multiplier that controls the speed of ALL animations on the target actor. 100 is the default and lowering it will slow down animations.

I applied this to a "bloody hands" piece of armor and gave that to all the zombies and verified that it does indeed work after the first attack. It's a good start, but I wanted it to work even with their first attack since that was really the important one (especially if you play with infection enabled).

Slowing Down the First Attack

I expanded on the IsAttacking condition by adding a condition on proximity to the player. If the zombie is attacking OR the zombie is within a certain radius nearby the player, then slow down ALL of the zombies animations. I tried to optimize the radius by trial and error to be close enough to trigger before the zombie is close enough to attack but not much further away so that it slows them down while moving toward the player. It mostly works, though once in awhile they still manage to get a ninja-like swing in.

The solution above seems like a hack. It accomplishes what I wanted it to, but it gives me that feeling like I'd really like to revisit this and do it the "right" way at some point, assuming there is one. The issue is that AnimationMult slows down ALL animations, so it includes zombies reacting to getting hit, getting up off the ground, etc. Ideally, just the attack animations would be slower and they would still fall to the ground or stagger at normal speed.

Behavior Graphs

Through researching animations, I became more familiar with the behavior graph that governs when they play. I didn't end up needing them to implement the solution for slower attack speed described above, but the knowledge has helped in disabling animations that don't fit.

The behavior graph is basically a tree structure of conditional branches with leaf nodes that are animations to be played. You can view them in the Creation Kit by going to Gameplay -> Animations... menu. The nodes in the tree are animation events and can have conditions added to them. To disable animations, you simply need to add a condition that will return false. In my case I added a constant global property called ZombieWalkers_Disable_Animations that is set to 1 and add a condition to check the value is not 1 to disable an animation.

The Feral Ghoul (Zombie) jumping neck bite finishing animation disabled by adding a new condition.
The behavior graph may come into play when I revisit NPC Resurrection. I have a custom race for NPCs that are zombified but still look like a human/ghoul. Right now they use the standard human/ghoul behavior graph which is why they behave like them. 

I'm hoping to be able to set the customs races up as "additive" to override things or even assign them their own unique behavior graph. Doing so may allow me to disable animations that don't fit with them being a zombie.

Replacing Animations

Another thing I learned that didn't come into play for the solution but may be useful is how to replace animations with others that already exist.

Basically, you can use the Archive2.exe program in the Tools menu of your Fallout 4 directory to extract archives including "Fallout4 - Animations.ba2". Once extracted you can manually add them to your Fallout 4 Data directory. From there you can simply copy/paste to overwrite and then when building the archive for your own mod, add the animations you modified to it.

This may also come in handy with NPC Resurrection. It may be possible to change the walking animation for example to one where they don't hold their fists up in the air like a boxer. I'm not sure what options there are for the actual attacks themselves but it is something I hope to experiment with.

I'm continuing to learn more and more as I work on this mod and I'm optimistic the mod will continue to improve as a result. Also, it is still a lot of fun to work on and that's important.

5 comments:

  1. I installed this mod a few weeks ago from the in-game mod menu on PC in fallout 4, probably around the start of March 2017. I found it very fun, but was quite annoyed by two issues; one was that I couldn't reliably get up close to do melee kills because of the animations, and the other was that getting hit by a zombie didn't feel lethal enough. And then wouldn't you know it, the very next update includes a disabling option for attack animations and lethal infection mode on Survival. Keep up the great work!

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. I am having a problem shooting them..? I know my shot “should” have hit but it’s seems to go right though if it registers hitting them at all. This is very frustrating because I am wasting bullets for again what I know “should have been a kill shot

    ReplyDelete
  4. Sometime I miss and don't think I should've. They have a natural Bob to their walking motion built into the game. It isn't really much of a problem anymore as long as I'm not panicked due to being surrounded. ;)

    ReplyDelete
  5. Hi :) Thank you for all your excellent job and your sharing of informations.
    I know it's a long time now you published this post... However as I am aware updates were still published for Zombie Walkers recently, you might be interested in that link of files I am sharing since tonight on Nexus :
    https://www.nexusmods.com/fallout4/mods/43611

    ...Waiting now for a bite'em all ;) !!!

    ReplyDelete