The Vanilla Fallout 4 Workshop Mechanics Guide

Discussion in 'Educational Vault' started by snarkywriter, Oct 27, 2018.

  1. snarkywriter

    snarkywriter Well-Known Member Patreon Supporter Community Rockstar

    Joined:
    Jan 7, 2018
    Messages:
    271
    Likes Received:
    450

    Vanilla Workshop Basics

    In this article, we’ll be exploring the vanilla Fallout 4 settlement mechanics. The information provided below was derived directly from the Creation Kit and base game scripts, where possible. If it wasn’t possible for me to figure the mechanics out from the source, I used the Creation Kit wiki and in-game testing. To help enhance the experience for both users and modders, I specifically reference which scripts and script functions control which mechanics. For our more mathematically inclined readers, I’ve translated the script functions into mathematical formulas so that people who aren’t code savvy can at least see how the calculations are made. Unlike previous Educational Vault articles, I’ve adopted a list format for this article so that hopefully it is easier to read. Let me know what you think.

    It is important to note that many of the values in the formulas below are hard-coded into the relevant vanilla workshop scripts. They cannot be changed with an esm/esl/esp file alone; they must be overwritten by a replacement script. This is partly explained by the tenuous nature of the settlement system’s place in Fallout 4. According to the Noclip documentary entitled “The History of Bethesda Game Studios - Elder Scrolls / Fallout Documentary”, the settlement system was not initially included in the design for Fallout 4, and was added later in development as the result of a game jam session. Section starts at 1:18:30 -

    The Studio Director and the Lead Producer both say that the settlement system was up for removal from the game from the moment it was introduced until just before release. The team was highly skeptical about how much players would care about the system, and felt that it was ancillary to the game they were trying to create. Therefore, while the settlement system obviously made it into the final game, it was never fully integrated into the core gameplay loop and likely wasn’t developed/optimized significantly beyond its initial game jam draft version.

    Finally, this is a living document. I plan to continue to add to it as time goes by. If you have any additional questions about how any vanilla settlement mechanics work, please ask in the comment thread for this article and we will research them and possibly add them to this article. For now, items that are unconfirmed are marked with “ ** ”.

    Also, I use two mathematical symbols that people may not be familiar with, floor and ceiling, to represent the same functions used in Bethesda's scripts:
    Formula Legend.jpg
     
    Yagisan, WetRats, Whisper and 5 others like this.
  2. snarkywriter

    snarkywriter Well-Known Member Patreon Supporter Community Rockstar

    Joined:
    Jan 7, 2018
    Messages:
    271
    Likes Received:
    450

    Settlers and other Workshop NPCs

    Settler Recruitment
    • Settler recruitment is controlled by the function called DailyUpdateAttractNewSettlers that is run when the DailyUpdate function in WorkshopScript runs.
    • Upon powering a Recruitment Beacon for the first time in a settlement, between 1 and 3 settlers will be randomly spawned and attached to the workshop after a random interval of time that can vary from 4.8 and 12 in-game hours after the beacon is activated. This is controlled by the OnTimerGameTime event in WorkshopRadioBeaconRecruitScript. You are guaranteed at least 1 new settler. There is a 37% chance that 2 settlers will be recruited, and a 15% chance that 3 settlers will be recruited.
    • Each in-game day, all settlements in your network with powered and activated Recruitment Beacons and fewer than 5 unassigned Settlers have a percentage chance to receive a new settler, per the simplified formula below:
    Recruitment Formula.jpg
    • Thus, with a Happiness Rating of 80 and a population higher than 4, your settlement has a (10 + (80/2))% = 50% chance of gaining a settler. With a Happiness Rating of 80 and a population of 3, your settlement has a (10 + (80/2))% + ((5-3)*10)% = 70% chance of gaining a settler.
    Table 1.jpg

    • Provisioners and some Companions (Codsworth, Robot Curie, Strong) are always counted as unassigned Settlers.
    • When a new settler would be added to the settlement with the Recruitment Beacon, there is a base 20% chance that a Brahmin will be added to the settlement in addition to a new settler.
    • When a new settler would be added to the settlement with the Recruitment Beacon and they are not a Brahmin, there is a base 20% chance that the settler will be a “Guard”. “Guards” have 10 more health than regular settlers, and will automatically assign themselves to any available guard posts.
    • Recruitment is capped per settlement. New settlers cannot be recruited through the Recruitment Beacon if the settlement has 5 or more unassigned settlers. The maximum number of settlers a given settlement can have is equal to 10 + [Player’s Charisma Score at Time of Calculation]. The maximum number of settlers a given settlement can have is calculated on-the-fly at the beginning of each in-game day. Charisma Bonuses from items, chems, etc. count towards this calculation. Thus, the maximum possible population is 21 without bonuses, and 43 with all possible vanilla bonuses applied.
    • The Automaton DLC allows for infinite settlers to be recruited through a settler rescue quest.
    • Vault 88 from the Vault-Tec Workshop DLC has a +10 bonus cap on it's maximum population.
    Settler Equipment and Scaling
    • Settlers’ equipment and stats on spawn are controlled by Levelled Lists.
    • All settlers spawn at level 2. Settlers do not scale in level with the player.
    • Unnamed settlers who are already on-site at a settlement location prior to the player obtaining that settlement spawn with lower stats, having on average only 40 health.
    • Named settlers, and settlers who spawn through Recruitment Beacons, random encounters, and quests, spawn with higher stats, having on average 100 health.
    • Settler inventories are generated when they spawn from three settler-specific Leveled Lists, one for weapons, one for armor, and one for random inventory clutter. This equipment is generated based on the settler’s level (which is 2 by default), and is normally restricted to clothes and an unmodified pipe weapon, with the probability of some armor, one or two food items, one or two junk items, and/or a few caps.
    • Amusingly, if you change the “count” value of an item on the Settler Leveled Lists to 0 using FO4Edit, or you change the min and max spawn such that the max value is equal to the min value, it registers as an error and trips an engine-level failsafe in the NPC spawning code; any settlers who would spawn with that item in their inventory spawn as radroaches. This applies to any leveled list for any NPC.
    • Talking to settlers will allow you to trade gear with them. You can put weapons and armor in their inventory and tell them to equip it by using the appropriate button, just like companions.
    • Settlers only need one round of ammunition to use most weapons. They will not expend this round of ammo when firing, so they effectively have infinite ammo. Grenades, Missile Launchers, and Fat Man Launchers do not benefit from this trait.
    Settler Schedules
    • NPC AI is normally governed by several stacks of Packages, which contain instructions for what the NPC is supposed to do when certain conditions are met.
    • Packages are evaluated in order. If the conditions of the first package aren’t met, the code moves to the next Package, and the next, until conditions are met. If no conditions are met, and no packages fire, the NPC will just stand there.
    Children
    • There are no provisions in the vanilla scripts for children to be either recruited to or moved from a settlement.
    • Children’s animations are limited, and thus they can only be assigned to beds and to farming jobs.
    • If all adults in a settlement that contained children are killed, the children will flee the settlement and despawn off-screen.
    Brahmin
    • The number of Brahmin assigned to a workshop is one of the core workshop ratings recorded by the WorkshopRatingBrahmin value which is part of the WorkshopRatingsGroup in WorkshopParentScript.
    • Brahmin recruitment is controlled by the function called DailyUpdateAttractNewSettlers that is run when the DailyUpdate function in WorkshopScript runs.
    • You can only recruit up to 1 Brahmin through the recruitment beacon for any given settlement, though the scripts allow for any number of Brahmin to contribute to food production, and up to 3 Brahmin to contribute to fertilizer production.
    • Each Brahmin in a settlement increases the food production of up to 10 individual vanilla plants by 50%.
    • Brahmin add 1 fertilizer to the settlement’s workbench inventory per Brahmin per in-game day.
    • Fertilizer Production is controlled by the function called DailyUpdateSurplusResources in WorkshopScript.
    • Fertilizer production is capped per settlement. A maximum of 3 fertilizers can be produced per day in a given settlement. Once a settlement’s workbench inventory has 10 fertilizers in it, all fertilizer production in that settlement ceases. ALL fertilizer in the settlement’s workbench inventory counts toward this cap, regardless of how it got there.
    • Fertilizer is a scrap item, and counts toward the scrap production cap discussed under the Resources section of this guide.
    Pets
    • Cats which belong to a settlement add 10 points to the WorkshopRatingBonusHappiness value (discussed below).**
    • Junkyard dogs which belong to a settlement add 10 points to the WorkshopRatingBonusHappiness value (discussed below).**
    • Gorillas which belong to a settlement add 20 points to the WorkshopRatingBonusHappiness value (discussed below). **
    Robots
    • The number of robots assigned to a workshop is one of the core workshop ratings recorded by the WorkshopRatingPopulationRobots value which is part of the WorkshopRatingsGroup in WorkshopParentScript.
    • Robot animations are limited. They can be assigned to any job, but they will only perform Guard duties correctly.
    • Robot happiness is hardcoded into the function called DailyUpdateConsumeResources in WorkshopScript.
    Synth Infiltrators
    • Synth Infiltrator appearance is controlled by the function called CreateActor in WorkshopParentScript.
    • When a new settler or Brahmin would be added to the settlement with the Recruitment Beacon and [Population Count] > 4, there is a 10% chance that the settler or Brahmin will be a Synth Infiltrator.
    • Any adult Human or Ghoul settler can be a Synth Infiltrator. Brahmin, amusingly enough, can also be Synth Infiltrators.
    • The presence of Synth Infiltrators has no effect on settlement happiness.
    • Synth Infiltrators are completely indistinguishable from other settlers while alive. The idea that they have more health, energy resistance, special dialogue, etc. is a myth.
     
    Last edited: Oct 28, 2018
    WetRats, Yagisan, Whisper and 3 others like this.
  3. snarkywriter

    snarkywriter Well-Known Member Patreon Supporter Community Rockstar

    Joined:
    Jan 7, 2018
    Messages:
    271
    Likes Received:
    450

    Resources

    General
    • Resource production is controlled by two functions called DailyUpdateSurplusResources and DailyUpdateProduceResources that are run when the DailyUpdate function in WorkshopScript runs.
    • Resource consumption is controlled by three functions called TransferResourcesFromLinkedWorkshops (from WorkshopParentScript), DailyUpdateProduceResources, and DailyUpdateConsumeResources that are run when the DailyUpdate function in WorkshopScript runs.
    • Food, Water, Scrap, and Fertilizer production is capped by the number of objects marked with the appropriate keywords that are already stored in the settlement’s workshop inventory. Items are counted by DailyUpdateSurplusResources before production begins. The caps are detailed in the individual resource sections below.
    • Food and Water items are produced by the DailyUpdateProduceResources function and added to the workshop container before they are consumed by the DailyUpdateConsumeResources function. If there is not sufficient production capability to feed/hydrate the number of settlers (minus robots), then TransferResourcesFromLinkedWorkshops removes items from provisioner-linked workshop inventories and adds them to the settlement’s workshop inventory during DailyUpdateProduceResources, before resources are consumed.
    • WorkshopParentScript and WorkshopScript do not actually interact with individual NPCs and objects beyond doing headcounts. All resource production and consumption is simulated at an aggregate level. Thus, edible/drinkable items in settlers’ personal inventories do not count towards the settlement’s food/water resources, even if they have the appropriate keywords, and will not be consumed when the daily update runs.
    Food
    • Each settler requires 1 point of food per settler per day, either through current food production or through food items stored in the settlement’s workshop inventory.
    • Food items stored in the settlement’s workshop inventory that have the WorkshopConsumeFood keyword are each worth 1 point of food.
    • If current food production is less than the number of settlers, 1 food item will removed from the workbench per settler per in-game day to meet the need.
    • Different food generating workshop objects have different food point values.
    • Each settler can be assigned to up to 6 points worth of food generating workshop objects (normally plants in vanilla Fallout 4).
    • Food production is capped per settlement. Once a given settlement’s workbench inventory has 10 + [Population Count] food items in it, all food production in that settlement ceases. The only way to restart food production is to remove items from that settlement’s workbench inventory until the count of food items drops below this threshold. ALL food items in the settlement’s workbench inventory count toward this cap, regardless of how they got there.
    • Settler happiness affects food production according to the following formula:
    Food Happiness Bonus.jpg
    • Settler happiness cannot improve food production, only reduce it.
    Water
    • Each settler requires 1 point of water per settler per day, either through current water production or through water items stored in the settlement’s workshop inventory.
    • Water items stored in the settlement’s workshop inventory that have the WorkshopConsumeWater keyword are each worth 1 point of water.
    • If current water production is less than the number of settlers, 1 water item will removed from the workbench per settler per in-game day to meet the need.
    • Different water generating workshop objects have different water point values.
    • Water production is capped per settlement. Once a given settlement’s workbench inventory has 5 + ([Population Count] * 0.25) water items in it, all water production in that settlement ceases. The only way to restart water production is to remove items from that settlement’s workbench inventory until the count of water items drops below this threshold. ALL water items in the settlement’s workbench inventory count toward this cap, regardless of how they got there.
    • Settler happiness does not affect water production.
    Scrap
    • Scrap is generated by unemployed settlers at a rate of 1 junk item added to the settlement’s workbench inventory per unemployed settler per in-game day.
    • Each scrap item (junk and/or resources) stored in the settlement’s workshop inventory that have the WorkshopConsumeScavenge keyword is counted as 1 junk item.
    • Scrap is generated by settlers assigned to Scavenging Stations at a rate of 2 junk items added to the settlement’s workbench inventory per Scavenging Station assigned settler per in-game day.
    • Scrap production is capped per settlement. Once a given settlement’s workbench inventory has 100 + ([Population Count] * 5) junk items in it, all scrap production in that settlement ceases. The only way to restart scrap production is to remove items from that settlement’s workbench inventory until the count of junk items drops below this threshold. ALL junk items and resource items in the settlement’s workbench inventory count toward this cap, regardless of how they got there.
    • Settler happiness affects scrap production according to the following formula:
    Scrap Happiness Bonus.jpg

    Sheltered Beds
    • A bed’s sheltered status appears to be calculated at an engine level, and thus cannot be directly modified. However, in-game evidence indicates that distance from a ceiling/wall and ceiling/wall transparency both can contribute to whether a bed is considered sheltered (closer to a ceiling/wall and/or more holes in the ceiling/wall equals less chance that the bed will be considered sheltered).
    Power
    Supply Lines
    • Supply line creation is controlled by the AssignCaravanActorPUBLIC function in WorkshopParentScript.
    • Any settlement can be linked to any other settlement with as many supply lines as you have settlers to assign as Provisioners.
    • Provisioners are always counted as unassigned Settlers.
    • Provisioners do not have a rest schedule, and thus do not use the beds to which they are assigned.
    • As noted below in the Defense, Attacks, and Combat Near or In Settlements section, Provisioners are marked as Protected. This means they can only be killed by the player and by explosive splash damage. Their Pack Brahmin are not, and can be killed by anything.
    • The CaravanActorBrahminCheck function of WorkshopParentScript replaces a Provisioner’s lost Pack Brahmin whenever the OnLoad event from WorkshopNPCScript is called.
    • When building objects in the workshop build menu, the resources available in all provisioner-linked workshop inventories are counted toward the settlement’s available resources.
    • As previously noted, if there is not sufficient production capability to feed/hydrate the number of settlers (minus robots) in a settlement, then TransferResourcesFromLinkedWorkshops removes items from provisioner-linked workshop inventories and adds them to the settlement’s workshop inventory during DailyUpdateProduceResources, before resources are consumed.
    • Settlements without sufficient food and/or water production capability will still trigger the disgruntled NPC dialogue, even if they are being supplied through a provisioner supply line.
     
    Last edited: Oct 29, 2018
    WetRats, Yagisan, Koeran83 and 2 others like this.
  4. snarkywriter

    snarkywriter Well-Known Member Patreon Supporter Community Rockstar

    Joined:
    Jan 7, 2018
    Messages:
    271
    Likes Received:
    450

    Happiness
    Happiness Rating
    • Happiness value calculations are quite complicated, and involve both WorkshopParentScript and WorkshopScript.
    • Overall Settlement Happiness Rating starts out at 50 when the workshop is first initialized. This value is hardcoded into WorkshopParentScript.
    • Individual Settlers do not have a happiness rating. Instead, WorkshopScript simulates a number of ActorHappiness values equal to the number of settlers in a settlement every time it runs the DailyUpdate function.
    • Overall Settlement Happiness Rating is updated by DailyUpdateConsumeResources which is run when the DailyUpdate function in WorkshopScript runs. First, the script determines how many non-robot Settlers are attached to the workbench, and runs a separate ActorHappiness calculation this many times. During this calculation, the ActorHappiness value is set to 0. Then, the script adds and subtracts from the ActorHappiness value based on Table 2.
    Table 2.jpg
    • If there are missing resources, the ActorHappiness value is replaced based on Table 3.
    Table 3.jpg
    • Finally, the ActorHappiness value is added to the cumulative totalHappiness value
    • Once all ActorHappiness values have been added to create the cumulative totalHappiness value, the script adds 50 * [the number of robots assigned to the settlement] to the totalHappiness value.
    • Next, the bonus happiness modifiers of any settlement objects are added together and then added to the totalHappiness value.
    • Finally, the totalHappiness value is divided by the total population count plus the settlement’s happiness modifier. This value becomes the target happiness value for the settlement.
    • The happiness modifier is a rolling value attached to the settlement that (a) can be between -50 and 40, (b) starts at 0, (c) drops by 20 points whenever a settler attached to the workshop dies, and (d) drops by a quest-defined number of points whenever you fail to defend a settlement or fail to complete a settlement radiant quest.
    • The happiness modifier value is updated by DailyUpdate function using a change rate formula, shown below.
    Happiness Modifier Change Rate.jpg
    • Happiness changes, at a minimum, +/-1 point per update cycle.
    • The final amount that the settlement’s happiness will change by is calculated using the formula below.
    Total Happiness Change Rate.jpg
    • This number is added/subtracted from the settlement’s current happiness value to update it.
     
    Last edited: Oct 29, 2018
    WetRats, Yagisan, Koeran83 and 2 others like this.
  5. snarkywriter

    snarkywriter Well-Known Member Patreon Supporter Community Rockstar

    Joined:
    Jan 7, 2018
    Messages:
    271
    Likes Received:
    450

    Defense, Attacks, and Combat Near or In Settlements

    Defense
    • Defense is divided into two primary variables in WorkshopParentScript; Safety and DefenseStrength.
    • Safety is the total defense value of all defensive objects in the settlement (turrets, guard posts, etc.). Safety is used in determining whether a settlement will be attacked on any given in-game day.
    • DefenseStrength is the settlement’s Safety value plus its Total Population count, with a maximum value of 100. DefenseStrength is the value used to resolve attacks.
    Attack Chance Calculations
    • Whether a settlement will be attacked is controlled by the function called CheckForAttack in WorkshopScript.
    • A settlement must have at least 1 settler to be eligible for attack.
    • A settlement cannot be attacked more than once every 7 in-game days.
    • A settlement cannot be attacked if it is already actively under attack.
    • The probability of a settlement attack is equal to:
    Attack Chance.jpg
    • Attack probability has a minimum value of 2%, regardless of the settlement’s Safety value. It cannot go lower.
    Attack Success/Failure Calculations if You Don’t Show Up
    • If you do not return to a settlement that is under attack to defend it, attack resolution is controlled by the function called ResolveAttack in WorkshopParentScript.
    • If you do not show up when a settlement is under attack, WorkshopParentScript uses the following formulas to calculate a Defense Strength and an Attack Strength:
    Defense and Attack Strength.jpg
    • When CheckForAttack in WorkshopScript run to determine whether the settlement would be attacked, it simulates a coin flip to choose the formula it will use to resolve the attack. Heads, it chooses Attack Calculation A. Tails, it chooses Attack Calculation B.
    Attack Calculations.jpg
    • Nothing else is considered in these calculations. Settler gear, what kind of defenses you have set up, your level, etc. are all completely irrelevant.
    • As dictated by the ResetWorkshop function, which is called whenever the player triggers a location change, it takes 3 in-game days after a settlement attack for settler post-attack dialogue to clear. This value is hard coded in the ResetWorkshop function.
    What Happens When an Attack Succeeds?
    • Attack Damage is controlled by several functions, including SetRandomDamage. These functions are called by ResolveAttack in WorkshopParentScript.
    • The maximum allowed Attack Damage is equal to either 25 or (100 – [Defense Strength]), whichever is larger.
    • The Final Damage dealt is calculated using the formula below:
    Attack Damage.jpg
    • Resources are damaged (i.e., disabled) based on the Random Resource Damage formula above.
    • Food, Water, Scrap, and Caps which are stored in the workbench are stolen (i.e., removed) from the workbench based on the following formula. This formula is applied individually to each of the different types of items stored in the workbench:
    Attack Steal.jpg
    • Damaged resourced are repaired by the ResetWorkshop function of WorkshopParentScript, which is called whenever the player triggers a location change, and the RepairDamage and RepairDamageToResource functions of WorkshopScript, which are triggered whenever DailyUpdate runs. Each resource type (Food, Water, Safety, Power) is repaired separately at a rate of 0 to 1 object per run by ResetWorkshop and by RepairDamage.
    (Continued in next post)
     
    WetRats, Yagisan, Koeran83 and 2 others like this.
  6. snarkywriter

    snarkywriter Well-Known Member Patreon Supporter Community Rockstar

    Joined:
    Jan 7, 2018
    Messages:
    271
    Likes Received:
    450

    Weapons and Power Armor
    • Settlers will use any Stealth Boys that are in their inventory during combat.
    • Settlers will not use Stimpaks that are in their inventory if they are injured.**
    • Friendly/Allied NPCs (to include Companions, Settlers, and visiting Traders) and hostile humanoid, non-robot attackers will freely take and automatically equip themselves with the most powerful weapons and ammunition available from any container in a settlement and/or the workbench if they are close enough to it during combat. They will also loot and equip weapons, ammo, explosives, and Fusion Cores from dead bodies (as they are now containers according to the Creation Engine) during combat if they are close enough to it. This behavior is an engine-level feature of the NPC AI sub-system in Fallout 4, and cannot be removed.
    • Friendly/Allied NPCs and hostile human/ghoul attackers will freely commandeer any unused Power Armor and/or Power Armor Frames which are available in the settlement and contain a Fusion Core during combat. Friendly/Allied NPCs and hostile human/ghoul attackers with Fusion Cores in their inventories will also freely commandeer unused Power Armor and/or Power Armor Frames during combat, and will loot Fusion Cores from settlement containers and/or the workbench to facilitate this.
    • Companions and Settlers can be ordered to exit Power Armor after combat is over by talking to them. Visiting Traders and other allied NPCs cannot be asked to exit Power Armor like a Companion or Settler, and therefore Power Armor they have commandeered cannot be recovered. Sometimes, visiting Traders will abandon the armor on the road, or will de-spawn and respawn without the armor equipped, but this is inconsistent and difficult to predict behavior. If the Power Armor is commandeered by a Hostile human/ghoul attacker, it can only be recovered by pickpocketing the Fusion Core from their inventory prior to their death (note that this will mark the Power Armor and Fusion Core as stolen. Otherwise, it is lost.
    Vulnerability
    • Settlers and visiting Traders are marked as Protected. This means they can only be killed by the player and by explosive splash damage. They can also be killed by environmental hazards like drowning and radiation hazards.** Finally, even protected NPCs can die from damage if there is sufficient script lag.**
    • Turrets that cause explosive splash damage (i.e., missile turrets and Mk7 light and heavy machine gun turrets) are not aware of other friendly NPC locations, are prone to friendly fire, and can kill Settlers and visiting Traders.
    • All grenades, mines, missile launchers, and Fat Man launchers deal explosive splash damage and can kill settlers and visiting Traders, even when used by friendly NPCs.
    • Ghoul settlers are not immune to radiation damage. Radiation hazards, gamma weapons, and irradiated water will down them just like human settlers if they spend too much time in them/are hit by them.**
    NPC AI Packages and the Combat Script
    • NPC AI is normally governed by several stacks of Packages, which contain instructions for what the NPC is supposed to do when certain conditions are met. Combat puts all NPC AI Packages on hold and slaves all NPC behavior to a single standard script we will call the Combat Script.
    • According to the Creation Kit Wiki, the Combat Script is an engine-level function separate from the normal NPC AI Package system in Fallout 4. The Combat Script thus cannot be directly modified or viewed with the Creation Kit, and the mechanics of NPC behavior during combat cannot be directly altered.
    • The Combat Script can be overridden through the use of Combat Override Packages. However, in most circumstances doing so removes the NPC from combat. Thus, NPCs’ combat behavior can only be partially controlled through Combat Override Packages. (This is why mods like Pack Attack are very engine-intensive. They must continually override the Combat Script every frame and run separate instances of hand-written Combat Override Packages for every NPC they affect to cover every possible combination of combat condition.)
    • The Combat Script appears to be evaluated every frame for any NPC who is registered as in combat.
    • The Combat Script appears to use multiple variables to determine how an NPC will act during that frame. Some of the assumed variables include Combat Style, Essential Status, Aggression, Confidence, Assistance, Equipment, Target’s Damage Reduction, Max Damage of Current Weapon. There are likely more.
    • Based on in-game observations, the Combat Script is likely based closely on the original Skyrim combat script, and thus it (a) appears to favor closing to within close combat distance (3-12 feet) whenever a clear path to their target presents itself, (b) does not appear to include provisions for engaging in defensive tactics beyond side-stepping and taking cover momentarily while closing to close combat distance, and (c) appears to favor strafing from side to side constantly during combat. Additionally, as in Skyrim, the Combat Script gives NPCs the ability to “sidestep dodge” any ranged attack, even if the NPC itself is not aware of the player or the incoming attack. This is most noticeable in Ghouls and flying enemies like Bloatflies and Stingwings, but can occur with any NPC.
    • Unless specifically scripted to do so for a quest or in-game “cutscene” by a Combat Override Package, NPCs cannot take advantage of defensive features like walls, parapets, trenches, fighting positions, etc. during an attack. The Combat Script forces them to open doors, run past walls and bunkers, stand and fire in the open, and stand in front of active turrets in order to execute its commands.
    • The Combat Script does not differentiate between weapons that deal explosive splash damage and other weapons. Combat Style has several variables that can be modified by the Creation Kit, one of which is Equipment Score Multiplier. Each type of “attack” available in the game has a separate Equipment Score Multiplier. Combat Script appears to be designed such that NPCs will multiply the Equipment Score Multiplier for every “attack” item in their inventory by the maximum damage of that item to determine what weapon the NPC will use for the current attack. Because of this, NPCs will usually (a) rapidly spam all grenades in their inventory during combat, (b) use Fat Man launchers and Missile Launchers as close combat weapons, and, combined with the AI behavioral preferences mentioned above, (c) quickly kill themselves, their friends, and you if they have access to anything explosive since these weapons tend to deal the highest amounts of raw damage and are most likely to be selected.
     
    Last edited: Oct 29, 2018
    WetRats, Yagisan, Koeran83 and 2 others like this.
  7. snarkywriter

    snarkywriter Well-Known Member Patreon Supporter Community Rockstar

    Joined:
    Jan 7, 2018
    Messages:
    271
    Likes Received:
    450

    WetRats, Koeran83 and RayBo like this.

Share This Page