Template:MiscData/doc: Difference between revisionsGive feedback
Gammaton32 (talk | contribs) Created page with "<templatedata> { "description": "Displays misc stats from game files. Use the Data:MiscData.json page to find the correct paths.", "params": { "1": { "label": "Misc Name", "description": "The internal key.", "type": "string", "required": true, "example": "medic_trooper_aoe_health_pickup_amber" }, "2": { "label": "Path Step 1", "description": "The first step in the path.", "type": "string", "required": true, "example": "MaxHealth" }..." |
Gammaton32 (talk | contribs) |
||
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
This template allows you to display misc stats automatically using the game files. It pulls data directly from [[Data:MiscData.json]]. | |||
== ⚡ Quick Start == | |||
# Go to [[Data:MiscData.json]] and find the stat 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:''' | |||
<code><nowiki>{{MiscData|medic_trooper_aoe_health_pickup_amber|RegenFixed|Base}}</nowiki></code> | |||
== 📖 How to Build a Path == | |||
JSON data is like a set of nested folders. To get a specific number, you have to tell the template which folders to open. | |||
=== 1. Find the NPC Name === | |||
The first parameter is always the "internal name" of the unit. | |||
=== 2. Follow the Boxes (The "Double Box" Rule) === | |||
When looking at the [[Data:MiscData.json|Data Viewer]], follow the lines to your stat. | |||
* '''Standard Stat (Single Box):''' | |||
*: If the stat is just inside a standard box, just add its name. | |||
*: ''Example:'' <code><nowiki>{{MiscData|ammo_permanent_pickup|PickupRadius|Base}}</nowiki></code> | |||
* '''List / Array (Double Box):''' | |||
*: '''Important:''' If you see a '''box inside a box''' , this is a '''List'''. | |||
*: 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.). | |||
*: ''Example:'' <code><nowiki>{{MiscData|cd_permanent_pickup|Modifer|ScriptValues|1|value}}</nowiki></code> | |||
=== 3. Rounding (Optional) === | |||
If the number is too long (e.g., 0.333333), you can add a number at the very end to round it. | |||
* '''Note:''' This uses '''Significant Figures''', not decimal places. | |||
* <code>...|2}}</code> turns <code>1250</code> into <code>1300</code>. | |||
* <code>...|2}}</code> turns <code>0.125</code> into <code>0.13</code>. | |||
== ❌ 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> | ||
{ | { | ||
Latest revision as of 16:52, 27 May 2026
This template allows you to display misc stats automatically using the game files. It pulls data directly from Data:MiscData.json.
⚡ Quick Start
[edit source]- Go to Data:MiscData.json and find the stat you want.
- Look at the "path" to the stat you need.
- Copy that path into the template, separating each step with a pipe
|.
Basic Example:
{{MiscData|medic_trooper_aoe_health_pickup_amber|RegenFixed|Base}}
📖 How to Build a Path
[edit source]JSON data is like a set of nested folders. To get a specific number, you have to tell the template which folders to open.
1. Find the NPC Name
[edit source]The first parameter is always the "internal name" of the unit.
2. Follow the Boxes (The "Double Box" Rule)
[edit source]When looking at the Data Viewer, follow the lines to your stat.
- Standard Stat (Single Box):
- If the stat is just inside a standard box, just add its name.
- Example:
{{MiscData|ammo_permanent_pickup|PickupRadius|Base}}
- List / Array (Double Box):
- Important: If you see a box inside a box , this is a List.
- 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.).
- Example:
{{MiscData|cd_permanent_pickup|Modifer|ScriptValues|1|value}}
3. Rounding (Optional)
[edit source]If the number is too long (e.g., 0.333333), you can add a number at the very end to round it.
- Note: This uses Significant Figures, not decimal places.
...|2}}turns1250into1300....|2}}turns0.125into0.13.
❌ Common Errors
[edit source]- Error: Key "X" not found...
- You likely spelled the stat name wrong, or you forgot a step in the path (like missing a folder name).
- Error: Path points to a table/object...
- You stopped too early! You pointed to a "folder" (like
ShieldLogic) instead of a specific number inside it. Add one more parameter to get the specific stat.
- You stopped too early! You pointed to a "folder" (like
Displays misc stats from game files. Use the Data:MiscData.json page to find the correct paths.
| Parameter | Description | Type | Status | |
|---|---|---|---|---|
| Misc Name | 1 | The internal key.
| String | required |
| Path Step 1 | 2 | The first step in the path.
| String | required |
| Path Step 2 / Rounding | 3 | The next step in the path OR an optional rounding number. | String | optional |
| Path Step 3 / Rounding | 4 | The next step in the path OR an optional rounding number. | String | optional |
| Path Step 4 / Rounding | 5 | The next step in the path OR an optional rounding number. | String | optional |
| Path Step 5 / Rounding | 6 | The next step in the path OR an optional rounding number. | String | optional |
| Path Step 6 / Rounding | 7 | The next step in the path OR an optional rounding number. | String | optional |
| Rounding | 8 | Optional: Round to this many Significant Figures (e.g., 2). Only used if this is the final parameter. | Number | optional |