Affinity

Affinity is a companion gameplay mechanic in Fallout 4. Companions can develop personal connections to the character and some may ask for help with quests of their own. Each companion has a distinct personality and values. Actions or dialogue that please one companion may displease another.

Raising the affinity value grants additional dialogue into their history or the possibility of romance. Reaching maximum affinity with a companion will unlock a special perk. The affinity value is a hidden statistic, meaning it is not possible to check the progress without console commands.

Scale
Typically, all companions begin at an affinity value of 0. If the affinity value reaches 500, they will "admire" the Sole Survivor and often reveal new dialogue. Raising their affinity to 1000+ (max is 1100) will result in them "idolizing" the Sole Survivor, at which point the Sole Survivor are granted their companion perk.

Lowering the affinity to a sufficient negative value will displease the companion, and they will issue a single warning to the Sole Survivor, asking them to change ways. If the affinity value drops further, they will become angry and refuse to travel with the Sole Survivor. This decision is permanent.

For most companions, new dialogue will be triggered when the affinity value reaches 250, 500, 750 and 1000.

Reactions
There are four different reactions a companion can have towards the player character's actions/dialogue that will affect their affinity value:

Some actions, such as modifying weapons, picking locks, and entering power armor will raise affinity with certain companions and can be repeated indefinitely. Performing a single one of these actions within range of multiple characters who respond to said actions will trigger the respective increases or decreases with all of them. However, these responses have a cooldown period, meaning it is not possible to perform the same action several times in a row to gain/lose affinity. For example, entering power armor will trigger only one instance of approval from Paladin Danse and/or X6-88 until sufficient time has elapsed.

It is however possible to perform different actions back-to-back and receive two or more separate instances of approval. (For example, picking a lock and then hacking a terminal will grant two separate approvals from Deacon.) Similarly, in a conversation with an NPC, each dialogue choice counts as an action unto itself, independent of the rest of the overall dialogue, so it is possible to obtain multiple likes and loves in the same set of dialogue with the same NPC. (For example, in Order Up, the Sole Survivor can gain two likes from Piper by saying "You're both wrong" to Wolfgang, then agreeing to talk down Trudy.) For a more-detailed list of what specifically pleases or displeases a companion, see the respective companion page.

Affinity can be also increased passively by simply having a companion follow the Sole Survivor. The increase depends on the current affinity level and will be lower with higher affinity values. The formula for the increase is 40 - 0.033 x affinity value. (i.e. companions with 100 Affinity will gain a 36.7 increase, companions with 250 = +31.75, 500 = +23.5, 750 = +15.25, 990 = +7) This only applies if a quest has been completed since the companion was last chosen. Thus, the method is most effective in the time just after meeting them, with the addition of sending them to the same settlement(s) to be rotated with greater ease between turning in quests.

Romance
Certain companions are potential candidates for romance and throughout the course of their affinity based conversations, the dialogue option to "flirt" will be available. At the highest level of affinity - and final conversation - the "romance" option will be available. Both options are speech checks. Successfully flirting will reduce the difficulty of the final romance check and successfully passing that will make the companion a love interest. This is result in them addressing in a more affectionate manner (for example Preston Garvey will call "Babe" or Danse will say "I always have time for you" when attempting to talk to him). Also, sleeping in a bed with them nearby will also grant the Lover's Embrace perk.

Companion romances are not mutually exclusive; if a new companion is romanced, previously romanced partners will still confer the benefits of the Lover's Embrace. However, some romanced partners will "hate" or "dislike" flirting in their presence, including flirting with Magnolia at The Third Rail.

Even if one fail to romance a companion, they still have chances to try this again: after a certain amount of time the companion will initiate a conversation regarding their relationship with the Sole Survivor as their best friend and from there the player character can try to romance them if they want to.

To end a romance, drop the companion's Affinity value below 750. One can make this happen by doing things they dislike or hate until they tell they want to take a break. the Sole Survivor can check the progress by selecting them with the console and then using the command getav ca_affinity.

A shortcut is to use the console command setav ca_affinity. Select the companion with the console and then use the command setav ca_affinity 764. Now do something the companion dislikes, lowering the Affinity value by 15 and dropping it to 749, the maximum it can be for them to initiate the break-up dialog. Only the action itself can initiate the dialog, and only if it drops the Affinity value from 750+ to below 750.

To fix a romance, raise the companion's affinity value back up to 1000+. One can use "setav ca_affinity 985" and then do something the companion likes or loves to bring it over 1000.

Conversely, affinity can be set between 1030 and 1100 before doing something a companion dislikes or hates, so long as the resulting affinity value is still above 1000 after the action. The message noting they disliked or hated it will appear along with the message noting they idolize the Sole Survivor. Very useful for companions like Curie that have few non-quest affinity triggers.

