How Fallout 4 AI Overhaul Works
 Version 1.2 Feb/10/2022

Table of contents:
-Resources for creating new AI
-The Quest System
-Custom AI
-Specific NPC AI
-Creating new markers
-Troubleshooting

Resources for creating new AI:

Where to start? The creation kit wiki has great articles on what were working with. I found these most useful and helpful for F4AIO.

General Quest Overview: https://falloutck.uesp.net/wiki/Quest
Quest Data Tab: https://www.creationkit.com/index.php?title=Quest_Data_Tab
Quest Alias: https://www.creationkit.com/index.php?title=Quest_Alias_Tab
AI Packages: https://www.creationkit.com/index.php?title=Category:Packages
Sandbox Procedure: https://www.creationkit.com/fallout4/index.php?title=Sandbox_(Procedure)
Conditional Functions: https://www.creationkit.com/index.php?title=Condition_Functions
Skyrim AI Article: https://www.nexusmods.com/skyrimspecialedition/articles/2467?BH=0

The Quest System:

F4AIO uses a universal quest to handle injecting new AI overrides and behaviors.
It is conditional from "Start Game Enabled" to start after you leave the Vault by checking the mq101 and mq101KellogSequence quests are completed or running.

Here is the alias setup for a generic Diamond City NPC:
Spoiler:  
Show



AI packages are used for just Weather reaction.
Spectator & Combat are the only overrides.
The mod sets up 10 additional alias' in each city, by finding Matching Ref, Checked "Actors Only" & Closest to Player.

Custom AI:

Perhaps the most mind blowing fact about this mod is that a single package handles the random AI behavior for every citizen in Diamond city & Goodneighbor.

Yes. Just the Vanilla Default "NPCSandboxPackages" for major city areas have the package data revamped to create the random sequence of behaviors for the whole day. Each NPC has the exact same AI package but each NPC does something different. 

Default AI Overhauled:

Here's what that looks like:
Spoiler:  
Show





Always make sure to properly setup the procedure data to the package data values.
Spoiler:  
Show





Weather Reaction:

The weather packages for Rain and Rad Storm reaction.

F4AIOWeather is the Rain behavior. They will go to the nearest shelter area or stay inside if they are already in an interior.
For other indoor areas, use the "GetDistance" to the Door ref less than 1024 or 2048.
Spoiler:  
Show




This is the conditions for the weather package. Checks if they are excluded NPCs in a formlist and if it's raining.
Spoiler:  
Show




F4AIOWeatherRadRun is the initial reaction to rad storms. They will select a sheltered area to run to. Once inside "F4AIOWeatherRadstorm" will take priority so they stay inside for the duration of the storm.


Combat Reaction:


The combat overrides is simply a formlist of packages that is setup to react to the player first (If you are the attacker) and then everything else, or only flee from powerful creatures/robots.

This is a simple flee package set to react to the Combat target reference.
Spoiler:  
Show




Moe simply avoids powerful creatures and that's it. He will still defend himself from the player or lesser threats.
Spoiler:  
Show




Specific NPC AI:

  • Diamond City Dugout Inn residents try to find areas to go to sleep
  • Diamond City School Children go outside for lunch.
  • Some Third Rail occupants find areas to sleep.
  • Nat goes inside Public Occurrences during Radstorms and actually goes to sleep now.
  • Rufus now cheers whenever Magnolia sings.
(The vanilla package is broken I think so this is a new set of behaviors restructured.)
Spoiler:  
Show



It's a Main "Stacked" Procedure Tree. This means that the following sequences will act like package stacks with priority from top to bottom.
The first sequence branch has the condition item "GetIsCurrentPackage" to Run on a specific ref, Magnolia in this case. The target is her singing package. Returns 1 to make sure she is using the package.

The second sequence branch is the same condition that returns 0. Which means he simply goes back to sandboxing behavior.
This is a very neat and simple way to check for a specific package on an NPC and trigger another NPC to do something.

Creating new markers:

For the invisible sleep marker, I simply duplicated the sleeping bag furniture marker and then replaced the model path to the invisible marker path (which is another type of furniture you can find).
Spoiler:  
Show




Creating new idle animations (disclaimer F4AIO hasn't added any of these in yet.):

You can go into animations then find this tab.
Spoiler:  
Show




Open "LOOSE" and "Insert Child". This is where all the root idles for NPCs are in the game.
Spoiler:  
Show



Setup ID, Anim Event and Animation File if you unpacked them and want to experiment.

Troubleshooting:

NPCs do nothing after they were in a scene. -"RecycleActor" then "Resurrect" them using the console command to refresh them.

Frozen AI, NPCs Stuck/Not moving -Potential broken package data or another quest is trying to take over control of the AI. Try disabling mods or reloading.

Alternative method: "Disable-Enable" "ResetAI" using the console.

This should not affect your FPS heavily. FPS may vary~

Article information

Added on

Edited on

Written by

SpiderAkira

5 comments

  1. AnAtheistBear
    AnAtheistBear
    • premium
    • 4 kudos
    What do the AIDT - AI Data numbers mean? (7F 00 00)
    1. SpiderAkira
      SpiderAkira
      • premium
      • 288 kudos
      They corollate to the public package data within the package itself. So all the Location, SingleRef, Bool, etc data that's on the package.
  2. demoix
    demoix
    • member
    • 0 kudos


     
    In response to post #106152628.


    Spoiler:  
    Show

    demoix wrote:
    Would be possible to add an AI on player character and once he sees an enemy so he would fight automatically?


    Like the L4D AFK Bot? Maybe...Idk how well that could work if at all.
     


     
    Let's say to give AI combat package to the player character (yourself) by pressing a hotkey. So the player character would act and fight enemies like your companion or other NPC would do?
  3. demoix
    demoix
    • member
    • 0 kudos
    Would be possible to add an AI on player character and once he sees an enemy so he would fight automatically?
    1. SpiderAkira
      SpiderAkira
      • premium
      • 288 kudos
      Like the L4D AFK Bot? Maybe...Idk how well that could work if at all.