Owl.png Wiki reading hard on the eyes? Try out our Dark Theme! Visit the preferences page while logged in and select Hydra Dark. Owl.png

Module:Npcinfo/doc

From Terraria Wiki
Jump to: navigation, search

Lua logo.svgThis is the documentation page for Module:Npcinfo.


This module is used to obtain the base statistics of each NPC.

It can calculate NPC stats for different stages/modes of the game (normal / expert pre-Hardmode / expert Hardmode / expert post-Plantera / master pre-Hardmode / master Hardmode / master post-Plantera ).

The code is synchronized with version 1.4.0.4Desktop Version of Terraria.

Usage[edit source]

{{#invoke:Npcinfo|getInfo| id = <npcid> | prefix = <prefix for output varnames> }}

id

NPC id. Can be -1 to -65, 1 to 662. (76/146/408 are unused)

(optional) players

The number of active players, default is 1. For some bosses and boss-like NPCs in Expert mode, the number of players determines the health.

(optional) prefix

The prefix for the output variable. Default is _npcinfo_. For example, the default variable name for damage is _npcinfo_damage. If you used prefix=my_, the variable name would be my_damage.

When you use this module, it sets a number of DPL variables you can retrieve by using {{#dplvar:_npcinfo_defense}}, for instance. Use {{getNpcInfo}} for easily retrieving these variables and using them in articles.

Main variables:

dplvar
(without prefix)
Content
aiStyle The id of the AI it uses.
banner The item id of the enemy banner this enemy drops. 0 means no banner for this enemy.
boss <empty> = false, 1 = true.
buffImmuneAll Is it immune to all buffs? <empty> = false, 1 = true.
buffImmune A comma-separated list of buffs the NPC is immune to. Only makes sense when buffImmuneAll is false.
friendly Is it a friendly NPC? <empty> = false, 1 = true.
townNPC Is it a town NPC? <empty> = false, 1 = true.
townCritter Is it a town Critter?(by source code, NPCID.Sets.TownCritter) <empty> = false, 1 = true.
critter Is it a critter? (by Critter page.)<empty> = false, 1 = true.
projectileNPC Is it a projectile? <empty> = false, 1 = true.
playersCount The value of the players parameter you used.
netID NPC id, the value of the id parameter you used.
type NPC type id. For a positive NPC id, it is equal to netID. For a negative NPC id, it is the id of the corresponding "master" variant.
internalName NPC internal name.
HitSound File name (without file extension, but it is usually .wav) of the sound effect that is played when this NPC takes damage (or reflects a projectile). Note that the listed sound is only the base sound; it might be played with modified pitch and volume in-game.
DeathSound File name (without file extension, but it is usually .wav) of the sound effect that is played when this NPC dies. Note that the listed sound is only the base sound; it might be played with modified pitch and volume in-game.
damage
damage_e
damage_e_hm
damage_e_pp
damage_m
damage_m_hm
damage_m_pp
damage / defense / knockBack / lifeMax values for normal, expert pre-Hardmode, expert Hardmode, expert post-Plantera, master pre-Hardmode, master Hardmode, and master post-Plantera, respectively.
The knockBackResist values are original value, the value displayed in the NPC infobox is (1 - knockBackResist).
defense
defense_e
defense_e_hm
defense_e_pp
defense_m
defense_m_hm
defense_m_pp
knockBackResist
knockBackResist_e
knockBackResist_e_hm
knockBackResist_e_pp
knockBackResist_m
knockBackResist_m_hm
knockBackResist_m_pp
lifeMax
lifeMax_e
lifeMax_e_hm
lifeMax_e_pp
lifeMax_m
lifeMax_m_hm
lifeMax_m_pp
value
value_e
value_e_hm
value_e_pp
value_m
value_m_hm
value_m_pp
Coins dropped for normal, expert pre-Hardmode, expert Hardmode, and expert post-Plantera, respectively. Counted in Copper Coins.

Examples[edit source]

See the source code of this documentation for details.

id= -3 (Green Slime):

aiStyle: 1
boss:
buffImmune: 70, 20
buffImmuneAll:
damage: 6
damage_e: 112
damage_e_hm: 112
damage_e_pp: 112
DeathSound: NPC_Killed_1
defense: 0
defense_e: 0
defense_e_hm: 0
defense_e_pp: 0
dontCountMe:
friendly:
HitSound: NPC_Hit_1
knockBackResist: 1.2
knockBackResist_e: 1.08
knockBackResist_e_hm: 1.08
knockBackResist_e_pp: 1.08
lifeMax: 14
lifeMax_e: 324
lifeMax_e_hm: 324
lifeMax_e_pp: 324
internalName: GreenSlime
netID: -3
npcSlots: 1
playersCount:
rarity: 0
scale: 0.9
townNPC:
townCritter:
type: 1
value: 3
value_e: 62
value_e_hm: 62
value_e_pp: 62

id=4 (Eye of Cthulhu):

aiStyle: 4
boss: 1
buffImmune: 31
buffImmuneAll:
damage: 15
damage_e: 30
damage_e_hm: 30
damage_e_pp: 30
DeathSound: NPC_Killed_1
defense: 12
defense_e: 12
defense_e_hm: 12
defense_e_pp: 12
dontCountMe:
friendly:
HitSound: NPC_Hit_1
knockBackResist: 0
knockBackResist_e: 0
knockBackResist_e_hm: 0
knockBackResist_e_pp: 0
lifeMax: 2800
lifeMax_e: 3640
lifeMax_e_hm: 3640
lifeMax_e_pp: 3640
internalName: EyeofCthulhu
netID: 4
npcSlots: 5
playersCount:
rarity: 0
scale: 1
townNPC:
townCritter:
type: 4
value: 30000
value_e: 75000
value_e_hm: 75000
value_e_pp: 75000

id=54 (Clothier, NPC):

aiStyle: 7
boss:
buffImmune: 31
buffImmuneAll:
damage: 10
damage_e: 10
damage_e_hm: 10
damage_e_pp: 10
DeathSound: NPC_Killed_1
defense: 15
defense_e: 15
defense_e_hm: 15
defense_e_pp: 15
dontCountMe:
friendly: 1
HitSound: NPC_Hit_1
knockBackResist: 0.5
knockBackResist_e: 0.5
knockBackResist_e_hm: 0.5
knockBackResist_e_pp: 0.5
lifeMax: 250
lifeMax_e: 250
lifeMax_e_hm: 250
lifeMax_e_pp: 250
internalName: Clothier
netID: 54
npcSlots: 1
playersCount:
rarity: 0
scale: 1
townNPC: 1
townCritter:
type: 54
value: 0
value_e: 0
value_e_hm: 0
value_e_pp: 0