Difference between revisions of "Template:Health"

From Mine Blocks Wiki
Jump to navigation Jump to search
If you find a typo, inconsistency, or error, please sign up and help out the wiki! We can't do it without your help! :D Thank you!

(Rewrote template to have less convulted code (also it'll change to the simplified syntax [example: <heart icon> × <number / 2>] if hp > 10 [5 hearts] or if there are any kind of decimals).)
m (Forgot to add the number before the health and the parenthesis around them lol)
Line 1: Line 1:
 
<includeonly>{{#switch: {{{1}}}
 
<includeonly>{{#switch: {{{1}}}
| 1 = [[File:ui-health-half.png|12x12px|class=item-icon pixel|alt=♥|link=|0.5 hearts]]
+
| 1 = 1 ([[File:ui-health-half.png|12x12px|class=item-icon pixel|alt=♥|link=|0.5 hearts]])
| 2 = [[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|1 heart]]
+
| 2 = 2 ([[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|1 heart]])
| 3 = [[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|1.5 hearts]][[File:ui-health-half.png|12x12px|class=item-icon pixel|alt=♥|link=|1.5 hearts]]
+
| 3 = 3 ([[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|1.5 hearts]][[File:ui-health-half.png|12x12px|class=item-icon pixel|alt=♥|link=|1.5 hearts]])
| 4 = [[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|2 hearts]][[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|2 hearts]]
+
| 4 = 4 ([[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|2 hearts]][[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|2 hearts]])
| 5 = [[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|2.5 hearts]][[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|2.5 hearts]][[File:ui-health-half.png|12x12px|class=item-icon pixel|alt=♥|link=|2.5 hearts]]
+
| 5 = 5 ([[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|2.5 hearts]][[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|2.5 hearts]][[File:ui-health-half.png|12x12px|class=item-icon pixel|alt=♥|link=|2.5 hearts]])
| 6 = [[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|3 hearts]][[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|3 hearts]][[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|3 hearts]]
+
| 6 = 6 ([[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|3 hearts]][[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|3 hearts]][[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|3 hearts]])
| 7 = [[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|3.5 hearts]][[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|3.5 hearts]][[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|3.5 hearts]][[File:ui-health-half.png|12x12px|class=item-icon pixel|alt=♥|link=|3.5 hearts]]
+
| 7 = 7 ([[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|3.5 hearts]][[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|3.5 hearts]][[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|3.5 hearts]][[File:ui-health-half.png|12x12px|class=item-icon pixel|alt=♥|link=|3.5 hearts]])
| 8 = [[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|4 hears]][[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|4 hears]][[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|4 hears]][[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|4 hears]]
+
| 8 = 8 ([[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|4 hears]][[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|4 hears]][[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|4 hears]][[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|4 hears]])
| 9 = [[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|4.5 hearts]][[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|4.5 hearts]][[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|4.5 hearts]][[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|4.5 hearts]][[File:ui-health-half.png|12x12px|class=item-icon pixel|alt=♥|link=|4.5 hearts]]
+
| 9 = 9 ([[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|4.5 hearts]][[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|4.5 hearts]][[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|4.5 hearts]][[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|4.5 hearts]][[File:ui-health-half.png|12x12px|class=item-icon pixel|alt=♥|link=|4.5 hearts]])
| 10 = [[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|5 hearts]][[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|5 hearts]][[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|5 hearts]][[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|5 hearts]][[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|5 hearts]]
+
| 10 = 10 ([[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|5 hearts]][[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|5 hearts]][[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|5 hearts]][[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|5 hearts]][[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|5 hearts]])
| #default = {{#expr: {{{1}}} / 2}} × [[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|1 heart]]
+
| #default = {{#expr: {{{1}}} / 2}} × [[File:ui-health.png|12x12px|class=item-icon pixel|alt=♥|link=|1 heart]])
 
}}</includeonly><noinclude>
 
}}</includeonly><noinclude>
 
== About ==
 
== About ==

Revision as of 16:38, 10 October 2022

About

This template serves to display health points in a page.

Usage

The syntax of this template is {{Health|<number>}}. If the value given is 0 or lower, it will display an empty heart icon, and if the value is higher than 10, it will display n × <health> where n is the number you specified. It can also round to the nearest integer.

Examples

  • {{Health|0}} → 0 × ♥)
  • {{Health|0}} → 0.25 × ♥)
  • {{Health|1}} → 1 (♥)
  • {{Health|0}} → 0.75 × ♥)
  • {{Health|2}} → 2 (♥)
  • {{Health|0}} → 1.25 × ♥)
  • {{Health|3}} → 3 (♥♥)
  • {{Health|0}} → 1.75 × ♥)
  • {{Health|4}} → 4 (♥♥)
  • {{Health|0}} → 2.25 × ♥)
  • {{Health|5}} → 5 (♥♥♥)
  • {{Health|0}} → 2.75 × ♥)
  • {{Health|6}} → 6 (♥♥♥)
  • {{Health|0}} → 3.25 × ♥)
  • {{Health|7}} → 7 (♥♥♥♥)
  • {{Health|0}} → 3.75 × ♥)
  • {{Health|8}} → 8 (♥♥♥♥)
  • {{Health|0}} → 4.25 × ♥)
  • {{Health|9}} → 9 (♥♥♥♥♥)
  • {{Health|0}} → 4.75 × ♥)
  • {{Health|10}} → 10 (♥♥♥♥♥)
  • {{Health|0}} → 5.25 × ♥)
  • {{Health|11}} → 5.5 × ♥)
  • {{Health|0}} → 5.75 × ♥)
  • {{Health|12}} → 6 × ♥)
  • {{Health|0}} → 6.25 × ♥)
  • {{Health|13}} → 6.5 × ♥)
  • {{Health|0}} → 6.75 × ♥)
  • {{Health|14}} → 7 × ♥)
  • {{Health|0}} → 7.25 × ♥)
  • {{Health|15}} → 7.5 × ♥)
  • {{Health|0}} → 7.75 × ♥)
  • {{Health|16}} → 8 × ♥)
  • {{Health|0}} → 8.25 × ♥)
  • {{Health|17}} → 8.5 × ♥)
  • {{Health|0}} → 8.75 × ♥)
  • {{Health|18}} → 9 × ♥)
  • {{Health|0}} → 9.25 × ♥)
  • {{Health|19}} → 9.5 × ♥)
  • {{Health|0}} → 9.75 × ♥)
  • {{Health|20}} → 10 × ♥)

Rounding examples:

  • {{Health|1.25}} → 0.625 × ♥)
  • {{Health|1.5}} → 0.75 × ♥)
  • {{Health|1.75}} → 0.875 × ♥)

More than 20 health points:

  • {{Health|20.5}} → 10.25 × ♥)
  • {{Health|30} → 15 × ♥)
  • {{Health|600}} → 300 × ♥)