Console commands (Fallout 4)/NPC changes

An overview of console commands for NPC changes $$

Overview
The console is a debugging tool in the PC version of Fallout 4. It is used for altering content while in-game. It cannot be used in the game console versions or in Survival mode.

NPC manipulation

 * – Kills the target (unless essential).
 * – Resurrects NPCs. Will not work on NPCs who are "scripted" to be dead by default, either through a quest script's effect or an internal data flag.
 * Warning: Be aware that NPCs with crippled limbs/head can spawn without them or with a collection of giblets where the limb/head used to be. Disabling and enabling the NPC again after the resurrect command should fix this. If the NPC is killed after resurrecting them, they may also fail to ragdoll on their second death.
 * Some creatures will not resume their "animated" state when resurrected, and will simply glide along the ground while not moving at all. This is entirely dependent on the race/species of the creature - creatures that always do so include Brahmin (both pack and non-pack variants) and Mister Gutsy. Disabling and enabling them again will fix this bug, but when not able to use those commands
 * – Enables you to barter with NPCs.
 * – Resets some NPCs.
 * Note: This causes randomly generated NPCs and random encounter NPCs (like a patrolling minuteman, raiders attacking a settlement, or a named traveling trader) to vanish completely from the area. This can be used without a "resurrect" command.
 * If used on the player, it will reset all effects currently affecting the player. This makes it useful for addressing glitches. The player's inventory will reset (be emptied), and any gear or items will be removed. A Vault 111 jumpsuit will be added and equipped. Appearance, level, perks, quests, caps, fatigue, and thirst do not reset.
 * Using the command on a companion will cause them to respawn on the next map change. Can be used when one is stuck in a Power Armor frame; the power armor set will spawn to the location where one wears it with all modifications undone.
 * It fixes the error from the above command by refreshing their model.
 * Using this command on a power armor frame will return the frame to its original location and replace all current armor pieces with a random assortment of leveled armor pieces (though the model won't change until entry).
 * Using this command on a random settler will "reroll" the settler, allowing for an alternate appearance or gender. "Rerolled" settlers will spawn at one of the settler spawn points around the settlement and will stick to it until the game is restarted (which will just assign them a new spawn point).
 * Note that this command will also reset the inventory of any NPC (including companions) to their default state, and any gear or items given to them will be forfeit (the "resurrect" command also has this issue, so make sure to take any important items off of their bodies before you use that command as well).
 * The command may be used while selecting any NPC with the console to open up their inventory (as if you were trading items with a companion) as a workaround for the above issues. This will work on any NPC, including creatures and robots (hostility does not stop it from working, either).
 * If used on a robot companion, it will remove every mod installed on it and reset its appearance to its default state.
 * – Kills all NPCs and creatures in the area except for companions and "essential" NPCs that are too important to die. They will instead slump down until healed with a stimpak, or until enough time passes.
 * – Kills all hostiles in the area. Non-hostiles are unaffected.
 * – It's a command that can be used on NPCs or settlers to get them to do things outside your settlements. A very useful command to make NPCs (guards, provisioners, etc.) get into power armor.
 * – A useful command function to order settlers/merchants/NPCs out of your power armor when dialogue is not offered. (Can happen on occasion when settlements are attacked.) First target the NPC, then type the command.
 * – Toggles the AI on an NPC. This basically freezes them until toggled again.
 * – With no selected target it will toggle the AI globally.
 * or – Toggles all AI combat routines.
 * – With no selected target it will toggle the combat AI globally.
 * – Toggles AI detection: Disables AI from detecting anything. Including other NPCs, creatures and the player character.
 * – Changes the sex of the NPC. Please note that this does not always come out comely.
 * Warning: Only use this on disposable NPCs. This will mess up NPCs essential to quests, but it can be remedied by restarting the game and loading a previous save.
 * – Allows an NPC to be permanently killed or alternatively - unable to be killed, depending on the value used (see below). Trying to set an NPC that is already "essential" (or not) to the same value they already had using this command doesn't do anything.
 * Note: As this requires the NPC's form ID (and what's shown when they are selected with the console is their ref ID), use their name and the "help" command to look up their form ID.
 * For example, to remove Deacon's essential status, type, then use the ID it lists for him in the above command.
 * – Allows the NPC to be permanently killed.
 * – Sets them to be unkillable.
 * – Returns 0 or 1 depending on whether the target is non-essential or essential.
 * – Returns 0 or 1 depending on whether the target is non-protected or protected (similar to isessential).
 * – Get Companion Affinity Level (Events usually triggered at 250, 500, 750, 1000 with 1000 being max, unless in a relationship with a companion which maxes at 1100)
 * – Sets Companion Affinity Level to an absolute value.
 * – Modifies Companion Affinity Level by a relative value.
 * Warning: Use setav for Companion Affinity to avoid unintended consequences.
 * - (AKA ) - The selected NPC, if currently pathing, is forced to forget its current path data, and start to find new paths from scratch.
 * - (AKA ) - The selected NPC, if currently pathing, is forced to regard the path it is currently trying to take as a failure, and to re-evaluate its current pathing options in that light.
 * – Resets an NPC's AI. Example use case: An NPC is endlessly trying to walk through a wall, or similar non-traversable obstacle, and the commands and/or  have revealed that it is not currently pathing.  will cause it to "forget" what it has "learned", which should stop its current behavior, and then begin "learning" again.
 * - Moves NPC with refID to player
 * or – Allows you to control selected AI.
 * Note: Does not (automatically) remove control of your previous character. As such all commands like moving forward will be sent to both controlled targets. Toggle to remove control from the player character.
 * – Causes the NPC to perform the specified idle. Idles can be found using the help command, by specifying a form type of IDLE (e.g.,  "idle" 4 IDLE).  [Note that not all idle's have the term idle in their editor IDs.  Use creation kit or xEdit to see the complete list.]  If the idle is not valid for the selected actor, nothing will happen (e.g., the actor is the wrong race, is/is not in first person, is/is not in power armor, etc.).  Top stop an idle, use  looseidlestop or to stop the player, open/close the pipboy.
 * Using to edit a companion's affinity level will not only adjust their current affinity level, but will impact all future instances which change affinity level by the cumulative modav CA_affinity values. For example, if  is input followed by a "dislike" event, the companions affinity would change by -7.50 + 100.00, causing the companion to gain a net 92.50 affinity, despite a negative event. To prevent this, it is recommended to use setav when modifying affinity, which will not affect affinity changing events. An event will need to be triggered for the change to register (and trigger dialog, etc.) using either setav or modav.

Factions

 * – Adds target to faction, needs to be used with a prefix or target, e.g. to add yourself to the player faction. 0=friend, 1=ally.
 * – Removes target from faction, needs to be used with a prefix or target
 * – Removes the target from all factions. Be aware that this will also remove the player character from the "player faction" if used on them.
 * – Makes two factions friendly with each other. 0=friend, 1=ally
 * – Makes two factions enemies with each other. 0=neutral, 1=enemy