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
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
Get a Single Stat (`get_npc_var`)
This is the most common function. It gets a single number or piece of text for an NPC.
Syntax
{{#invoke:NpcData|get_npc_var|NPC Name|Stat Name|Rounding}}
Parameters
- NPC Name: The internal key for the NPC. For example, `npc_boss_tier2` or `trooper_medic`.
- Stat Name: The name of the stat you want to look up. For example, `MaxHealth` or `StompDamage`.
- Rounding: (Optional) A number to round the result to that many significant figures.
Examples
- To get the stomp damage of the Tier 2 Boss:
- Code:
{{#invoke:NpcData|get_npc_var|npc_boss_tier2|StompDamage}} - Result: 350
- Code:
- To get the max health of a Medic Trooper:
- Code:
{{#invoke:NpcData|get_npc_var|trooper_medic|MaxHealth}} - Result: 350
- Code:
- If you misspell a stat, you will see an error:
- Code:
{{#invoke:NpcData|get_npc_var|trooper_medic|MaxHeath}} - Result: Error: Key "MaxHeath" not found in path "trooper_medic".
- Code:
Get an Item from a List (`get_list_elem`)
Some NPCs have data stored in lists (or arrays). This function lets you get a single item from a list by its position.
Syntax
{{#invoke:NpcData|get_list_elem|NPC Name|List Name|Position Number}}
Parameters
- NPC Name: The internal key for the NPC.
- List Name: The name of the list property, e.g., `NearbyEnemyResistanceValues`.
- Position Number: The position in the list. The first item is `1`, the second is `2`, and so on.
Example
- The Tier 2 Boss has a list of resistance values. To get the 4th value in that list:
- Code:
{{#invoke:NpcData|get_list_elem|npc_boss_tier2|NearbyEnemyResistanceValues|4}} - Result: Script error: The function "get_list_elem" does not exist.
- Code:
Get an Ability Name (`get_ability_key`)
Use this to find the name of an ability in a specific slot for an NPC.
Syntax
{{#invoke:NpcData|get_ability_key|NPC Name|Slot Name}}
Parameters
- NPC Name: The internal key for the NPC.
- Slot Name: The ability slot. Common examples are `ESlot_Weapon_Primary` or `ESlot_Signature_1`.
Example
- To get the name of the Tier 2 Boss's third signature ability:
- Code:
{{#invoke:NpcData|get_ability_key|npc_boss_tier2|ESlot_Signature_3}} - Result: Script error: The function "get_ability_key" does not exist.
- Code: