Guide:NPC Happiness

From Terraria Wiki
Jump to navigation Jump to search
This is a Guide page.
This is a Guide page.
This means the page will walk you through a specific task, strategy, or enemy/boss fight.
Status: Subject to revision (This Guide does not meet certain quality standards and may be heavily outdated.)
Desktop versionConsole versionMobile version
Desktop/Console/Mobile-Only Content: This information applies only to the Desktop, Console, and Mobile versions of Terraria.

The NPC happiness mechanic poses a complex puzzle to avoid paying excessively high prices. Many NPCs who like each others' company prefer different biomes, and some NPCs like another but are disliked or hated in return. Additionally, purchasing pylons in order to set up a network is impossible without putting thought into NPC happiness.

There are several different ways to address the situation, and this guide is intended to discuss them. The last section gives a single general solution for all NPCs, but before that it is worth discussing more flexible strategies.

Basic Constraints

The exact rules are listed on NPCs § Factors affecting happiness, but the issues can be summarized (all of these factors combine):

  • NPCs get a 12% or 6% bonus for being in a loved or liked biome, or a penalty for being in a hated or disliked one.
    • If the existence requirements for multiple biomes are met, and the NPC loves/likes one of the biomes, but hates/dislikes one of the others, the loved/liked biome will take priority. Biomes that the NPC is neutral to are ignored.
    • For purposes of NPC happiness, the Ocean biome only requires being within 380 tiles laterally of the true world edge (within 338 tiles of the accessible edge) and above the midpoint of the Underground layer. No water is necessary. Additionally, within this area, Forest and non-Hallowed Desert biomes are impossible for NPC happiness purposes.
    • The only biomes that are mutually exclusive (i.e. the existence requirements for both cannot simultaneously be met) are Desert/Ocean (since everything within the 380/338-tile range is considered an Ocean, which prevents non-Hallowed Deserts (Hallow/Desert/Ocean is possible if 1500 pearlsand blocks are present)) and Forest/anything else (since, to be considered a Forest, all the other biome existence requirements must not be met). This means that, for instance, a town in an Underground Hallowed Ocean can house a Demolitionist, Clothier, and Wizard and grant liked biome bonuses for all three.
  • They get a similar bonus or penalty for being housed nearby another NPC they love, like, dislike, or hate.
    • "Nearby" in this context means that their housing flags are within 25 tiles (50 feet) euclidean distance of each other.
  • They get an overcrowding penalty for having more than three nearby NPCs (not including the NPC the multiplier would be applied to), no matter the relationship. The penalty is 5% for each additional nearby NPC, i.e., for the fourth, the fifth, etc. nearby NPC.
  • Conversely, they get a 5% "solitude" bonus for not having more than two NPCs nearby, and having no more than three other NPCs (that is, the two "roommates" do not count) within 120 tiles.
    • Note that this much larger range may sometimes represent over a full screen's width.

The above factors affect a variety of transactions with NPCs:

  • Vendor prices for selling their items will be lower if they are happy, higher if they are unhappy.
  • Conversely, vendor prices for buying the player's items will be higher if they are happy, lower if they are unhappy.
  • This does affect the Nurse's fees for healing and the Goblin Tinkerer's reforging costs.
  • This also affects the Angler's quest rewards – if happy or unhappy, he will give rewards as if the player had completed more or fewer quests, respectively.
  • This even affects the Tax Collector's revenue stream – if happy, he will not only collect more money in a given time, but gather a higher maximum amount, and the reverse if he is unhappy.

Two other factors come into play, but for these, happiness is irrelevant – all that matters is the NPC's presence:

  • NPCs also suppress enemy spawning nearby. In Normal mode, 3 NPCs "on screen" are needed to completely suppress the spawning of enemies, which is usually desirable for a town.
  • To remain functional, a pylon needs to have two NPCs housed within a 169×124-tile rectangle centered on the pylon.

