What is the best way to protect NPCs during an invasion in Terraria?

Protecting NPCs during an invasion in Terraria is a critical task, as invasions like the Goblin Army, Pirate Invasion, or Martian Madness can overwhelm your town and lead to NPC deaths. To ensure their safety, you need to understand the mechanics of invasions, prepare your base, and use effective strategies to defend your NPCs. HereÔÇÖs a detailed guide to help you achieve this.

First, understand how invasions work. Invasions are triggered by specific conditions, such as breaking a Shadow Orb or Crimson Heart, meeting certain NPC requirements, or using items like the Goblin Battle Standard. Once triggered, waves of enemies will spawn and attack your base. NPCs are vulnerable during these events, as enemies can break down doors and attack them directly. To protect them, you need to create a secure environment and actively defend your town.

Start by building a fortified base. Your NPC housing should be elevated off the ground, at least 10-15 blocks high, to prevent ground-based enemies from reaching them. Use platforms or stairs for access, but remove them during invasions to block enemy movement. Surround your base with strong walls, such as stone or dungeon bricks, to prevent enemies from breaking in. Doors should be reinforced with blocks or traps to stop enemies from entering. You can also use actuators to create hidden entrances that only you can access.

Next, set up defensive structures. Traps like dart traps, spear traps, and flame traps can be placed around your base to automatically damage enemies. These traps can be activated with pressure plates or timers. Lava moats are another effective defense, as they deal continuous damage to enemies. However, ensure the lava layer is shallow to prevent item destruction. Additionally, place banners around your base to reduce damage from specific enemy types.

Combat preparation is essential. Equip yourself with powerful weapons and armor suitable for your class. For melee, use weapons like the Terra Blade or Solar Eruption. Rangers should have a Megashark or Tsunami with appropriate ammo. Mages can use the Razorblade Typhoon or Nebula Blaze, while summoners should rely on powerful minions like the Stardust Dragon. Accessories like the Ankh Shield, Wings, and Celestial Shell are highly recommended for survivability and mobility.

During the invasion, focus on crowd control. Use area-of-effect weapons and abilities to deal with large groups of enemies. Summoners can use sentries like the Ballista or Explosive Trap to provide additional firepower. Mages can cast spells like the Meteor Staff or Lunar Flare to clear waves quickly. Melee players should use weapons with wide swings or projectiles, while rangers can use piercing arrows or explosive bullets.

Resource management is crucial. Stock up on healing potions, mana potions, and buffs like Ironskin, Regeneration, and Swiftness. Crafting stations like the Alchemy Table can help you create these items efficiently. Additionally, keep a supply of ammunition, summoning items, and building materials for quick repairs or adjustments during the invasion.

Avoid common mistakes like leaving your base unprotected or underestimating enemy strength. Ensure your NPCs are housed in a central, secure location, and avoid spreading them out too much. Over-reliance on traps without active combat can also lead to failure, as some enemies may bypass your defenses. Always stay vigilant and adapt your strategy as needed.

Advanced techniques include using teleporters to create quick escape routes or strategic attack points. You can also build arenas with heart and star statues wired to timers for constant health and mana regeneration. For summoners, optimizing minion placement and using whips effectively can significantly increase damage output.

In specific scenarios, like the Martian Madness event, prioritize taking down the Saucer enemies first, as they deal massive damage. For the Pirate Invasion, focus on the Flying Dutchman and Parrots, as they can quickly overwhelm you. During the Goblin Army, target the Sorcerers and Archers, as they can deal ranged damage from a distance.

By following these strategies and preparing thoroughly, you can protect your NPCs during invasions and ensure your town remains safe. Proper base construction, combat readiness, and resource management are key to surviving these challenging events.