Why? The current approach used on Zombie Walkers involved modifying Leveled Lists by jamming Feral Ghouls (Zombies) into them so they spa...

New Replacement Approach

Why?

The current approach used on Zombie Walkers involved modifying Leveled Lists by jamming Feral Ghouls (Zombies) into them so they spawn instead of the intended Actor type. This works most of the time, but has a couple of drawbacks:
  • It doesn't work for all actors. Super Mutants for example seam to have all sorts of problems sometimes spawning naked without heads, or spawning as a zombie naked without heads, or spawning as a Super Mutant called Zombie.
  • It doesn't work in all situations. Leveled spawns that have scripts associated with them, like ambushes, often spawn headless zombies. To get around this for ambushes, I ended up not updating the leveled list and doing a literal search/replace in the game cells. This modifies the cells of course and causes issues when users install/uninstall the mod until they manage to get their cells to reset.

New Approach

Instead of modifying leveled lists or replacing them in cells I am moving toward a scripted solution. I already have a quest that runs every 10 seconds to assign special attributes to Zombies, so I am adding more aliases to it to check for Non-Zombies and replace them if a set of criteria matches.

Current base criteria:
  1. Actor does NOT have the SkipZombieReplacement keyword.
  2. Actor is NOT essential.
  3. Actor is NOT protected.
  4. Actor is NOT unique.
  5. Actor is NOT player teammate.
  6. Actor is NOT currently visible by the player.
If it meets these criteria, then we check if it a type we want to replace. The SkipZombieReplacement keyword is added when the actor fails replacement for any reason so that it is not checked again in the future to improve performance. For the first version, I am porting over just the 5 existing replacement categories already configurable in the mod:
  1. Large Creature replacements enabled and has "heavyKnocker" keyword (eg. Deathclaw, Mirelurk Queen, Sentry Bot)
  2. Super Mutant replacements enabled and has "SuperMutantRace" race
  3. Robot replacements enabled and has "ActorTypeRobot" keyword
  4. Animals replacements enabled and has "ActorTypeAnimal" keyword
  5. Creature replacements enabled and has "ActorTypeCreature" or "ActorTypeBug" keywords
Note that you can still set a percentage replacement which is checked each time. I've updated the percentage options to be 50%, 75%, and 100%. You can think of these percentages as "percentage chance to replace if base criteria is matched". For example, there's a 100% chance that a super mutant will be replaced if they are not essential or protected or unique or a player teammate and not currently visible to the player. (Strong is safe since he's essential)

Another thing I am adding is the option to replace a creature with more than one zombie. This was not possible with leveled lists as I had no control there, but now I can let players replace each Super Mutant with 2 Zombies and each Deathclaw with 10 Zombies if they want to. These options will be configurable alongside the current replacement percentage config.

Progress and Testing

I've finished implementation and have been testing the past few days in between publishing updates for the new PS4 version of the mod.

Testing has been going well overall but there are still bugs to work out before I publish the update. If anything, the replacements are working a bit too well and replacing things they probably shouldn't. I'm trying to test edge cases and make sure I don't break people's games (unless they want me to).

There are still some edge cases I haven't tested yet, like DLC robots and captured animals. Unfortunately, I don't have DLC outside of Far Harbor on PC so I may need to fire up my XBox to test those eventually.

For my initial testing I enabled all replacement options at 100% with a 2 to 1 replacement ratio (2 zombies per creature replaced). The only exception is the Large Creatures category which I set to a ratio of 10 to 1 for fun.

Here's some screenshots with captions that explain a few of the things I've run into:

Zombies replaced the 2 Gorillas in the Institute. Funny thing is, they were hostile in color but displayed idle behavior and the Institute scientists didn't seem to care (no combat triggered). This kinda gives the impression that the Institute is involved in starting the zombie apocalypse. Maybe I leave it?

Several zombies spawned in Diamond City and a couple of them killed poor Abbot before I even got to him. It seems they replaced the cats, eyebot, and brahmins. Cats and Brahmin are not always replaced as they are usually marked protected. Abernathy's animals were fine, but the crazy cat trader was overrun when I got there.
Several zombies spawned aboard the Prydwen. They replaced the cat, Mr. Handy, and molerats.

Update (11/25):

I added to the base criteria to address non hostiles being converted in settlements/cities:

7. Actor is hostile to player OR Actor is in ambush mode (will be hostile)

Initially I added just the Actor is hostile part, but I noticed certain ambush types like Molerats and Radroaches would not be replaced. When I researched it I noticed ambush actor types use the same scripts to trigger the ambush. The two main types are:
  • DelayedAmbushScript - start off disabled (but still hostile) and appear upon some trigger like the death of another actor
  • MasterAmbushActorScript - start off enabled but not hostile and become hostile when triggered by player proximity.
The MasterAmbushActorScript types were the issue as the others were being replaced since they were hostile from the beginning. After further research, I figured out you can check if an actor has this script type using the CastAs function. You can use it directly in a conditional statement since it will safely return NONE if the actor isn't of that type.
; returns the target casted to the specified type or NONE
If( target.CastAs( "MasterAmbushActorScript" ) )
After making this change, testing is looking much better. Ambush types are being replaced as expected and no zombies are spawning in Diamond City or the Prydwen anymore. I'm almost ready to deploy and test on my XBox for final verification.

0 comments: