Editing Template:NpcData/doc

Warning: You are not logged in. Once you make an edit, a temporary account will be created for you. Learn more. Log in or create an account to continue receiving notifications after this account expires, and to access other features.
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 allows you to display NPC stats automatically using the game files. It pulls data directly from [[Data:NpcData.json]].
This template is a shortcut for [[Module:NpcData]] to make it easier to display NPC stats on a page.


== ⚡ Quick Start ==
It can be used to get a single stat (including nested ones) or an item from a list of stats.
# Go to [[Data:NpcData.json]] and find the NPC you want.
# Look at the "path" to the stat you need.
# Copy that path into the template, separating each step with a pipe <code>|</code>.


'''Basic Example:'''
== How to Use ==
<code><nowiki>{{NpcData|trooper_medic|MaxHealth}}</nowiki></code>


== 📖 How to Build a Path ==
=== Getting a Single or Nested Stat ===
JSON data is like a set of nested folders. To get a specific number, you have to tell the template which folders to open.
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.


=== 1. Find the NPC Name ===
'''Syntax'''
The first parameter is always the "internal name" of the unit.
<code><nowiki>{{NpcData|NPC Name|Key 1|Key 2|...|Rounding}}</nowiki></code>
* '''Common names:''' <code>npc_boss_tier2</code> (Walker), <code>trooper_normal</code> (Trooper), <code>npc_super_neutral</code> (Mid Boss).


=== 2. Follow the Boxes (The "Double Box" Rule) ===
'''Parameters'''
When looking at the [[Data:NpcData.json|Data Viewer]], follow the lines to your stat.
* '''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.


* '''Standard Stat (Single Box):'''
'''Examples'''
*: If the stat is just inside a standard box, just add its name.
* To get the max health of a Medic Trooper:
*: ''Example:'' <code>ShieldLogic</code> is a standard box.
** '''Code:''' <code><nowiki>{{NpcData|trooper_medic|MaxHealth}}</nowiki></code>
*: '''Code:''' <code><nowiki>{{NpcData|npc_super_neutral|ShieldLogic|BaseAbsorptionPerSecond}}</nowiki></code>
** '''Result:''' {{NpcData|trooper_medic|MaxHealth}}


* '''List / Array (Double Box):'''
* If you misspell a stat, you will see an error:
*: '''Important:''' If you see a '''box inside a box''' (like <code>IntrinsicModifiers</code> or <code>ResistValues</code>), this is a '''List'''.
** '''Code:''' <code><nowiki>{{NpcData|trooper_medic|MaxHeath}}</nowiki></code> <!-- Note the typo -->
*: You cannot just ask for the stat; you must use a '''Number''' to tell the template which item in the list to look at (1 for the 1st, 2 for the 2nd, etc.).
** '''Result:''' {{NpcData|trooper_medic|MaxHeath}}
*: ''Example:'' <code>IntrinsicModifiers</code> is a list.
*: '''Code:''' <code><nowiki>{{NpcData|npc_super_neutral|IntrinsicModifiers|1|HEALTH_REGEN_PER_SECOND}}</nowiki></code>


=== 3. Rounding (Optional) ===
* To get a nested shield stat (using multiple parameters):
If the number is too long (e.g., 0.333333), you can add a number at the very end to round it.
** '''Code:''' <code><nowiki>{{NpcData|npc_super_neutral|Shield|BaseAbsorptionPerSecond}}</nowiki></code>
* '''Note:''' This uses '''Significant Figures''', not decimal places.
** '''Result:''' {{NpcData|npc_super_neutral|Shield|BaseAbsorptionPerSecond}}
* <code>...|2}}</code> turns <code>1250</code> into <code>1300</code>.
* <code>...|2}}</code> turns <code>0.125</code> into <code>0.13</code>.


== 📋 Copy-Paste Examples ==
* 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}}


; Simple Stats
----
: <code><nowiki>{{NpcData|trooper_medic|MaxHealth}}</nowiki></code> → {{NpcData|trooper_medic|MaxHealth}}
=== Getting an Item from a List ===
To get a single value from a list, you must use the named <code>index=</code> parameter.


; Nested Stats (Shields, Regen)
'''Syntax'''
: <code><nowiki>{{NpcData|npc_super_neutral|ShieldLogic|BaseAbsorptionPerSecond}}</nowiki></code> → {{NpcData|npc_super_neutral|ShieldLogic|BaseAbsorptionPerSecond}}
<code><nowiki>{{NpcData|NPC Name|List Name|index=Position Number}}</nowiki></code>


; Abilities (Using Slot Names)
'''Parameters'''
: <code><nowiki>{{NpcData|npc_boss_tier2|BoundAbilities|ESlot_Signature_1|Damage}}</nowiki></code> → {{NpcData|npc_boss_tier2|BoundAbilities|ESlot_Signature_1|Damage}}
* '''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.


