Terraria Wiki

  • Discussions are now available on the Terraria Wiki.
  • Miss the old Hydra Skin? Try out our Hydralize gadget! Visit the preferences page while logged in and turn on the gadget.

READ MORE

Terraria Wiki
(I'm not sure why this is so far down the article, when it's specifically written to help beginners. It should be above all the technical info.)
Line 13: Line 13:
   
 
The requirements for a player-selected [[Bed]] to work as a spawn point are similar to those for NPC housing, but weaker. Players do not need furniture beyond the bed. See the [[Beds]] page for full details.
 
The requirements for a player-selected [[Bed]] to work as a spawn point are similar to those for NPC housing, but weaker. Players do not need furniture beyond the bed. See the [[Beds]] page for full details.
  +
 
== A Simple, Valid house ==
 
[[File:Simpliest Housing.png|thumb|A simple valid house.]]
 
Materials required:
 
* 25 [[Dirt Block]]s for floor, wall and ceiling.
 
* 32 crafted [[Dirt Wall]]s (8 Dirt Blocks) for background wall.
 
* [[Wooden Door]] (6 Wood). Can be replaced with one [[Wood Platform]].
 
* [[Wooden Chair]] (4 Wood).
 
* [[Wooden Table]] (8 Wood) or [[Work Bench]] (10 Wood).
 
* [[Torch]] (1 Wood, 1 [[Gel]], results 3 torches).
  +
 
Summary raw materials:
 
* 33 [[Dirt Block]]s
 
* 19 [[Wood]] if using a door, 14 Wood if using a single wood platform.
 
* 1 [[Gel]]
  +
 
This will work, but if one do not want their house occupied by [[vines]], replace dirt with wood, stone, or mud. While this is a simple option, it's susceptible to [[The Corruption|Corruption]], [[The Crimson|Crimson]] or [[The Hallow|Hallow]] in [[Hardmode]].
   
 
== Housing Menu ==
 
== Housing Menu ==
Line 371: Line 388:
 
| 13 tiles wide × 2 tiles high {{eicons|1.3.0.1|invert=y}}<ref>Only possible when using platforms as a ceiling. No longer possible on {{eversions|1.3.0.1|short|nl=y}}.</ref>|| 15 tiles wide × 4 tiles high
 
| 13 tiles wide × 2 tiles high {{eicons|1.3.0.1|invert=y}}<ref>Only possible when using platforms as a ceiling. No longer possible on {{eversions|1.3.0.1|short|nl=y}}.</ref>|| 15 tiles wide × 4 tiles high
 
|}
 
|}
 
== A Simple, Valid house ==
 
[[File:Simpliest Housing.png|thumb|A simple valid house.]]
 
Materials required:
 
* 25 [[Dirt Block]]s for floor, wall and ceiling.
 
* 32 crafted [[Dirt Wall]]s (8 Dirt Blocks) for background wall.
 
* [[Wooden Door]] (6 Wood). Can be replaced with one [[Wood Platform]].
 
* [[Wooden Chair]] (4 Wood).
 
* [[Wooden Table]] (8 Wood) or [[Work Bench]] (10 Wood).
 
* [[Torch]] (1 Wood, 1 [[Gel]], results 3 torches).
 
 
Summary raw materials:
 
* 33 [[Dirt Block]]s
 
* 19 [[Wood]] if using a door, 14 Wood if using a single wood platform.
 
* 1 [[Gel]]
 
 
This will work, but if one do not want their house occupied by [[vines]], replace dirt with wood, stone, or mud. While this is a simple option, it's susceptible to [[The Corruption|Corruption]], [[The Crimson|Crimson]] or [[The Hallow|Hallow]] in [[Hardmode]].
 
   
 
== Achievements ==
 
== Achievements ==

Revision as of 11:34, 20 September 2021

Valid House Door

A basic House.
9 (exterior width) × 7 (exterior height)

See also Guide:Bases for Building an NPC Town (or Base)
See also Multi-Crafting Areas for examples on how to build a crafting room.
See also Beds for setting a player's spawn point.

A House (or Home) is a structure built by the player that Town NPCs require in order to spawn, with one House required per NPC. A structure must meet several requirements in order to function as a House (see details below). The player can check if a structure meets the requirements by using the Housing Menu's top button, labeled with a question mark ("?"). NPCs generally retreat to their Houses at night and remain in them until dawn. They will also retreat to their houses during a Solar Eclipse or Rain or during any Event.

The Guide will appear upon starting a new world, and if killed, he will require a House in order to respawn. The Old Man, the Traveling Merchant, and the Skeleton Merchant do not require Houses.

Similarly, the Guide, Angler, Goblin Tinkerer, Tavernkeep, Mechanic, Stylist, Wizard, Tax Collector, and Golfer will each make their initial appearances regardless of available housing. Once initially found, each will require a suitable House before respawning.

Certain naturally-generated structures can serve as Houses and may inadvertently attract NPCs if players have placed light sources within them. These can include Floating Island structures, and Living Tree treasure rooms qualified. NPCs can be moved from these to the player's structures using the Housing Menu.

The requirements for a player-selected Bed to work as a spawn point are similar to those for NPC housing, but weaker. Players do not need furniture beyond the bed. See the Beds page for full details.

A Simple, Valid house

Simpliest Housing

A simple valid house.

Materials required:

Summary raw materials:

This will work, but if one do not want their house occupied by vines, replace dirt with wood, stone, or mud. While this is a simple option, it's susceptible to Corruption, Crimson or Hallow in Hardmode.

Housing Menu

Housing Menu Interface

Housing Menu

The menu for managing the placement of NPCs, accessed through clicking the small house icon above the armor slots.

The Housing menu allows the player to check whether the houses built are suitable for use or not, as well as to manually appoint a house for a specific NPC. To access this menu, click on the house icon in the Inventory.

To check whether a house is suitable for use, click on the "?" housing query mark and then click anywhere inside the house; A status message indicating whether the house is suitable or not will be displayed. If it is not suitable, the game will show what the house is lacking. This alert prioritizes walls (both fore and background), then furniture (door, light source, table, and chair). A generic "This is not valid housing." can indicate that the frame is not closed, or that there is no place for the NPC to stand (see below).

Once a house is determined to be suitable, the player may assign an NPC to it by placing the corresponding NPC Flag in it. Note that only the flags of existing NPCs will appear. For example, when first entering a new world, only the Guide's NPC Flag is shown. NPC Flags for other NPCs will only be shown when they have spawned in the world. On the PC version PC version, Console version Console version, Mobile version Mobile version, tModLoader version tModLoader version, and tModLoader 1 tModLoader 1.3-Legacy version, NPC Flags have two different appearances: solid red and red with a golden frame. NPCs that move in by their own will have a regular red flag. If they are assigned to a house, the banner will have a golden frame. This indicates that if the NPC currently inhabiting the home were to die, the replacement for that NPC would move into that specified home.

In the Old-gen console version Old-gen console version, the housing menu can be opened by pressing Inventory and navigating to the housing menu. To check whether a house is valid, press Quick Buff and the housing status of the house the player is standing in will be printed in chat. Press Inventory to show/hide room flags.

When the player first meet the spawn conditions for an NPC, a random house will be assigned to them from existing empty suitable houses.

House validity evaluation

The house validity evaluation can be divided into 3 phases: Frame check, Furniture check, and properties check.

Frame

At this phase, the game will try to determine the frame and the internal area of a housing, and complete several checks to its structure. [1]

The range of a housing includes a "connected" internal area and the "frame" surrounding it, in details:

  • A tile can be "connected" in 8 directions, which means that tiles in the internal area have to be connected with each other in horizontal, vertical, or diagonal directions.
  • "Frame" refers to the tiles surrounding the internal tiles. The frame must be completely closed (i.e. the internal area is completely unconnected to any tiles outside). The frame can only be made up of solid tiles (solid blocks or platforms that are not actuated) , Trap Doors, Doors, or Tall Gates (only the tiles occupied when the doors are closed will count into the frame).

