Zombies feast on a settler in the middle of the road. What do zombies do with all the people they kill? In previous versions of Zombie W...

Zombies Ate My Settlers

Zombies feast on a settler in the middle of the road.
What do zombies do with all the people they kill? In previous versions of Zombie Walkers they just walked on by and wandered away, but no more! Now you have the opportunity to stumble upon scenes like above before fighting for your life to avoid the same fate.

Behavior Update

The Fallout 4 engine uses a combination of AI packages and linked references to mostly govern actor behavior outside of combat. I already created a custom package for zombies for their horde movement behavior based on the default package master that I have now stripped down and simplified to ensure zombies only perform the actions I want them to.

Package used by zombies to Sit, Follow, or Patrol based on the linked references they may have assigned.
Packages are made up of Procedures which are what actually make an actor move or otherwise interact with the game world. Most procedures are configurable and take various properties in as input to tell it what to interact with or where to move the actor. The three procedures above all operate on a linked reference as a target. 

Note that procedures can also have conditions assigned to it which can cause a procedure to be skipped. In the screenshot above, the Sit procedure will only execute if the linked reference is not disabled and the actor has the FeralGhoulRace. I added the race condition to prevent Ghoul zombies (from NPC Resurrection) from trying to use furniture they have no animation for which would otherwise cause them to just stand around.

Procedures Used

Sit procedure - This procedure causes an actor to use a particular piece of furniture. Maybe it should be called "Use Furniture" instead? This is used to link zombies to the special feral ghoul eating furniture next to a dead body.
Follow procedure -  This procedure causes an actor to follow another actor around. This is used to group zombies together. Zombies follow each other until ones becomes the defunct leader and wanders.
Patrol procedure -  This procedure causes an actor to move to a marker of some kind and markers can be chained together forming a path (or moved like this mod does to implement wandering zombies - see Horde Behavior).

Setting Linked References

SandboxFeralGhoulSquatEating furniture
There is a script attached to all zombies that initializes a zombie (once) when they are spawned, listens to certain events (like a zombie dying or entering combat), and updates their behavior. The behavior update portion of the script essentially sets the linked reference for that zombie so that the appropriate procedure described above triggers. 

In the case of zombie feeding, the script searches for nearby corpses and if found actually creates the furniture object. The furniture is then linked to the zombie with the keyword LinkAmbushFurniture since that is the same keyword used by existing ferals in the game. 

The end of the script executes EvaluatePackage to make the zombie re-evaluate the package tree described above. This causes the Sit procedure to execute which makes the zombie walk to the furniture and use it. Furniture has animations linked to it that are specific to the type of actor the furniture was made for. The SandboxFeralGhoulSquatEating furniture is what is used by zombies and makes the zombies squat down over the corpse and use their hands to grab from the ground in front of them and then move to their mouths as if eating.

What About the Corpse?

There are two events you can register for to detect when an actor uses furniture (OnSit) and stops using furniture (OnGetUp). When OnSit is triggered, the corpse being "eaten" by the zombie has a random limb chosen and Dismembered. Once all limbs are dismembered the corpse is marked as eaten so other zombies now ignore it.

A cleanup script runs and disables the zombie furniture after about 1 hr in game. When this happens the OnGetUp event is triggered as the zombie exits that no longer valid furniture. This allows the script to update the zombie behavior again which could cause the zombie to move on to the next body part or wander away if nothing is left to consume.

Limitations and Future

The corpse eating is limited to Feral Ghoul zombies right now. Zombies spawned by NPC Resurrection or replacement of humans are actually Ghouls and do not have the animations required to use the furniture. I am exploring alternatives for them possibly including the game's built in Cannibal perk. Early experiments have failed but I will pursue it.

Some corpses, like the dead raider across Sanctuary bridge, refuse to be eaten for some reason and I have yet to figure out why. If "Already Dead" is enabled under Spawn Settings -> Replacements -> General Settings, then that raider is marked as zombie food until it resurrects as a zombie itself. The zombies nearby detect this and create the furniture marker but don't use it.

The behavior updates described above do not apply to all zombies. Some zombies have pre-defined behavior like ambushes (Crawling out from under cars) that I didn't want to break so I exclude them from being changed. Also, currently the behavior updates do not apply to interior locations. This was mostly to avoid zombies trying to wander to inaccessible areas and getting stuck, but I may revisit this to at least allow them to search for food.

8 comments:

Pages (8)1234567 ยป