; Lists/Arrays (Using Numbers)
'''Example'''
: ''Getting the 4th value from a list of resistance numbers:''
* The Tier 2 Boss has a list of resistance values. To get the 4th value in that list:
: <code><nowiki>{{NpcData|npc_boss_tier2|NearbyEnemyResist|ResistValues|4}}</nowiki></code> → {{NpcData|npc_boss_tier2|NearbyEnemyResist|ResistValues|4}}
** '''Code:''' <code><nowiki>{{NpcData|npc_boss_tier2|NearbyEnemyResistanceValues|index=4}}</nowiki></code>
 
** '''Result:''' {{NpcData|npc_boss_tier2|NearbyEnemyResistanceValues|index=4}}
; Rounding
: <code><nowiki>{{NpcData|npc_boss_tier2|MaxHealth|2}}</nowiki></code> → {{NpcData|npc_boss_tier2|MaxHealth|2}}
 
== ❌ Common Errors ==
* <span class="error">Error: Key "X" not found...</span>
*: You likely spelled the stat name wrong, or you forgot a step in the path (like missing a folder name).
* <span class="error">Error: Path points to a table/object...</span>
*: You stopped too early! You pointed to a "folder" (like <code>ShieldLogic</code>) instead of a specific number inside it. Add one more parameter to get the specific stat.


<templatedata>
<templatedata>
{
{
"description": "Displays NPC stats from game files. Use the Data:NpcData.json page to find the correct paths.",
"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": "Path Step 1",
"label": "Key 1 / List Name",
"description": "The first step in the path (e.g., MaxHealth or BoundAbilities).",
"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": "Path Step 2 / Rounding",
"label": "Key 2 / Rounding",
"description": "The next step in the path OR an optional rounding number.",
"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": "Path Step 3 / Rounding",
"label": "Key 3 / Rounding",
"description": "The next step in the path OR an optional rounding number.",
"description": "The third key in a nested path OR an optional rounding number.",
"type": "string",
"type": "string",
"required": false
"required": false
},
},
"5": {
"5": {
"label": "Path Step 4 / Rounding",
"label": "Rounding",
"description": "The next step in the path OR an optional rounding number.",
"description": "An optional number to round the result to that many significant figures.",
"type": "string",
"type": "number",
"required": false
"required": false
},
},
"6": {
"index": {
"label": "Path Step 5 / Rounding",
"label": "Index",
"description": "The next step in the path OR an optional rounding number.",
"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": "string",
"required": false
},
"7": {
"label": "Path Step 6 / Rounding",
"description": "The next step in the path OR an optional rounding number.",
"type": "string",
"required": false
},
"8": {
"label": "Rounding",
"description": "Optional: Round to this many Significant Figures (e.g., 2). Only used if this is the final parameter.",
"type": "number",
"type": "number",
"required": false
"required": false,
"example": "4"
}
}
},
},
Please note that all contributions to The Deadlock Wiki are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see Deadlock:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!
Cancel Editing help (opens in new window)
Preview page with this template

Pages included on this page: