Editing Module:NpcData/docGive feedback
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
| Latest revision | Your text | ||
| Line 1: | Line 1: | ||
This module allows you to display stats for any NPC (Non-Player Character) from the game's data files | This module allows you to display stats for any NPC (Non-Player Character) from the game's data files. Using this module ensures that all stats are up-to-date and consistent across the wiki. | ||
== How to Use == | == How to Use == | ||
| Line 9: | Line 9: | ||
== Available Functions == | == Available Functions == | ||
=== Get a Single | === Get a Single Stat (`get_npc_var`) === | ||
This is the | This is the most common function. It gets a single number or piece of text for an NPC. | ||
'''Syntax''' | '''Syntax''' | ||
<code><nowiki>{{#invoke:NpcData|get_npc_var|NPC Name| | <code><nowiki>{{#invoke:NpcData|get_npc_var|NPC Name|Stat Name|Rounding}}</nowiki></code> | ||
'''Parameters''' | '''Parameters''' | ||
* '''NPC Name:''' The internal key for the NPC | * '''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. | |||
* '''Rounding:''' (Optional) A number to round the result to that many significant figures | |||
'''Examples''' | '''Examples''' | ||
* To get the | * To get the stomp damage of the Tier 2 Boss: | ||
** '''Code:''' <code><nowiki>{{#invoke:NpcData|get_npc_var| | ** '''Code:''' <code><nowiki>{{#invoke:NpcData|get_npc_var|npc_boss_tier2|StompDamage}}</nowiki></code> | ||
** '''Result:''' {{#invoke:NpcData|get_npc_var| | ** '''Result:''' {{#invoke:NpcData|get_npc_var|npc_boss_tier2|StompDamage}} | ||
* To get the | * To get the max health of a Medic Trooper: | ||
** '''Code:''' <code><nowiki>{{#invoke:NpcData|get_npc_var| | ** '''Code:''' <code><nowiki>{{#invoke:NpcData|get_npc_var|trooper_medic|MaxHealth}}</nowiki></code> | ||
** '''Result:''' {{#invoke:NpcData|get_npc_var| | ** '''Result:''' {{#invoke:NpcData|get_npc_var|trooper_medic|MaxHealth}} | ||
* | * If you misspell a stat, you will see an error: | ||
** '''Code:''' <code><nowiki>{{#invoke:NpcData|get_npc_var| | ** '''Code:''' <code><nowiki>{{#invoke:NpcData|get_npc_var|trooper_medic|MaxHeath}}</nowiki></code> <!-- Note the typo --> | ||
** '''Result:''' {{#invoke:NpcData|get_npc_var| | ** '''Result:''' {{#invoke:NpcData|get_npc_var|trooper_medic|MaxHeath}} | ||
* | ---- | ||
** '''Code:''' <code><nowiki>{{#invoke:NpcData| | === Get an Item from a List (`get_list_elem`) === | ||
** '''Result:''' < | Some NPCs have data stored in lists (or arrays). This function lets you get a single item from a list by its position. | ||
'''Syntax''' | |||
<code><nowiki>{{#invoke:NpcData|get_list_elem|NPC Name|List Name|Position Number}}</nowiki></code> | |||
'''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:''' <code><nowiki>{{#invoke:NpcData|get_list_elem|npc_boss_tier2|NearbyEnemyResistanceValues|4}}</nowiki></code> | |||
** '''Result:''' {{#invoke:NpcData|get_list_elem|npc_boss_tier2|NearbyEnemyResistanceValues|4}} | |||
---- | |||
=== Get an Ability Name (`get_ability_key`) === | |||
Use this to find the name of an ability in a specific slot for an NPC. | |||
'''Syntax''' | |||
<code><nowiki>{{#invoke:NpcData|get_ability_key|NPC Name|Slot Name}}</nowiki></code> | |||
'''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:''' <code><nowiki>{{#invoke:NpcData|get_ability_key|npc_boss_tier2|ESlot_Signature_3}}</nowiki></code> | |||
** '''Result:''' {{#invoke:NpcData|get_ability_key|npc_boss_tier2|ESlot_Signature_3}} | |||
<includeonly> | |||
</includeonly> | |||