Depending on game progress, there are also up to three town pets available. These count as NPCs for pylons and enemy suppression, but not for crowding/solitude calculations; while it is sometimes claimed that they can affect the happiness of nearby NPCs, this is not the case either positively or negatively, rendering them useful primarily for keeping a town eligible for pylons and enemy suppression when other NPCs are not available (for instance, keeping a dog and cat in the same duplex as the Nurse and Arms Dealer would prevent you from accidentally disabling their pylon if you often relocate the two of them for boss fights), or for extending a town's enemy suppression zone further without crowding its inhabitants.

Casual Strategy

Some more general points to consider:

  • Empty houses are not considered – even if a given space could house an NPC, if it does not, then it has no effect on NPC happiness.
  • Not all NPCs are created equal:
    • The Goblin Tinkerer is widely considered the largest money sink in the entire game, so any discounts you can get from him will add up.
    • Similarly, the Tax Collector is an ongoing revenue stream, so you'll want to keep him happy.
    • The Nurse's prices do not necessarily matter much, in the sense that you're usually in no position to bargain when you need her services. However, if you are likely to use her often, you should probably try to keep her happy. While a Potion of Return can let you drop by wherever she is, this will not be desirable during some boss fights, so if you are bringing her to the fight, you might want to bring a roommate along to keep her happy.
    • If you rarely purchase from a given NPC or their wares are cheap (like the Painter's), you will not have to care much about their happiness – and with a little advance warning, you can move them into a better environment when you do need to make a big purchase.
    • You want at least one vendor to be as happy as possible for selling your items.
    • The Guide's happiness has no effect at all and can be disregarded entirely.
    • The Tavernkeep's items which cost Defender Medals cannot be discounted, thus any happiness benefits apply mostly to buying Eternia Crystals.

Examining the rules, it seems that a reasonable strategy is as follows:

  • Pick locations for your pylons (and perhaps some non-pylon bases), and cluster three or four NPC homes at each of them. Some biomes may need a second town, in which case you should refer to the "Basic Constraints" section to not overcrowd your NPCs.
  • You may want to include a "guest room" in each of these towns, an additional housing-suitable space. This does not need to be filled up front, but it lets you bring in a liked or loved roommate on short notice, and also serves as ready housing for new arrivals until you pick a new spot for them.
  • This allows you to give all the NPCs some space, while making sure the pylon stays functional.
  • The third NPC, or a town pet, comes in handy in case you need to pull an NPC elsewhere on short notice.

For getting your first pylons quickly, the Nurse and Arms Dealer together will have the arms dealer produce a pylon for sale. For the NPCs to appear, the arms dealer requires that a gun or bullets be inventory (from smashing a orb or heart is the easiest way but beware of bosses appearing for each 3rd one smashed), and the Nurse requires >100 HP and the Merchant (+50 silver total among players in inventory) in the world.

WIP: Optimal Strategy

The following strategy (although not achieving the highest possible average happiness) provides a town in every biome for pylon access, the minimum price for the Goblin Tinkerer, and low prices across the board.

Assume that every row is its own town. Make sure to separate towns based on the 25-tile and 120-tile overcrowding rules.

The Underground, Caverns, and Underworld are all liked/disliked in tandem with each other. To be concise, these three biomes will simply be referred to as "Caverns" outside of the tables.

TODO: move table format to the one in pre-1.4.3.3

Recommended Setup
Biome(s) NPCs (and price modifier - lower is better)
Forest Zoologist(0.84) Golfer(0.84) n/a
Forest1 Merchant(0.84) Nurse(0.84) Arms Dealer(0.84)
Hallow Party Girl(0.79) Wizard(0.89) n/a
Underground Hallow2 Tavernkeep(0.79) Demolitionist(0.79) n/a
Desert3 Steampunker(0.79) Cyborg(0.89) n/a
Jungle Dryad(0.84) Painter(0.79) Witch Doctor(0.84)
Ocean Stylist(0.84)4 Angler(0.89) Pirate(0.83)
Underground Snow5 Goblin Tinkerer(0.75) Mechanic(0.79) Dye Trader(0.95)
Snow6 Clothier(0.89) Tax Collector(0.89) n/a
Snow Santa Claus(0.84) n/a n/a
Glowing Mushroom biome Guide(0.95) Truffle(0.79) n/a

1. The Merchant, Nurse, and Arms Dealer may be placed in the Hallow to prioritize the Nurse. This will increase the Merchant's price modifier from 0.84 to 0.89 (+0.05) but decrease the Nurse's from 0.84 to 0.79 (-0.05)

2. It may be preferable to place the Tavernkeep and Demolitionist in the Caverns. This will increase the Tavernkeep's price modifier from 0.79 to 0.84 (+0.05), but allows for more freedom in the Cavern pylon's placement.

3. The Steampunker and Cyborg may be placed in the Snow biome to prioritize the Cyborg. This will increase the Steampunker's price modifier from 0.79 to 0.84 (+0.05) but decrease the Cyborg's from 0.89 to 0.84 (-0.05). This will also remove the only Desert town, making that pylon useless.

4. The Stylist may be separated from the Angler and Pirate to prioritize the Pirate. This will decrease his price modifier from 0.83 to 0.79 (-0.04) but increase the Stylist's from 0.84 to 0.89 (+0.05).

5. Similarly to (2), it may be preferable to place the Goblin Tinkerer, Mechanic, and Dye Trader in the Caverns. This would increase the Mechanic's price modifier from 0.79 to 0.89 (+0.10), but allows for more freedom in the Cavern pylon's placement.

6. Placing the Clothier and Tax Collector in the Underground Snow biome would decrease the Clothier's price modifier from 0.89 to 0.84 (-0.05). However, this removes the only Surface Snow biome town with at least 2 NPCs, and thus may not be preferable for pylon placement.

TODO: talk about princess placement here

TODO: add wizard-priority table for mages

WIP: Setup Progression: From Fully Optimal to Recommended

You may ignore this section unless you are interested in why the recommended setup is not fully optimal. That is, it does not have the highest average happiness (or lowest average price modifier) possible.

We will start with the fully optimal setup and make changes progressively until we arrive at the earlier setup. None of these setups will include the Princess's placement.

Every setup will have the price modifiers summed up and the average price modifier listed. These do not include the Princess, but they also do not include the Guide, as his happiness is irrelevant (as mentioned before).

The following setup has been produced using this calculator with default parameters. As combinational biomes aren't considered in the calculator, the table has been edited in a purely numerically beneficial way.

Fully Optimal Setup
Biome(s) NPCs (and price modifier - lower is better)
Forest Zoologist(0.84) Golfer(0.84) n/a
Forest Merchant(0.89) n/a n/a
Hallow Party Girl(0.79) Wizard(0.89) n/a
Underground Hallow Tavernkeep(0.79) Demolitionist(0.79) n/a
Hallowed Desert Nurse(0.79) Arms Dealer(0.79) Dye Trader(0.84)
Jungle Dryad(0.84) Painter(0.79) Witch Doctor(0.84)
Ocean Stylist(0.84) Angler(0.89) Pirate(0.83)
Underground Snow Goblin Tinkerer(0.79) Mechanic(0.79) Santa Claus(0.84)1
Underground Snow Clothier(0.84) Tax Collector(0.89) n/a
Snow Steampunker(0.84)2 Cyborg(0.84)2 n/a
Glowing Mushroom biome Guide(0.95) Truffle(0.79) n/a

1. Santa Claus does not interact with the Goblin Tinkerer or Mechanic positively or negatively. He is placed as such to consolidate towns, but may be put somewhere else in the Snow biome (as long as it isn't with the Tax Collector).

2. The Steampunker and Cyborg may be moved to a Desert town and keep the same average happiness. This will decrease the Steampunker's price modifier from 0.84 to 0.79 (-0.05) but increase the Cyborg's from 0.84 to 0.89 (+0.05). However, this will also eliminate the only Surface Snow biome.

All the price modifiers summed up is 19.90, and the average is 0.8292. (Recall that lower is better.)

While this strategy is good, it is not completely ideal. As mentioned before, the Goblin Tinkerer is one of the largest money-sinks in the game, and should likely be given top priority. The following prioritizes the Goblin Tinkerer's price modifier, lowering it to the minimum value of 0.75.

Goblin Tinkerer Prioritized
Biome(s) NPCs (and price modifier - lower is better)
Forest Zoologist(0.84) Golfer(0.84) n/a
Forest Merchant(0.84) Nurse(0.84) Arms Dealer(0.84)
Hallow Party Girl(0.79) Wizard(0.89) n/a
Underground Hallow Tavernkeep(0.79) Demolitionist(0.79) n/a
Jungle Dryad(0.84) Painter(0.79) Witch Doctor(0.84)
Ocean Stylist(0.84) Angler(0.89) Pirate(0.83)
Underground Snow Goblin Tinkerer(0.75) Mechanic(0.79) Dye Trader(0.95)
Underground Snow Clothier(0.84) Tax Collector(0.89) n/a
Snow Steampunker(0.84) Cyborg(0.84) n/a
Snow Santa Claus(0.84) n/a n/a
Glowing Mushroom biome Guide(0.95) Truffle(0.79) n/a

All the price modifiers summed up is 20.02, and the average is 0.8342.

Prioritizing the Goblin Tinkerer has some rippling effects due to the Dye Trader's move. Here is a list of numerical differences:

  • Merchant: -0.05
  • Nurse: +0.05
  • Goblin Tinkerer: -0.04
  • Dye Trader: +0.11
  • Arms Dealer: +0.05
  • Overall: +0.12

Unfortunately, these shifts have caused our Desert town to disappear, so one of our pylons has become useless. The following setup fixes this issue (and is the same as the recommended one).

Pylon-Fixed Setup
Biome(s) NPCs (and price modifier - lower is better)
Forest Zoologist(0.84) Golfer(0.84) n/a
Forest Merchant(0.84) Nurse(0.84) Arms Dealer(0.84)
Hallow Party Girl(0.79) Wizard(0.89) n/a
Underground Hallow Tavernkeep(0.79) Demolitionist(0.79) n/a
Desert Steampunker(0.79) Cyborg(0.89) n/a
Jungle Dryad(0.84) Painter(0.79) Witch Doctor(0.84)
Ocean Stylist(0.84) Angler(0.89) Pirate(0.83)
Underground Snow Goblin Tinkerer(0.75) Mechanic(0.79) Dye Trader(0.95)
Snow Clothier(0.89) Tax Collector(0.89) n/a
Snow Santa Claus(0.84) n/a n/a
Glowing Mushroom biome Guide(0.95) Truffle(0.79) n/a

All the price modifiers summed up is 20.07, and the average is 0.8363.

To recover our Desert town, the Steampunker and Cyborg have been relocated to the Desert. However, this causes us to lose our only Surface Snow town, so the Clothier and Tax Collector have been brought to the surface. This has affected prices in the following ways:

  • Steampunker: -0.05
  • Cyborg: +0.05
  • Clothier: +0.05
  • Overall: +0.05

Our setup is now in its (mostly) ideal form. The Goblin Tinkerer is prioritized, and there is a town in every biome that has its own pylon. Refer to the "Recommended Setup" table for choices regarding additional prioritizations and possible introduction of a Caverns biome for more freedom in pylon placement.

Pre-1.4.3.3 Calculated strategy

The following text and table was created before the 1.4.3.3 update, which increased the limit for the solidarity bonus and overcrowding penalties by one. It is being preserved for now, but may disappear eventually. Please disregard it.

An "optimal solution" for clustering all the NPCs is listed below, maximizing average happiness across all NPCs. This includes all NPCs including Hardmode (except for the Princess), and represents a single setup meant to be left unchanged. By nature, such an optimization cannot take full account of issues such as easy access or pylon placement, and this one is fairly simple – focused on average happiness, no priority for the "important" NPCs mentioned above, and it assumes all NPCs are paired or alone.

It is assumed that for each NPC A, there are at maximum two other NPCs within 25 tiles and there are at maximum three other NPCs between 25 and 120 tiles away. The final values include the 5% bonus granted for this "solitary" setup.

NPC A NPC B Biome Price modifier for NPC A
ZoologistZoologist GolferGolfer ForestForest 84%
GolferGolfer ZoologistZoologist ForestForest 84%
MerchantMerchant n/a ForestForest 89%
NurseNurse Arms DealerArms Dealer DesertDesert 84%
Arms DealerArms Dealer NurseNurse DesertDesert 79%
TavernkeepTavernkeep DemolitionistDemolitionist UndergroundUnderground /
CavernCavern /
The UnderworldThe Underworld
84%
DemolitionistDemolitionist TavernkeepTavernkeep UndergroundUnderground /
CavernCavern /
The UnderworldThe Underworld
79%
Tax CollectorTax Collector ClothierClothier UndergroundUnderground /
CavernCavern /
The UnderworldThe Underworld
95%
ClothierClothier Tax CollectorTax Collector UndergroundUnderground /
CavernCavern /
The UnderworldThe Underworld
84%
Party GirlParty Girl WizardWizard The HallowThe Hallow 79%
WizardWizard Party GirlParty Girl The HallowThe Hallow 89%
MechanicMechanic Goblin TinkererGoblin Tinkerer Snow biomeSnow biome 79%
Goblin TinkererGoblin Tinkerer MechanicMechanic Snow biomeSnow biome 84%
SteampunkerSteampunker CyborgCyborg Snow biomeSnow biome 84%
CyborgCyborg SteampunkerSteampunker Snow biomeSnow biome 84%
Santa ClausSanta Claus n/a Snow biomeSnow biome 84%
DryadDryad Witch DoctorWitch Doctor JungleJungle 84%
Witch DoctorWitch Doctor DryadDryad JungleJungle 84%
PainterPainter n/a JungleJungle 89%
AnglerAngler PiratePirate OceanOcean 89%
PiratePirate AnglerAngler OceanOcean 79%
Dye TraderDye Trader StylistStylist OceanOcean 95%
StylistStylist Dye TraderDye Trader OceanOcean 79%
GuideGuide TruffleTruffle Glowing Mushroom biomeGlowing Mushroom biome 95%
TruffleTruffle GuideGuide Glowing Mushroom biomeGlowing Mushroom biome 79%
Simple NPC Setup
Biome 1st set of neighbors1 2nd set of neighbors1
Forest Golfer Zoologist Merchant n/a
Snow Biome Steampunker Cyborg Mechanic Goblin Tinkerer
Desert Arms Dealer Nurse n/a n/a
Underground / Cavern / The Underworld Tax Collector Clothier Demolitionist Tavernkeep
Ocean Angler Pirate Stylist Dye Trader
Jungle Dryad Witch Doctor Painter n/a
The Hallow Wizard Party Girl n/a n/a
Glowing Mushroom biome Truffle Guide n/a n/a

Town pets can be placed anywhere. Placing them at the locations with only 2 NPCs can help keep pylons powered in the event that one of the NPCs is somewhere else or missing.

The Princess should be placed in the Forest2, Desert, Jungle2, The Hallow, or Glowing Mushroom biome to avoid over crowding in the other locations.

1. There must be a 25 tile gap separating the 2 Neighbor groups.

2. The Princess would have to be placed near the Merchant or Painter.

The above setup can be improved by putting nearby NPCs in different biomes.

1. Put the Nurse in a nearby hallow to the Arms Dealer. If there is none, make one using seeds or a clentaminator. Just make sure it can't spread to the desert and override it.

2. Put the Mechanic in an ice cavern biome, then put the Goblin Tinkerer in a regular cave nearby.

3. Do the same with the Tax Collector and the Clothier, with the Tax Collector in the ice caverns and the Clothier in the regular caverns.

4. Create a nearby snow biome to a desert or vice versa and put the Steampunker in the Desert and the Cyborg in the Snow.

5. Put the Truffle in the Glowing Mushroom Biome with a nearby Forest for the Guide.