Module:Npcinfo/doc
This is the documentation page for Module:Npcinfo.
This module is used to obtain the base statistics of an NPC. It should only be used in templates and the like; use {{getNpcInfo}} in article text.
It can calculate NPC stats for different stages/modes of the game (Classic / Expert pre-Hardmode / Expert Hardmode / Expert post-Plantera / Master pre-Hardmode / Master Hardmode / Master post-Plantera).
The code is synchronized with version 1.4.4.9(Desktop version) of Terraria.
Usage
{{#invoke:Npcinfo | getInfo | id = <npcid> | prefix = <prefix for variables> (optional) }}
- id
NPC ID. Can be -1 to -65 or 1 to 687. (76/146/408/547 are unused)
- prefix
The prefix for the output variables. Default is _npcinfo_
. For example, the default variable name for damage is _npcinfo_damage
. If
was set to $prefix
my_
, the variable name would be my_damage
.
Statistics
Invoking this module sets a number of DPL variables, one for each stat. They can be retrieved via {{#dplvar:<prefix><stat>}}
, e.g. {{#dplvar:_npcinfo_defense}}
for the defense stat with the default
. The following table contains the most important stats:
$prefix
dplvar (without prefix) |
Content |
---|---|
aiStyle | The ID of the AI that the NPC uses. |
banner | The item ID of the enemy banner that the NPC drops. |
boss | The internal flag that determines whether the NPC is considered a boss. (<empty> = false , 1 = true )
|
buffImmune | A comma-separated list of de-/buffs the NPC is immune to. |
buffImmuneAll | Whether the NPC is immune to all de-/buffs. (<empty> = false , 1 = true )
|
buffImmuneAllNotWhips | Whether the NPC is immune to all de-/buffs, except whip debuffs. (<empty> = false , 1 = true )
|
coldDamage | Whether the NPC is affected by the Warmth buff. (<empty> = false , 1 = true )
|
friendly | Whether the NPC is a friendly NPC (e.g. a town NPC or critter). (<empty> = false , 1 = true )
|
housingCategory | if the NPC is a town pet, otherwise.
|
internalName | Internal name of the NPC. |
lavaImmune | Whether the NPC takes damage from lava. (<empty> = false , 1 = true )
|
netID | ID of the NPC, the value of the parameter.
|
noGravity | Whether the NPC is unaffected by gravity. (<empty> = false , 1 = true )
|
noTileCollide | Whether the NPC can move freely through tiles. (<empty> = false , 1 = true )
|
npcSlots | Number of NPC slots that the NPC occupies. See NPC spawning for explanation. |
rarity | Rarity level of the NPC for the Lifeform Analyzer. |
townNPC | Whether the NPC is a town NPC. (<empty> = false , 1 = true )
|
trapImmune | Whether the NPC is completely unaffected by all traps. (<empty> = false , 1 = true )
|
type | "Type ID" of the NPC. For a positive NPC ID, it is equal to . For a negative NPC ID, it is the ID of the corresponding "master" variant (e.g. 1 (Blue Slime) for -3 (Green Slime)).
|
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 resistance, and maximum health values for Classic, Expert pre-Hardmode, Expert Hardmode, Expert post-Plantera, Master pre-Hardmode, Master Hardmode, and Master post-Plantera, respectively. The values are the original values as in the source code, the value displayed in {{npc infobox}}es on the wiki is .
|
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 Classic, Expert pre-Hardmode, Expert Hardmode, and Expert post-Plantera, respectively. Counted in Copper Coins. |
In addition, a variable named
is set. It contains the names of all available statistics.
_fields
Examples
Stat{{#dplvar:_<variable name>}} | Result{{#invoke:Npcinfo|getInfo|id=<id>|prefix=_}} | ||
---|---|---|---|
Green Slimeid = -3 | Eye of Cthulhuid = 4 | Clothierid = 54 | |
| 1 | 4 | 7 |
| 175 | 0 | 0 |
| 2928 | 0 | 0 |
| |||
| 1 | ||
| 20 | 31 | 31 |
| |||
| |||
| 0 | 0 | 0 |
| |||
| 6 | 15 | 10 |
| 12 | 30 | 10 |
| 86 | 30 | 10 |
| 118 | 30 | 10 |
| 18 | 45 | 10 |
| 129 | 45 | 10 |
| 177 | 45 | 10 |
| NPC_Killed_1 | NPC_Killed_1 | NPC_Killed_1 |
| 0 | 12 | 15 |
| 0 | 12 | 15 |
| 0 | 12 | 15 |
| 0 | 12 | 15 |
| 0 | 12 | 15 |
| 0 | 12 | 15 |
| 0 | 12 | 15 |
| |||
| |||
| 1 | ||
| 17 | 110 | 40 |
| NPC_Hit_1 | NPC_Hit_1 | NPC_Hit_1 |
| 0 | 0 | 0 |
| GreenSlime | EyeofCthulhu | Clothier |
| 1.2 | 0 | 0.5 |
| 1.08 | 0 | 0.5 |
| 1.08 | 0 | 0.5 |
| 1.08 | 0 | 0.5 |
| 0.96 | 0 | 0.5 |
| 0.96 | 0 | 0.5 |
| 0.96 | 0 | 0.5 |
| |||
| 14 | 2800 | 250 |
| 28 | 3640 | 250 |
| 246 | 3640 | 250 |
| 338 | 3640 | 250 |
| 42 | 4641 | 250 |
| 369 | 4641 | 250 |
| 507 | 4641 | 250 |
| Green Slime | Eye of Cthulhu | Clothier |
| |||
| -3 | 4 | 54 |
| 1 | ||
| 1 | ||
| 1 | 5 | 1 |
| |||
| 0 | 0 | 0 |
| 0.9 | 1 | 1 |
| 750 | 22500 | 750 |
| 1 | ||
| |||
| 1 | 4 | 54 |
| 3 | 30000 | 0 |
| 7 | 75000 | 0 |
| 47 | 75000 | 0 |
| 65 | 75000 | 0 |
| 7 | 75000 | 0 |
| 47 | 75000 | 0 |
| 65 | 75000 | 0 |
| 21 | 100 | 18 |