Difference between revisions of "Template:EnemyAttributes"

From Stoneshard wiki
Jump to navigation Jump to search
(check for nonexisting enemy)
 
Line 4: Line 4:
--- Load complete datastring into a variable - to only load from the Enemy data page once. ---
--- Load complete datastring into a variable - to only load from the Enemy data page once. ---
-->{{#vardefine:Datastring|{{:Enemy_data|{{#var:Page}}}}}}<!--
-->{{#vardefine:Datastring|{{:Enemy_data|{{#var:Page}}}}}}<!--
--- Return one attribute as specified by parameter, otherwise return 0 ---
--- If specified enemy does not exist, return zero, otherwise go pick one attribute to return. ---
-->{{#ifeq: {{#var:Datastring}}|Data does not exist.|0|<!--
--- Return value of the attribute specified by parameter, otherwise return zero ---
-->{{#switch: {{{1|}}}
-->{{#switch: {{{1|}}}
|STR = {{#explode: {{#var:Datastring}}|;|42}}
|STR = {{#explode: {{#var:Datastring}}|;|42}}
Line 11: Line 13:
|VIT = {{#explode: {{#var:Datastring}}|;|44}}
|VIT = {{#explode: {{#var:Datastring}}|;|44}}
|WIL = {{#explode: {{#var:Datastring}}|;|46}}
|WIL = {{#explode: {{#var:Datastring}}|;|46}}
|#default = 0 }}</includeonly>
|#default = 0 }}}}</includeonly><noinclude>{{doc}}[[Category:Templates]]</noinclude>

Latest revision as of 12:00, 17 July 2023

Template-info.png Documentation

This template can be used to return an Enemy's attributes. It loads a given enemy's data from the respective Enemy data page and returns the selected attribute value.

Template requires at least one parameter - the attribute to return.

  • STR
  • AGL
  • PRC
  • VIT
  • WIL

If you don't specify an attribute (or input something else), the template will always return zero.

Examples:

Enemy Pages

{{EnemyAttributes|AGL}}

On Ringleader_(Sword) page, returns the Agility of the Ringleader.

Outside of Enemy Pages

If you are on a wikipage that isn't an enemy page, the template also returns zero.

{{EnemyAttributes|AGL}}

0

You can specify a wikipage name of an enemy to load attributes from that enemy, for example:

{{EnemyAttributes|AGL|Ringleader (Sword)}}

This will return the Agility of Ringleader_(Sword).

20