Editing Template: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 template | This template is a shortcut for [[Module:NpcData]] to make it easier to display NPC stats on a page. | ||
It can be used to get a single stat (including nested ones) or an item from a list of stats. | |||
== How to Use == | |||
== | === Getting a Single or Nested Stat === | ||
This is the most common use. Provide the information in the following order. For nested stats, simply add more parameters for each level of nesting. | |||
'''Syntax''' | |||
<code><nowiki>{{NpcData|NPC Name|Key 1|Key 2|...|Rounding}}</nowiki></code> | |||
'''Parameters''' | |||
* '''First parameter (NPC Name):''' The internal key for the NPC (e.g., <code>npc_boss_tier2</code>). | |||
* '''Second, Third, etc. parameters (Keys):''' The path to the stat you want. For a simple stat, this is just one key. For a nested stat, provide each key as a separate parameter. | |||
* '''Final parameter (Rounding):''' (Optional) If the final parameter is a number, it will be used to round the result to that many significant figures. | |||
'''Examples''' | |||
* | * To get the max health of a Medic Trooper: | ||
* | ** '''Code:''' <code><nowiki>{{NpcData|trooper_medic|MaxHealth}}</nowiki></code> | ||
* | ** '''Result:''' {{NpcData|trooper_medic|MaxHealth}} | ||
* | * If you misspell a stat, you will see an error: | ||
* | ** '''Code:''' <code><nowiki>{{NpcData|trooper_medic|MaxHeath}}</nowiki></code> <!-- Note the typo --> | ||
** '''Result:''' {{NpcData|trooper_medic|MaxHeath}} | |||
* | |||
* | |||
* To get a nested shield stat (using multiple parameters): | |||
** '''Code:''' <code><nowiki>{{NpcData|npc_super_neutral|Shield|BaseAbsorptionPerSecond}}</nowiki></code> | |||
* ''' | ** '''Result:''' {{NpcData|npc_super_neutral|Shield|BaseAbsorptionPerSecond}} | ||
* | |||
* To get a deeply nested ability name: | |||
** '''Code:''' <code><nowiki>{{NpcData|npc_boss_tier2|BoundAbilities|1|Name}}</nowiki></code> | |||
** '''Result:''' {{NpcData|npc_boss_tier2|BoundAbilities|1|Name}} | |||
---- | |||
=== Getting an Item from a List === | |||
To get a single value from a list, you must use the named <code>index=</code> parameter. | |||
'''Syntax''' | |||
<code><nowiki>{{NpcData|NPC Name|List Name|index=Position Number}}</nowiki></code> | |||
'''Parameters''' | |||
: <code>< | * '''First parameter (NPC Name):''' The internal key for the NPC. | ||
* '''Second parameter (List Name):''' The name of the list property (e.g., <code>NearbyEnemyResistanceValues</code>). | |||
* '''index=''' The position in the list. The first item is <code>1</code>, the second is <code>2</code>, and so on. | |||
'''Example''' | |||
* The Tier 2 Boss has a list of resistance values. To get the 4th value in that list: | |||
: <code><nowiki>{{NpcData|npc_boss_tier2| | ** '''Code:''' <code><nowiki>{{NpcData|npc_boss_tier2|NearbyEnemyResistanceValues|index=4}}</nowiki></code> | ||
** '''Result:''' {{NpcData|npc_boss_tier2|NearbyEnemyResistanceValues|index=4}} | |||
: | |||
<templatedata> | <templatedata> | ||
{ | { | ||
"description": " | "description": "A shortcut for Module:NpcData to display stats for NPCs. Can retrieve simple stats, nested stats, or an item from a list.", | ||
"params": { | "params": { | ||
"1": { | "1": { | ||
"label": "NPC Name", | "label": "NPC Name", | ||
"description": "The internal key (e.g., npc_boss_tier2).", | "description": "The internal key for the NPC (e.g., npc_boss_tier2).", | ||
"type": "string", | "type": "string", | ||
"required": true, | "required": true, | ||
"example": "trooper_medic" | "example": "trooper_medic", | ||
"aliases": [ "npc" ] | |||
}, | }, | ||
"2": { | "2": { | ||
"label": " | "label": "Key 1 / List Name", | ||
"description": "The first | "description": "The name of the stat (e.g., MaxHealth), the first key in a nested path (e.g., Shield), or the name of a list.", | ||
"type": "string", | "type": "string", | ||
"required": true, | "required": true, | ||
"example": "MaxHealth" | "example": "MaxHealth", | ||
"aliases": [ "stat" ] | |||
}, | }, | ||
"3": { | "3": { | ||
"label": " | "label": "Key 2 / Rounding", | ||
"description": "The | "description": "The second key in a nested path (e.g., BaseAbsorptionPerSecond) OR an optional number to round the result to that many significant figures.", | ||
"type": "string", | "type": "string", | ||
"required": false | "required": false | ||
}, | }, | ||
"4": { | "4": { | ||
"label": " | "label": "Key 3 / Rounding", | ||
"description": "The | "description": "The third key in a nested path OR an optional rounding number.", | ||
"type": "string", | "type": "string", | ||
"required": false | "required": false | ||
}, | }, | ||
"5": { | "5": { | ||
"label": " | "label": "Rounding", | ||
"description": " | "description": "An optional number to round the result to that many significant figures.", | ||
"type": " | "type": "number", | ||
"required": false | "required": false | ||
}, | }, | ||
" | "index": { | ||
"label": " | "label": "Index", | ||
"description": "The | "description": "The position of the item to get from a list (e.g., 4 for the 4th item). Using this parameter changes the template's behavior to get an item from a list.", | ||
"type": "number", | "type": "number", | ||
"required": false | "required": false, | ||
"example": "4" | |||
} | } | ||
}, | }, | ||