Module:NpcData/docGive feedback
This is the documentation page for Module:NpcData
This module allows you to display stats for any NPC (Non-Player Character) from the game's data files which can be found here Data:NpcData.json. For most uses, it is recommended to use the {{NpcData}} template.
How to Use
[edit source]To get data from the module, you use a command that looks like {{#invoke:NpcData|...}}. You will tell it which function to use, which NPC you want, and what information you need.
The basic format is:
{{#invoke:NpcData|function_name|parameter1|parameter2|...}}
Available Functions
[edit source]Get a Single or Nested Stat (`get_npc_var`)
[edit source]This is the primary function for retrieving NPC data. It can get a simple top-level stat or traverse deeply into nested objects and arrays (up to 6 levels deep via the template).
Syntax
{{#invoke:NpcData|get_npc_var|NPC Name|Key 1|Key 2|...|Rounding}}
Parameters
- NPC Name: The internal key for the NPC (e.g., `npc_boss_tier2`, `trooper_normal`).
- Key 1, Key 2, ...: The path to the stat you want.
- For a simple stat, this is one key (e.g., `MaxHealth`).
- For nested data, provide each key in order (e.g., `RebirthModifier`, `RespawnDelay`).
- For arrays (lists), use the position number as a key (e.g., `IntrinsicModifiers`, `1`, `BULLET_ARMOR_DAMAGE_RESIST`).
- Rounding: (Optional) A number to round the result to that many significant figures. This should always be the last parameter.
Examples
- To get the max health of a Normal Trooper:
- Code:
{{#invoke:NpcData|get_npc_var|trooper_normal|MaxHealth}} - Result: 300
- Code:
- To get the name of a Walker's second ability (nested in BoundAbilities):
- Code:
{{#invoke:NpcData|get_npc_var|npc_boss_tier2|BoundAbilities|ESlot_Signature_2|Name}} - Result: Laser
- Code:
- To get a value from a list of modifiers (nested array):
- Code:
{{#invoke:NpcData|get_npc_var|npc_boss_tier2|IntrinsicModifiers|1|BULLET_ARMOR_DAMAGE_RESIST}} - Result: 35
- Code:
- If a path is incorrect, an error message will show the full path attempted:
- Code:
{{#invoke:NpcData|get_npc_var|trooper_normal|InvalidKey|Stat}} - Result: Error: Key "InvalidKey" not found in path "trooper_normal".
- Code: