Template:NpcData/doc: Difference between revisionsGive feedback
Added templatedata |
Updated to reflect new template code |
||
| Line 1: | Line 1: | ||
This template is a shortcut for [[Module:NpcData]] to make it easier to display NPC stats on a page. | 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 (like | It can be used to get a single stat (including nested ones like <code>Shield.BaseAbsorptionPerSecond</code>) or an item from a list of stats (like the 4th value in a list of resistances). | ||
== How to Use == | == How to Use == | ||
| Line 12: | Line 12: | ||
'''Parameters''' | '''Parameters''' | ||
* '''First parameter (NPC Name):''' The internal key for the NPC (e.g., | * '''First parameter (NPC Name):''' The internal key for the NPC (e.g., <code>npc_boss_tier2</code>). | ||
* '''Second parameter (Stat Name):''' The name of the stat you want to look up (e.g., | * '''Second parameter (Stat Name):''' The name of the stat you want to look up (e.g., <code>MaxHealth</code>). Supports dot notation for nested stats (e.g., <code>Shield.BaseAbsorptionPerSecond</code>). | ||
* '''Third parameter (Rounding):''' (Optional) A number to round the result to that many significant figures. | * '''Third parameter (Rounding):''' (Optional) A number to round the result to that many significant figures. | ||
| Line 24: | Line 24: | ||
** '''Code:''' <code><nowiki>{{NpcData|trooper_medic|MaxHeath}}</nowiki></code> <!-- Note the typo --> | ** '''Code:''' <code><nowiki>{{NpcData|trooper_medic|MaxHeath}}</nowiki></code> <!-- Note the typo --> | ||
** '''Result:''' {{NpcData|trooper_medic|MaxHeath}} | ** '''Result:''' {{NpcData|trooper_medic|MaxHeath}} | ||
* To get a nested shield stat: | |||
** '''Code:''' <code><nowiki>{{NpcData|npc_super_neutral|Shield.BaseAbsorptionPerSecond}}</nowiki></code> | |||
** '''Result:''' {{NpcData|npc_super_neutral|Shield.BaseAbsorptionPerSecond}} | |||
---- | ---- | ||
=== Getting an Item from a List === | === Getting an Item from a List === | ||
To get a single value from a list, you must use the named | To get a single value from a list, you must use the named <code>index=</code> parameter. | ||
'''Syntax''' | '''Syntax''' | ||
| Line 34: | Line 38: | ||
'''Parameters''' | '''Parameters''' | ||
* '''First parameter (NPC Name):''' The internal key for the NPC. | * '''First parameter (NPC Name):''' The internal key for the NPC. | ||
* '''Second parameter (List Name):''' The name of the list property (e.g., | * '''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 | * '''index=''' The position in the list. The first item is <code>1</code>, the second is <code>2</code>, and so on. | ||
'''Example''' | '''Example''' | ||
| Line 56: | Line 60: | ||
"2": { | "2": { | ||
"label": "Stat or List Name", | "label": "Stat or List Name", | ||
"description": "The name of the stat (e.g., MaxHealth) or the list (e.g., NearbyEnemyResistanceValues).", | "description": "The name of the stat (e.g., MaxHealth) or the list (e.g., NearbyEnemyResistanceValues). Supports dot notation for nested stats (e.g., Shield.BaseAbsorptionPerSecond).", | ||
"type": "string", | "type": "string", | ||
"required": true, | "required": true, | ||