From Terraria Wiki
Jump to navigation Jump to search
Note: In the Terraria Wiki, the term "NPCs" generally refers to Town NPCs; however, for the purpose of this article, it also encompasses enemies and critters.

AI (artificial intelligence) is the behavioral pattern exhibited by an NPC. For instance, the Caster AI will always warp, shoot three times, pause for three seconds, and then warp again. Knowing the AI an enemy uses can provide an advantage in combat, as it offers an idea of how the enemy will attack and react in given scenarios.

In addition, additional AI is added for certain NPCs, such as the non-aggressive mode of surface slimes, the Eater of Souls' circling around the player, the Wandering Eye's acceleration, or the ranged attack of some Fighter AI enemies.

AIs are not given names in the game code, so they are given names here to assist in identifying them across the wiki. Most AI names are given based on observed behavior (such as Flying AI), NPC groups (such as Slime AI), or the first NPC to implement the AI (such as Demon Eye AI).

There are 125 different AI types:

ID Name Description NPCs
0 No AI Doesn't move.
1 Slime AI Hops in one direction, slides on slopes, floats in water, follows player if damaged or it's nighttime. Grasshoppers, on the other hand, flees from nearby players.
2 Demon Eye AI Flies, follows player, bounces off walls in an arc.
3 Fighter AI Will walk, jump over holes, follow player. It will try to line up vertically first. If it fails to reach its target, it will back up a bit, then re-attempt. It is the most common AI in Terraria.
  • 4 Eye of Cthulhu AI Alternates between trying to stay above the player and summoning Servants of Cthulhu, and charging at the player occasionally. Spins when at low health, and begins exclusively charging at the player. Always looks at player.
    5 Flying AI Flies, looks at player, follows player.
    6 Worm AI Burrows in ground (and/or air), passes through blocks, follows player. Truffle Worm instead flees from players.
    7 Passive AI Walks semi-randomly, jumps over holes.
    As of the 1.3 update, all Town NPCs talk to each other and the player, and each Town NPC has a different weapon to defend themselves when an enemy is nearby.
  • 8 Caster AI Casts spells at player, stays stationary, warps after three casts, warps if falling. It stops casting spells if damaged, then warps if left alone.
    9 Spell AI Travels in a direct line towards player, going through blocks. Used by casters.
    10 Cursed Skull AI Tries to drift towards or around player, often stays a little bit out of reach once having touched the player.
    11 Head AI Tries to stay above player, spins and moves towards player occasionally, enrages during the daytime.
    12 Skeletron Hand AI Follows the Skeletron head, flails, waves, and attempts to damage player.
    13 Plant AI Extends on a vine towards player, looks at player. Dies if not rooted to a block.
    14 Bat AI Spasmodically flies towards player.
    15 King Slime AI Hops towards the player and releases Blue Slimes when damaged. Teleports to the player when the player is out of reach; releases Spiked Slimes when damaged in Expert Mode.
    16 Swimming AI Swims back and forth and moves towards the player if they are in water, except for Goldfish, Gold Goldfish and Pupfish.
    17 Vulture AI Stands still until player gets within five blocks of AI or it is damaged. AI then acts similarly to the Flying AI.
    18 Jellyfish AI Floats back and forth, swims towards player in small bursts if player is in water.
    19 Antlion AI Looks at player, climbs overlapping blocks, shoots falling sand at nearby players.
    20 Spike Ball AI Swings in a circle from a pivot point on a chain.
    21 Blazing Wheel AI Moves along walls, floors and closed doors.
    22 Hovering AI Similar to the Fighter AI, floats over the ground instead of jumping.
    23 Flying Weapon AI Doesn't adhere to gravity or tile collisions. Spins several times, then heads straight towards the player. Any damage cancels its attack and forces it to spin again.
    24 Bird AI Stands still until player gets nearby, then flies away. Avoids walls and obstacles and changes direction if one is in the way.
    25 Mimic AI Stands still until player approaches or attacks, then leaps towards them with varying heights.
    26 Unicorn AI Slowly gains speed while moving, jumps over obstacles.
    27 Wall of Flesh AI Wall of Flesh Mouth with Wall image attached. Traverses the world horizontally. Also spawns with two Wall of Flesh Eyes which share its health.
    28 Wall of Flesh Eye AI Bound to an entity, watches player, and shoots projectiles. The more damaged it is, the more it shoots.
    29 The Hungry AI Similar to the Plant AI, but attached to an entity.
    30 Retinazer AI Alternates between attempting to stay diagonally above player while shooting projectiles slowly, and attempting to stay beside player and shooting projectiles very rapidly.
    31 Spazmatism AI Alternates between shooting projectiles and staying beside player, and charging toward player.
    32 Skeletron Prime Head AI Same as Head AI.
    33 Prime Saw AI Occasionally charges at the player, heads directly towards player when enraged.
    34 Prime Vice AI Occasionally charges at the player, rapidly charges when enraged.
    35 Prime Cannon AI Fires bombs upwards, aims directly at player when enraged.
    36 Prime Laser AI Fires projectiles at player, shoots very rapidly when enraged.
    37 The Destroyer AI Similar to Worm AI except it will shoot projectiles from the body and tail and is unable to "fly" in air. It will also release Probes.
    38 Snowman AI Jumps and runs towards the player, similar to Fighter AI.
    39 Tortoise AI Crawls a bit, then leaps towards player. Will indefinitely leap towards the player in water.
    40 Spider AI Capable of climbing background walls as well as through platforms. Used only when crawling on a wall. Without a wall listed enemies seamlessly transform into their walking variants, which use Fighter AI.
    41 Herpling AI Jumps high and attempts to land on the player. It can strafe to the sides in midair.
    42 Lost Girl AI Turns into a Nymph when taking damage, when being caused to move, or when a player comes too close.
    43 Queen Bee AI Alternates between attempting to stay above player while firing projectiles downwards or spawning bees, and charging back and forth very rapidly.
    44 Flying Fish AI Flies straight towards player.
    45 Golem Body AI Jumps towards player every few seconds, shoots lasers.
    46 Golem Head AI Bound to an entity.
    47 Golem Fist AI Flies towards player, returns when hit.
    48 Free Golem Head AI Attempts to fly back and forth, shoots projectiles at player.
    49 Angry Nimbus AI Attempts to stay directly above the player, and fires projectiles downwards.
    50 Spore AI Drifts downwards while following player, destroyed on contact.
    51 Plantera AI Clings to nearby blocks, chases player, fires projectiles and spiky balls that bounce around.
    52 Plantera's Hook AI Moves forward briefly before latching onto a block.
    53 Plantera's Tentacle AI Acts very similar to the Plant AI, only bound to a certain entity.
    54 Brain of Cthulhu AI Doesn't adhere to gravity or tile collisions, and teleports occasionally in first form. Once all Creepers are killed, it will begin rapidly teleporting and moving towards the player.
    55 Creeper AI Circles around an entity, charging at player.
    56 Dungeon Spirit AI Moves directly towards player, gaining momentum. Emits blue-ish particles.
    57 Mourning Wood AI Moves towards player, stops, and fires projectiles straight at the player.
    58 Pumpking AI Very similar to the Head AI. Spawns with two Pumpking Scythes.
    59 Pumpking Scythe AI Very similar to the Skeletron Hand AI.
    60 Ice Queen AI Flies around, shooting a barrage of ice-based projectiles.
    61 Santa-NK1 AI Moves across the ground, stops moving, and launches many different types of projectiles.
    62 Elf Copter AI Attempts to fly around the player, shooting bullets rapidly if they are in sight.
    63 Flocko AI Flies towards the player at high speed.
    64 Firefly AI Flies slowly in any direction and occasionally glows.
    65 Butterfly AI Flies slowly in any direction.
    66 Passive Worm AI Moves along the ground, pause for a bit, then continue moving. Will avoid walls and moves in the other direction if it has hit one.
    67 Snail AI Acts similarly to the Passive Worm AI, but climbs up walls instead of moving away.
    68 Duck AI Swims on water and walks on land. Will fly away when a player is nearby, but only while swimming. Lands after flying for a while.
    69 Duke Fishron AI Rams player multiple times before summoning entities. In second form, it flies in circles and summons entities.
    70 Detonating Bubble AI Flies through the air, chases player, and disappears after a period of time. Explodes and deals damage if it succeeds in reaching player.
    71 Sharkron AI Follows an arcing path, dies when it touches a wall or player.
    72 Bubble Shield AI Created by the Martian Officer, absorbs all damage dealt to the officer.
    73 Tesla Turret AI Built by Martian Engineers on the ground.
    74 Corite AI Travels through blocks, charges at the player.
    75 Rider AI Has a Rider and a corresponding mount, if one is destroyed the other keeps attacking.
    76 Martian Saucer AI Flies around the player, fires a Death Ray straight down, can only be damaged if all four turrets have been destroyed.
    77 Moon Lord Core AI Positions behind the player, invulnerable until the Moon Lord's head and hands are defeated.
    78 Moon Lord Hand AI Flees to the left and right of the player, opens and closes, fires Phantasmal Spheres, Phantasmal Eyes, and Phantasmal Bolts. Spawns True Eye of Cthulhu when health is depleted.
    79 Moon Lord Head AI Flies above the player, shoots a Phantasmal Deathray and then some Phantasmal Bolts, spawns True Eye of Cthulhu when defeated.
    80 Martian Probe AI Floats at a constant height, turns red and files away if the player gets near it, triggers the Martian Madness event if it gets off screen.
    81 True Eye of Cthulhu AI Flies around the Moon Lord, shoots Phantasmal Sphere, Phantasmal Deathray, Phantasmal Eye and Phantasmal Bolts at the player.
    82 Moon Leech Clot AI Travels from the player to the Moon Lord's head, heals part of the Moon Lord for 1000 HP if it reaches the mouth.
    83 Lunatic Devotee AI Never moves, causes the Lunatic Cultist to spawn when all are killed.
    84 Lunatic Cultist AI Teleports around the player, fires shadow fireballs, ice mist, fireballs and lighting orbs. Creates duplicates of itself and summons Phantasm Dragons and Ancient Visions, triggers Lunar events when defeated.
    85 Star Cell/Brain Suckler AI Flies around the player, slowly floats towards them. Usually sticks to the player.
    86 Ancient Vision AI Flies around the player, does not adhere to gravity or tile collisions.
    87 Biome Mimic AI Passive until approached by the player. Attacks by jumping, dashing rapidly, and jumping into the air and slamming down on the player, ignoring block collision. Periodically "shuts" and becomes immune to damage and reflects projectiles in Expert Mode.
    88 Mothron AI Flies through blocks, lunges at the player, occasionally lays a Mothron Egg.
    89 Mothron Egg AI Doesn't move, spawns Baby Mothrons after a while.
    90 Baby Mothron AI Spawns from Mothron Eggs, flies, lunges at the player.
    91 Granite Elemental AI Floats towards the player. Drops to the ground when hurt in Expert mode.
    92 Target Dummy AI Stationary, recoils when damaged.
    93 Flying Dutchman AI Floats about the player, is defeated when all 4 cannons are destroyed.
    94 Celestial Pillar AI Bobs up and down in place, can only be damaged when 100 of its event enemies are defeated. Triggers Moon Lord to spawn when all 4 are defeated.
    95 Mini Star Cell AI Remains stationary, eventually grows into a full sized Star Cell.
    96 Flow Invader AI Floats around the player, summons 3 orbiting minions, fires projectiles at the player.
    97 Nebula Floater AI Floats around the player, summons 3 orbiting minions, charges at the player and fires laser while teleporting.
    98 Unknown If the player is far, rolls quickly towards it, else approaches slowly before shooting Solar Flares. n/a
    99 Solar Fragment AI Spawned from the top of the Solar Pillar. Shot upward on spawn and gradually falls down to the ground, destroyed on contact with blocks or the player.
    100 Ancient Light AI Fired in spreads of five by the Lunatic Cultist.
    101 Ancient Doom AI Spawned from Lunatic Cultist in Expert Mode, fires 4 projectiles in a "+" shape when defeated/summoned.
    102 Sand Elemental AI Floats around, moving towards the player, and occasionally spawns three 'sandnados'. Gets faster the more it is damaged.
    103 Sand Shark AI Hides under sand (and its variants), occasionally dashes at the player.
    104 Unknown An NPC with this AI immediately despawns. Unimplemented NPC (547)
    105 Eternia Crystal AI Stays still, targeted by Old One's Army monsters, ends the Old One's Army event if health reaches 0.
    106 Mysterious Portal AI Spawns Etherian enemies.
    107 Attacker AI Moves towards the Eternia Crystal to attack it, and floats through blocks if it can't reach the crystal.
    108 Flying Attacker AI Flies above the Eternia Crystal, pauses, and then dives for it. The cycle then repeats.
    109 Dark Mage AI Slowly moves towards the Eternia Crystal. Occasionally summons multiple Old One's Skeletons around it and heals enemies.
    110 Betsy AI AI behaves similarly to the Duke Fishron AI. Shoots fireballs and rarely sweeps over the crystal with Flame Breath.
    111 Etherian Lightning Bug AI AI behaves similarly to the Hovering AI. Shoots lightning below it repeatedly.
    112 Fairy AI Moves towards the player, floats around them if no treasure is nearby, moves towards nearby treasure if detected, then waits for the player to go near it, despawns when on top of treasure.
    113 Windy Balloon AI Spawns attached to an entity, floats up and down along with attached entity, rapidly flies up if attached entity dies, dies if it hits a block.
    114 Dragonfly AI Flies in bursts in random directions, flies away at fast speeds if a player approaches.
    115 Ladybug AI Alternates between flying slowly in any direction and walking back and forth on the ground.
    116 Water Strider AI Glides on water and hops on land.
    117 Dreadnautilus AI Cycles between firing blood projectiles at the player, charging and spinning around the player, and summoning Blood Squids.
    118 Seahorse AI Swims in bursts in random directions.
    119 Angry Dandelion AI Doesn't move, shoots projectiles at nearby players, but only in the wind’s direction.
    120 Empress of Light AI Hovers slightly above the player, cycles between several projectile attacks and charging the player. Disappears and reappears at half health, and starts cycling through attacks faster. Enrages during the daytime.
    121 Queen Slime AI Cycles between performing hops, leaping towards the player to pound them, and firing Regal Gel. Grows wings at half health, and begins flying towards the player's position, firing Regal Gel and attempting to pound the player when above them. Spawns Crystal Slimes, Heavenly Slimes, and Bouncy Slimes when damaged.
    122 Pirate's Curse AI Floats towards the player, passes through blocks.
    123 Deerclops AI Walks towards the player, jumping over gaps, summons ice spikes if the player is close to it, flings debris if otherwise, and roars occasionally. Will not despawn if the player dies until 1 in-game day passes. Periodically summons Shadow Hands in Expert Mode.
    124 DeerclopsLeg AI Was previously used by the unused DeerclopsLeg NPC. Would despawn instantly unless tied to an active Deerclops, where it would snap to the Deerclops' feet and bob up and down while moving. The AI code remains in the game despite the NPC having been removed. n/a
    124 Old Shaking Chest AI Dummy, unused; the Old Shaking Chest uses Slime AI. n/a
    125 Clumsy Balloon Slime AI Similar to Windy Balloon AI.
    n/a Lepus AI Jumps similarly to King Slime, generates entities while on the ground.
    n/a Ocram AI Flies around, spawns minions, shoots lasers, and charges at the player.
    n/a Turkor the Ungrateful AI Body does not move; heads lunge at the player. Occasionally spawns more heads.