HUDofTime.lua

From PGE Wiki
Jump to navigation Jump to search

Attention: This page contains dead links!

Download Latest Version

This replaces Link's HUD with one themed on Zelda. Each element can be toggled on or off individually, and can be unbound from the default and customised freely.

The elements are as follows:

HUDofTime in action
  • A heart counter, which allows an increased heart limit.
  • A magic bar, which displays remaining fairy or statue time.
  • Item buttons, which show how many bombs are available.
  • Navi, which is an icon that displays when a speaking NPC is available.
  • Rupees, which count coins.
  • Keys, which shows you if you are carrying a key.
  • Score, which displays your score.
  • Fairies, which displays your current lives.
  • Triforce, which displays your star count.

Installation

Place the file hudoftime.lua and the corresponding folder in either your level's custom graphics folder for use in a level, along with a lunadll.lua file, or in the same directory as your .wld file along with a lunaworld.lua file for use throughout an entire episode.

How to use

To enable the HUD for a specific level, add this line to lunadll.lua:

local hudoftime = API.load("hudoftime");

This will load the HUD, and display it when Link is the player character.

Documentation

Values

These are variables you can access

hearts number The number of hearts the player currently has. (Automatic binding must be disabled before this is set).
maxhearts number The maximum number of hearts the player can have.
magic number The amount of magic the player currently has, as a value between 0 and 1 (the automatic binding uses this to display remaining fairy and statue time). (Automatic binding must be disabled before this is set).
rupees number The number of rupees the player currently has. (Automatic binding must be disabled before this is set).
maxrupees number The maximum number of rupees the player can have. (Automatic binding must be disabled before this is set).
keys number The number of keys the player currently has. (Automatic binding must be disabled before this is set).
buttons table of LuaImageResource A table of button icons, in the order they should be displayed in the item menu (these are usually set to display X and S). (Automatic binding must be disabled before this is set).
triforce number The number of "triforce" objects the player currently has (the automatic binding uses these as stars). (Automatic binding must be disabled before this is set).
maxtriforce number The maximum number of "triforce" objects the player can have. (Automatic binding must be disabled before this is set).
fairy number The number of "fairy" objects the player currently has (the automatic binding uses these as lives). (Automatic binding must be disabled before this is set).
maxfairy number The maximum number of "fairy" objects the player can have. (Automatic binding must be disabled before this is set).
navi boolean Should the Navi icon be displayed? (Automatic binding must be disabled before this is set).
auto_hearts boolean Enable or disable the automatic binding for the hearts HUD element.
auto_magic boolean Enable or disable the automatic binding for the magic HUD element.
auto_rupees boolean Enable or disable the automatic binding for the rupees HUD element.
auto_keys boolean Enable or disable the automatic binding for the keys HUD element.
auto_items boolean Enable or disable the automatic binding for the items HUD element.
auto_triforce boolean Enable or disable the automatic binding for the triforce HUD element.
auto_fairy boolean Enable or disable the automatic binding for the fairy HUD element.
auto_navi boolean Enable or disable the automatic binding for the Navi HUD element.
auto_enable boolean Enable or disable changing the HUD as the player switches between characters. When activated, this HUD will replace Links, but all others will be default. Disable this to allow the HUD to display for other characters, or to use a different custom HUD for other characters.
keep_powerups boolean When true, the player will not lose their powerup when taking damage unless they are dropped to 1 heart. By default, this is true.
show_hearts boolean Enable or disable the hearts HUD element.
show_magic boolean Enable or disable the magic HUD element.
show_rupees boolean Enable or disable the rupees HUD element.
show_keys boolean Enable or disable the keys HUD element.
show_items boolean Enable or disable the items HUD element.
show_triforce boolean Enable or disable the triforce HUD element.
show_fairy boolean Enable or disable the fairy HUD element.
show_navi boolean Enable or disable the Navi HUD element.
show_score boolean Enable or disable the score HUD element.
show_HUD boolean Enable or disable the entire HUD.
HEART_FULL LuaImageResource The "full heart" image. 16x16
HEART_EMPTY LuaImageResource The "empty heart" image. 16x16
RUPEE LuaImageResource The "rupee" image. 16x16
SWORD LuaImageResource The "sword item" image. 32x32
BOMB LuaImageResource The "bomb item" image. 32x32
BTN_X LuaImageResource The "X button" image. 32x32
BTN_S LuaImageResource The "S button" image. 32x32
KEY LuaImageResource The "key" image. 16x16
MAGIC_BG LuaImageResource The background for the magic bar. 164x16
MAGIC_BAR LuaImageResource The bar texture for the magic bar. 1x16
NAVI LuaImageResource The "navi" image. 32x32
TRIFORCE LuaImageResource The "triforce" image. 16x16
FAIRY LuaImageResource The "fairy" image. 16x16


External Use Functions

These are functions you will need to use the library

setItem button icon
Assigns the specified item icon to the specified button. (Automatic binding must be disabled before this is called). nil LuaImageResource

The button to assign the item to. Should be a member of the "buttons" list.

LuaImageResource'

The item icon to display on this item button.

setItem button icon count
Assigns the specified item icon to the specified button, with the specified number. (Automatic binding must be disabled before this is called). nil LuaImageResource

The button to assign the item to. Should be a member of the "buttons" list.

LuaImageResource'

The item icon to display on this item button.

number

The number of this item to display (shown to the side of the icon).

getItem button
Returns the item icon currently assigned to the specified button. LuaImageResource LuaImageResource

The button to find the assigned item for. Should be a member of the "buttons" list.

getItemCount button
Returns the number of items on the specified button. If the item was assigned without specifying a count, this will return -1. number LuaImageResource

The button to find the assigned item number for. Should be a member of the "buttons" list.

Enable
Enables the HUD, disabling the default SMBX HUD. nil
Disable
Disables the HUD, re-enabling the default SMBX HUD. nil