All tiles within the range of a house have to meet the following requirements:

  • All tiles must be at least 10 tiles away from true world edges. [2]
  • "Holes" that are 5 tiles or more in height/length are not permitted. A "hole" is a tile that is neither occupied by a valid solid tile nor a valid background wall.
  • In the range of a housing, there must be at least 60 but fewer than 750 total tiles.

Furniture

At this phase, the game will check for pieces of furniture inside the housing.

In the range of a house, there must be at least one valid light source, one valid flat surface item, one valid comfort item, and one valid entrance. [3]The easiest and smallest objects that meet the requirements is a torch, a workbench, a chair and a platform. See below for a detailed list.

  • Not every item that provides light will fulfill a House's light source requirement; in particular, no "foreground blocks", platforms, or walls qualify.
  • The entrance does not need to be usable by the NPC (e.g. NPCs can't use trap doors) nor does it have to lead "outdoors" (e.g. an indoor platform also works).
  • Any type of each item listed below will fulfill the requirement. For example, any color Torch will work, as will any theme of Chairs.

Light sources

Template:Item/options

Flat surface items

Comfort items

Entrance

Template:Item/options

Properties

At this phase, two properties of a house are checked to determine whether it is a valid housing: one is the "Evil score", the other is the "Home tile score". [4]

  • First, the game will check whether the house is occupied by another NPC. If true, then the house is invalid and the status message "This housing is already occupied." will be displayed.

Evil score

Then, start calculating the Evil score.

  • The area checked will be an extended area of the range of a housing. The extended distances differ with versions, and in 1.4.2.3 they are:
    • Horizontal: Start from the leftmost/rightmost tiles within the range of a housing, extend 45 tiles to both left and right side.[5]
    • Vertical: Start from the highest/lowest tiles within the range of a housing, extend 43 tiles upwards and 46 tiles downwards.[5]
  • If any of the four borders of the area checked is less than 5 tiles from the true world edge, then draw back the area to 5 tiles away from the edge. [6]
  • Calculate the total Evil score of all valid tiles (including the actuated ones) within the area, see the table below for details:
Tiles Impact to the score
Corrupt grassCorrupt grass +1 point for each tile
Ebonstone BlockEbonstone Block
Purple Ice BlockPurple Ice Block
Ebonsand BlockEbonsand Block
Ebonsandstone BlockEbonsandstone Block
Hardened Ebonsand BlockHardened Ebonsand Block
Corruption thorny bushesCorruption thorny bushes
Corruption Plants Corruption Plants
Vile MushroomVile Mushroom
Crimson grassCrimson grass
Crimstone BlockCrimstone Block
Red Ice BlockRed Ice Block
Crimsand BlockCrimsand Block
Crimsandstone BlockCrimsandstone Block
Hardened Crimsand BlockHardened Crimsand Block
Crimson thorny bushesCrimson thorny bushes
Hallowed grassHallowed grass -1 point for each tile
Pearlstone BlockPearlstone Block
Pink Ice BlockPink Ice Block
Pearlsand BlockPearlsand Block
Pearlsandstone BlockPearlsandstone Block
Hardened Pearlsand BlockHardened Pearlsand Block
Short Hallowed Plants Short Hallowed Plants
Tall Hallowed Plants Tall Hallowed Plants
(Each plant only counts as one tile, despite their sprites are two tiles in height.)
SunflowerSunflower -40 points each[7]
  • Final calculation: Evil score = Corruption block score + Crimson block score – Hallowed block score – Sunflower score

If Evil score ≥ 50, then the house is invalid, and the message "This housing is corrupted." will be displayed, and if Evil score ≥ 300, the message "This is not valid housing." will be displayed instead. If an occupied house becomes Corrupted/Crimson, the NPC living there may move out and wander the area until a new house becomes available.

If Evil score < 50, calculate a Temporary score ( = 50 – Evil score). This score will be used in Home tile score calculations.

Home tile score

Then, start to check whether there is a valid "Home tile" in the range of the housing. A home tile is a tile which meets the following requirements:

(Use the purple block in the image as an example)

Home Tile

Example of areas to be checked.

  • Is a solid tile.
  • Not a platform or a Bubble.
  • Is not actuated.
  • The tiles to the left and right to it (blue blocks) must be solid, unactuated tiles.
  • There are no objects that block entities from passing (e.g. not actuated solid blocks, but platforms are allowed) in the 3×3 area directly above it (tiles in the green square).
  • There are no valid foreground blocks or solid tiles among the 3 tiles directly above it (yellow tiles in the green square), and these 3 tiles are all in the range of the housing.

If there is a tile that meets these requirements, calculate the "Home tile score" using the objects in the 5×4 area directly above it (red, white, yellow tiles), combined with the Temporary score (got from Evil score calculations):

  • All valid foreground tiles (blocks, furnitures, etc.) in the area, except the invalid tiles in the table below, will be checked.
    • The tiles in the middle column (the 1×4 area directly above the tile; yellow tiles) will not be used in the first calculation, they only participate in the second calculation (see below).
    • The remaining 16 tiles (red, white tiles) will participate the first calculation:
      • -20 points for each tile occupied by a closed Door or Tall Gate.
      • -20 points for each tile occupied by the hinge of an opened door (the tiles that a closed door occupies). Opened Tall Gates do not impact the score.
      • -5 points for each unactuated solid tile.
      • +5 points for each tile occupied by other objects.
  • List of invalid tiles
    Tall Grass SeedsTall Grass Seeds
    Magenta Flower SeedsMagenta Flower Seeds
    Pink Flower SeedsPink Flower Seeds
    MushroomMushroom
    Blue Flower SeedsBlue Flower Seeds
    Yellow Flower SeedsYellow Flower Seeds
    Violet Flower SeedsViolet Flower Seeds
    White Flower SeedsWhite Flower Seeds
    Red Flower SeedsRed Flower Seeds
    TorchTorch
    Blue TorchBlue Torch
    Red TorchRed Torch
    Green TorchGreen Torch
    Purple TorchPurple Torch
    White TorchWhite Torch
    Yellow TorchYellow Torch
    Demon TorchDemon Torch
    Cursed TorchCursed Torch
    Ice TorchIce Torch
    Orange TorchOrange Torch
    Ichor TorchIchor Torch
    Ultrabright TorchUltrabright Torch
    Bone TorchBone Torch
    Rainbow TorchRainbow Torch
    Pink TorchPink Torch
    Desert TorchDesert Torch
    Coral TorchCoral Torch
    Corrupt TorchCorrupt Torch
    Crimson TorchCrimson Torch
    Hallowed TorchHallowed Torch
    Jungle TorchJungle Torch
    Tall Grass Plants Tall Grass Plants
    DaybloomDaybloom (growing)
    MoonglowMoonglow (growing)
    BlinkrootBlinkroot (growing)
    DeathweedDeathweed (growing)
    WaterleafWaterleaf (growing)
    FireblossomFireblossom (growing)
    ShiverthornShiverthorn (growing)
    DaybloomDaybloom (grown)
    MoonglowMoonglow (grown)
    BlinkrootBlinkroot (grown)
    DeathweedDeathweed (grown)
    WaterleafWaterleaf (grown)
    FireblossomFireblossom (grown)
    ShiverthornShiverthorn (grown)
    DaybloomDaybloom (bloom)
    MoonglowMoonglow (bloom)
    BlinkrootBlinkroot (bloom)
    DeathweedDeathweed (bloom)
    WaterleafWaterleaf (bloom)
    FireblossomFireblossom (bloom)
    ShiverthornShiverthorn (bloom)
  • If the Home tile score ≤ 0, then the tile is invalid.

    If the Home tile score > 0, then continue to the second calculation:

    • If assigning a second NPC into the house, resulting in them sharing the house (a town NPC and a town pet), and the current tile is less than 3 tiles away from the existing NPC's home tile, then the score is set to 1.
    • If there are chests within the 5×4 area above (red, white, yellow tiles), then -30 points for each tile occupied by chests. If the score is below 1 after this calculation, set it to 1.
    • If there are valid tiles within the 1×4 area above (yellow tiles), then -15 points for each valid tile.
    • If the final score ≤ 0, then the tile is invalid.

    There has to be at least one valid home tile in a house to serve as the standing point of NPCs, otherwise the message "This is not valid housing." will be displayed. NPC Flag will hang directly above the standing point. If there are multiple valid home tiles, then the tile with highest score and being nearest to the top left corner of the house will be selected. [8]

    Truffle's valid housing

    The Truffle NPC has an extra requirement for his housing: it must have at least 100 tiles of Glowing Mushroom biome blocks in the area around it. This area is the same size as the area used for calculating the Evil score.

    Example size

    Npccell

    A miniature 3×10 house.

    A house must have at least 60 but fewer than 750 total tiles including the frame around it. Therefore, the dimensions of a House's outer frame must meet one of the following minimum requirements:

    Excluding ceiling, floor and walls Including ceiling, floor and walls
    3 tiles wide × 10 tiles high [9] 5 tiles wide × 12 tiles high
    4 tiles wide × 8 tiles high 6 tiles wide × 10 tiles high
    5 tiles wide × 7 tiles high 7 tiles wide × 9 tiles high
    6 tiles wide × 6 tiles high 8 tiles wide × 8 tiles high
    7 tiles wide × 5 tiles high 9 tiles wide × 7 tiles high
    8 tiles wide × 4 tiles high 10 tiles wide × 6 tiles high
    10 tiles wide × 3 tiles high 12 tiles wide × 5 tiles high
    13 tiles wide × 2 tiles high [10] 15 tiles wide × 4 tiles high

    Achievements

    Achievement No Hobo
    No Hobo • Build a house suitable enough for your first town NPC, such as the guide, to move into.
    Successfully get an NPC to move into your first House.
    Category: Explorer Explorer
    Achievement Real Estate Agent
    Real Estate Agent • Have all possible town NPCs living in your world.
    All town NPCs are housed in your world.
    Category: Challenger Challenger
    Achievement Home Sweet Home
    Home Sweet Home • “The Guide has moved into your house”
    Have the Guide move into a house.
    Achievement All in the Family
    All in the Family • “Every NPC has moved into your house”
    All town NPCs are housed in your world.

    Notes

    • Houses may be attached together and share common walls, floors, ceilings, and doors. What looks to the player like a multi-room house or apartment complex looks to the NPCs like a collection of independent houses.
    • Nearly any NPC house will qualify for a player to place and use a bed as their spawn point, so long as the tiles immediately above the bed are clear (see the Beds page for full details). The bed also counts as a comfort item.
    • If a House with an assigned NPC is destroyed or any of its requirements are invalidated, the NPC will wander the area until a valid House becomes available again. If killed, the NPC will respawn once a valid house is restored.
    • An NPC will not spawn within its House if that House is on the visible screen at the time, and may walk around the area outside instead. Quitting and restarting in single-player mode will place the NPC in its house. At night, NPCs will be automatically placed inside their Houses if the player travels several screens away, or if the player uses any Magic Mirror or the Teleporter.
    • The side, top, and bottom of the world will not count as walls.
    • If a Stone Wall has been converted into Pearlstone Wall, the House will become invalid as the converted wall is considered a natural wall.
    House (no empty wall)

    Two examples of houses with no empty wall. NPCs cannot move into these houses on their own, and must be assigned by a player.

    Tips

    Infinite NPC House

    An infinite house. It no longer works as of version 1.3.1, but it should still work for the Old-gen console version Old-gen console version and Nintendo 3DSNintendo 3DS version version.

    • In active Corruption or Crimson biomes, houses are usually invalid. This could make purchasing items with biome requirements (most notably for the Painter) harder. For these circumstances, one can use a King Statue or a Queen Statue to teleport the NPCs and purchase these items.
    • Actuators can be used with Blue, Brown, Gray, and Lihzahrd Pressure Plates to allow players entry but prevent enemies from entering or NPCs from leaving. Trap Doors can also be used, as neither enemies nor NPCs can open them. However, if an actuated wall is left open, it can make the house invalid until it is made solid again.
    • If absolutely necessary (e.g. on 3DSNintendo 3DS version, where there's no housing menu), players can force an NPC into a particular house by destroying all the others.
    • Hardmode natural walls, such as Pearlstone and Ebonstone walls, do not count as valid walls.
    • The "Infinite House" exploit will always work on the Old-gen console version Old-gen console version, due to the fact that these consoles will not receive further updates to Terraria.[12]
    • As long as the house meets the size criteria, it can be any shape, not just rectangles and squares (e.g. a dome shaped house would still be viable).
    • Houses are good places for players to indulge their creativity. It is entertaining to provide NPCs with decorated and themed homes, even if they would be satisfied with empty cells. The NPC happiness system implemented in 1.4 builds on this source of entertainment, by giving NPCs preferences for their house's location and proximity to houses of other NPCs. That said, NPC happiness is not affected by a house's appearance or decoration, leaving the player with a free hand.
    • It is a wise decision to build "spare" houses beyond the current number of NPCs:
      • Any new NPCs can move in as soon as they are spawned or found (perhaps unexpectedly).
      • Especially when entering Hardmode, some houses may be invalidated by Corruption or Crimson, having spares will help avoid NPCs being left homeless.
      • Having extras at each base will help with shuffling NPCs around to manage happiness, and/or make sure Pylons remain usable.
    • When building homes underground, Sticky Bombs or Scarab Bombs are a good choice, as they are accurate and break Background Walls for easier wall placement.

    Trivia

    • A house that has blocks within 5 tiles from the true edge of the world is considered invalid with the message "We need better text for this!!!"

    References

    1. Information taken from the PC version PC 1.4.2.3 source code, method StartRoomCheck() in Terraria.WorldGen. There may be inaccuracies, as the current PC version PC version is 1.4.4.9.
    2. There is a hidden area about 40 tiles in length out of the visible ingame world edge before reaching the true world edge, so this should not be triggered during normal gameplay.
    3. Information taken from the PC version PC 1.4.2.3 source code, method RoomNeeds() in Terraria.WorldGen. There may be inaccuracies, as the current PC version PC version is 1.4.4.9.
    4. Information taken from the PC version PC 1.4.2.3 source code, method ScoreRoom() in Terraria.WorldGen. There may be inaccuracies, as the current PC version PC version is 1.4.4.9.
    5. 5.0 5.1 The actual code is bugged here. The stats are divided by an extra 16, resulting in the actual area checked being far smaller than it supposed to be. Based on the stats in 1.4.2.3 codes, the extended distance should be 144 tiles horizontally in both directions, 101 tiles upwards and 104 tiles downwards vertically. This bug has made a housing will seldom become invalid due to being Corrupted.
    6. Note that this is possible during a normal gameplay, as the extended distance is farther than the distance between the visible world edge and the true world edge.
    7. Each tile counts as -5 points, while each Sunflower takes up 8 tiles.
    8. The game will check the tiles from top to bottom, and left to right. If detected a tile with higher score than any checked tiles, then it will be reserved as the home tile; if a tile’s score is lower than or equal to the previous score, then it will be skipped. So, when multiple tiles are tied with each other, the topmost and leftmost tile will be selected as the home tile.
    9. Only possible when using a Work Bench instead of a table.
    10. Only possible when using platforms as a ceiling. No longer possible on PC, Console, Mobile, Old Chinese, tModLoader, and tModLoader Legacy.
    11. Information taken from the PC version PC 1.4.2.3 source code, method TrySpawningTownNPC in Terraria.WorldGen.cs. There may be inaccuracies, as the current PC version PC version is 1.4.4.9.
    12. No further updates will be coming for old gen

    History

    • Desktop 1.3.5.3: Fixed an error when trying to use the room query on an unfit room in certain languages.
    • Desktop 1.3.5: NPCs who are manually assigned to a room will have their successor attempt to move in when the original is killed.
    • Desktop 1.2.4.1: Opening doors will once again cause a room to be unsuitable, but only if two doors are opened into the same room. (Depends on size of room)
    • Desktop 1.2: Fixed a bug that would cause a suitable house to be unsuitable.
    • Desktop 1.1: There is now a Housing Menu (a built-in interface) for checking if a house is valid for being moved into, and for assigning NPCs to specific houses.