Module:NpcData/doc: Difference between revisions

Jump to navigation Jump to search
LVL (talk | contribs)
No edit summary
LVL (talk | contribs)
Updated to reflect new module code
Line 32: Line 32:
** '''Code:''' <code><nowiki>{{#invoke:NpcData|get_npc_var|trooper_medic|MaxHeath}}</nowiki></code> <!-- Note the typo -->
** '''Code:''' <code><nowiki>{{#invoke:NpcData|get_npc_var|trooper_medic|MaxHeath}}</nowiki></code> <!-- Note the typo -->
** '''Result:''' {{#invoke:NpcData|get_npc_var|trooper_medic|MaxHeath}}
** '''Result:''' {{#invoke:NpcData|get_npc_var|trooper_medic|MaxHeath}}
----
=== Get a Nested Stat (`get_nested_var`) ===
This function retrieves values inside nested objects or arrays using dot notation.
'''Syntax'''
<code><nowiki>{{#invoke:NpcData|get_nested_var|NPC Name|Path|Rounding}}</nowiki></code>
'''Parameters'''
* '''NPC Name:''' The internal key for the NPC.
* '''Path:''' Dot-separated keys, e.g., `Shield.BaseAbsorptionPerSecond` or `BoundAbilities.1.Name`.
* '''Rounding:''' (Optional) A number to round the result to that many significant figures.
'''Examples'''
* To get the base shield absorption of the Super Neutral:
** '''Code:''' <code><nowiki>{{#invoke:NpcData|get_nested_var|npc_super_neutral|Shield.BaseAbsorptionPerSecond}}</nowiki></code>
** '''Result:''' {{#invoke:NpcData|get_nested_var|npc_super_neutral|Shield.BaseAbsorptionPerSecond}}
* To get the name of the Tier 2 Boss's first bound ability:
** '''Code:''' <code><nowiki>{{#invoke:NpcData|get_nested_var|npc_boss_tier2|BoundAbilities.1.Name}}</nowiki></code>
** '''Result:''' {{#invoke:NpcData|get_nested_var|npc_boss_tier2|BoundAbilities.1.Name}}


----
----
Line 49: Line 70:
** '''Code:''' <code><nowiki>{{#invoke:NpcData|get_list_elem|npc_boss_tier2|NearbyEnemyResistanceValues|4}}</nowiki></code>
** '''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}}
** '''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>
</includeonly>
</includeonly>