Death is the eventual fate of all infected that do not find a cure. Everyone who has watched a zombie film knows that getting bit is b...

Lethal Infections

Death is the eventual fate of all infected that do not find a cure.
Everyone who has watched a zombie film knows that getting bit is bad news. You become infected and eventually die only to rise again to join the undead. Up until recently, Zombie Walkers featured infection in the form the built-in survival infection disease which simply gives periodic damage. I wanted to add a new Lethal Infection option for those wanting a more hard core experience.

Implementation

When the player is struck by a zombie attack, they are given a special Zombie Infection Perk. This perk adds a persistent magic effect on the player that stays until the perk is removed. Currently, the perk can be removed using survival mode's standard antibiotics.

The magic effect uses a game timer to advance the infection every 15 in-game minutes which translates to about 45 seconds for the default time scale. The number of times the effect has triggered is tracked as Zombie Infection Ticks. As time goes by the infection gets worse.

Incubation

When the player is hit there is a brief incubation period before any of the affects are applied to the player. This incubation period is currently a single tick (~45 seconds).

Stage 1: Periodic damage/rads

- periodic damage begins (every 30 in-game minutes from Infection disease)
- periodic radiation begins (every 15 in-game minutes, starts at 10 and grows over time)
- sleep is limited to 4 hrs at a time (even in a regular bed)
- Well Rested & Lover's Embrace perks removed if present
- camera/controller shakes and blood splatter appears on screen

Stage 2: Dehydration (12 hrs)

- all effects from previous stage applies
- dehydrate player every 90 in-game minutes (similar to taking a stimpack)

Stage 3: Dark Craving (24 hrs)

- all effects from previous stages apply
- dehydration increases to every 60 in-game minutes
- Dark Craving effect is added (same as survival cannibal perk - normal food no longer satisfies hunger)

Stage 4: No Sleeping (36 hrs)

- all effects from previous stages apply
- periodic radiation damage now grows twice as fast
- dehydration increases to every 30 in-game minutes
- sleep is no longer possible

Death by Rads

The idea with the above stages is to start off slow but eventually become lethal if not cured. Death is eventually guaranteed thanks to how radiation damage works. The player will die regardless of their health if they reach 1,000 rads. Given the fact that the radiation damage slowly increases over time, it will eventually reach 1,000 even if the player stands next to a doctor all game and heals after every infection tick.

The rads given each tick equal the number of ticks that have passed. This means the rate is linear and the rate only increases when it is doubled at stage 4. To give you an idea of the numbers, here are the ranges of rads given at each infection stage:
Stage 1 = 40 - 182 rads/hr
Stage 2 = 186 - 374 rads/hr
Stage 3 = 378 - 566 rads/hr
Stage 4 = 570+ rads/hr
Note that Stage 4 continues to increase the rad rate given until the player dies. This theoretically means it could award 1,000 rads at a single tick instantly killing the player. My original target for death was about 48 hours at which point the rate is around 948 rads/hr.

Banking on Survival Needs

To put extra pressure on the player and re-enforce the unofficial 48 hour window, I decided to attack each of the player's survival needs. This takes advantage of the already built-in penalties and effects that survival mode contains and adds some immersion.

Pressure is applied to water starting at 12 hrs, to food starting at 24 hrs, and to sleep starting at 36 hrs. Assuming the player can survive all the radiation damage, they may be left with some serious stat penalties and more periodic damage if they do not have a large water supply and the cannibal perk.
Severely Dehydrated: -10 INT, -7 PER, -3 LCK + continuously take bleed damage.
Starving: -10 END, -5 CHR, -3 LCK + continuously take bleed damage.
Incapacitated: -75% AP regeneration, -6 STR, -4 AGL, -3 LCK + no run [walk only]
Keep in mind that the continuous bleed damage above is in addition to the periodic damage they are already receiving form the Infection survival disease. Also note that while an infected player can work to avoid dehydration (with lots of water) and starvation (with cannibal perk), incapacitated status is unavoidable.

Future Thoughts

I'd like to explore the idea of armor providing protection against getting infected. The protection level could be based on armor coverage (Heavy variants cover more flesh than Sturdy and Standard) and/or type (leather vs metal etc.). The protection would basically be a % chance of not being infected when hit that could be increased to some max with each armor part being worn. This could get tricky when you consider under-armor and special outfits, which is probably why mods like AWKCR exist.

Another idea which is more ambitious is exploring the concept of handling player death differently. Instead of reloading a previous save, maybe that version of the player is dead forever and the player is instead re-spawned as a new character at a different location. Maybe they spawn at one of their settlements or randomly on the map. They can adjust their name, looks, etc. to basically create a new character. The former dead player will rise as a zombie and must be tracked down and killed if the player wants to get any items back. Maybe this would be a quest with a marker?

Have any thoughts of your own? Feel free to share them in the comments.

Update: 2/4/2018 (as of version 2.5.3)

Dark Craving and Inability to sleep are now applied at Stage 1. Dehydration also now begins at Stage 1 but continues to progress in frequency. The incubation period is now 1 in-game hour (4 ticks). No changes have been made to radiation damage.

The above changes were made due to reports that lethal infection was a minor annoyance in the early stages. Also, it takes time for the in-game survival needs to start impacting the player so I wanted to get those timers started right away.

3 comments:

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:

Pages (8)1234567 »