Companion perks
Those perks are acquired by reaching the maximum level of affinity with a companion. The perks obtained this way are permanently obtained, whether the Sole Survivor keeps travelling with the associated companion or not.

Repeatable actions
The following actions not only increase the affinity of the listed companions, but can be repeated after an internal "cooldown" has reset.

Weapon modding

 * Codsworth and Danse love this. Preston and X6-88 like this.  It is easily repeated with the "None" attachment, which simply removes an existing modification and costs nothing to produce.  They can all be affected by being within range of the weapon workbench simultaneously, making it much easier to raise all four companions' affinity.

Armor modding

 * Codsworth and Danse love this. X6-88 likes this.  See Weapon modding.

Entering power armor

 * Danse and X6-88 like this. Note that Strong dislikes this, so he should not be in the same settlement or general location while performing this.

Stealing

 * MacCready likes this. Can be repeated by placing an item in a container owned by someone else and taking it back out, preferably in an area the Sole Survivor can close from prying eyes such as a hotel room in Goodneighbor (must wait 48 hours between each item you steal, or will not work).

Pickpocketing

 * Cait likes this. Works with items of any value, even a single round of .38 caliber ammunition.  Can be repeated by reverse-pickpocketing the stolen item (or any item of low value and weight) back into the person's inventory.  May require ranks in Pickpocket perk to boost chances of success.  Grenades are not recommended as they will act as live grenades.

Lockpicking
Such safes can be found in:
 * Cait, Deacon, and Piper like this. MacCready likes this, but only to locks owned by others, whereas Piper dislikes picking owned locks. Strong dislikes picking any locks.
 * Can be repeated by using a safe that has a terminal attached to it, opening the safe then using the terminal to lock it again.
 * Fiddler's Green Trailer Estates
 * Medford Memorial Hospital (advanced)
 * Back Street Apparel (advanced 1st floor)
 * Hubris Comics (Grognak's axe case)
 * Greenetech Genetics (expert 7th floor)
 * Super Duper Mart (advanced)
 * Ticonderoga (expert 1st floor near exit terminal)
 * Cambridge Polymer Labs (up the staircase and to the left in the main lab)
 * Fraternal Post 115 (Second floor office at North side. Novice terminal and Floor safe)

Hacking

 * Nick, Deacon, and X6-88 like this. After an unspecified amount of time away from a map cell, it and its contents reset, including any terminals, which become "re-locked" and can be hacked again.

Using chems

 * Hancock likes this, as does Cait prior to her companion quest. Afterwards, she dislikes it. Codsworth, Danse, Deacon, and X6-88 dislike this.

Addiction

 * Hancock likes this, as does Cait prior to her companion quest, dislikes it afterwards. Everyone else dislikes when an addiction develops, except Nick, Piper, and Strong, who are indifferent. Developing an addiction is independent of the initial like/dislike from using the chem that caused it.

Using alcohol

 * Cait likes consuming hard liquor before her companion quest. Afterwards, she is indifferent to it.
 * Old Longfellow likes this. Like Cait, he is indifferent to the consumption of beer.

Nudity

 * Cait and Hancock like this for both sexes. Triggers by transitioning between two areas (indoor or outdoor) while not wearing any clothing underneath armor (the player character can still wear arm guards, leg guards, and chest pieces, but nothing underneath like the vault jumpsuit).
 * A fast way to do this is to buy the Home Plate house in Diamond City for 2,000 caps. Place a bed in front of the door, sleep for two hours, then exit to Diamond City and re-enter Home Plate. Rinse and repeat as necessary.
 * Another way is to find two areas with chairs the Sole Survivor can wait in and a door separating them into two different maps. 'Wait' for 2 hours in one, go through the door and wait 2 hours in the other, and go back through the door. Rinse and repeat as necessary. Approval triggers once on each pass through the door. A good example is the couch in Publick Occurrences and the couch against the wall of the barber stand outside.

Cannibalism
Strong likes this. As such, this is one of the few actions that can be used to maximize his notoriously difficult affinity. (Requires Cannibal perk.)

Healing Dogmeat
Everyone except Strong, X6-88 and MacCready like this. Repeating this will likely require deliberately wounding Dogmeat in a settlement with the character(s) in question nearby, as the Sole Survivor can only have one companion out at a time. Note that sometimes settlers will attack if the Sole Survivor attacks Dogmeat, so be sure to bring him to an area with no settlers. Dogmeat can be wounded by falling damage which can easily be caused in workshop mode, by building several stairs which can then be selected or deleted from under him.

Easing settlers' troubles
Curie, Nick, Piper and Preston like accepting quests from settlers, though only if peaceful dialogue is used. This can be repeated, and will occur if talking to the settler first, or after receiving the quest from Preston Garvey or Radio Freedom, then talking to the settler.