#==============================================================================
# ** Hud_AP
#------------------------------------------------------------------------------
# By: Gando
# 12/4 2008
#------------------------------------------------------------------------------
# This class creates the window and writes the current "AP".
# You can customize all the "Grid.." ID's and "Variable.." variables
# so they suit you. here are some instructions:
#
# Grid_One - The ID of the first Ability Grid.
# Grid_Two - The ID of the second Ability Grid.
# Grid_Three - The ID of the third Ability Grid.
# Grid_Four - The ID of the fourth Ability Grid.
#
# Set all the "Grid.." variables to the ID's of your four Ability Grid map's.
#
#
# VariableOne - The id of the variable for "Grid_One".
# VariableTwo - The id of the variable for "Grid_Two".
# VariableThree - The id of the variable for "Grid_Three".
# VariableFour - The id of the variable for "Grid_Four".
#
# Example: When the player is on the "Grid_One"'s map ID, it will show the
# "VariableOne"'s value, and when the player is on "Grid_Two"'s
# map ID, it will show the "VariableTwo"'s value.
#
#==============================================================================
class Hud_AP < Window_Base
# The map ID's of the Ability Grids.
Grid_One = 1
Grid_Two = 2
Grid_Three = 3
Grid_Four = 4
VariableOne = 1
VariableTwo = 2
VariableThree = 3
VariableFour = 4
#--------------------------------------------------------------------------
# * Initialize
#--------------------------------------------------------------------------
# Self.opacity - This is the opacity of the window, you can change this
# to whatever you want between 0-255.
# 0 = Fully transparent
# 255 = opaque
#
# Self.visible - This will make the window invisible as default.
# So that the HUD won't show on every map.
#
#--------------------------------------------------------------------------
def initialize
super(0, 0, 200, 70)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 150
self.visible = false
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
# This will display the "Current AP:" text, and the variables of the
# Party members based on which map the player is on.
# You can change the "Current AP" text to whatever you want,
# but the rest you should keep as it is.
#--------------------------------------------------------------------------
def refresh
self.contents.clear
reset_variables
self.contents.draw_text(0, 0, 100, 32, "Current AP:", 0)
if $game_map.map_id == Grid_One
self.contents.draw_text(120, 0, 32, 32, @variableone.to_s, 0)
else if $game_map.map_id == Grid_Two
self.contents.draw_text(120, 0, 32, 32, @variabletwo.to_s, 0)
else if $game_map.map_id == Grid_Three
self.contents.draw_text(120, 0, 32, 32, @variablethree.to_s, 0)
else if $game_map.map_id == Grid_Four
self.contents.draw_text(120, 0, 32, 32, @variablefour.to_s, 0)
end
end
end
end
end
def reset_variables
@variableone = $game_variables[VariableOne]
@variabletwo = $game_variables[VariableTwo]
@variablethree = $game_variables[VariableThree]
@variablefour = $game_variables[VariableFour]
end
def update
super
refresh if (@variableone = $game_variables[VariableOne] or
@variabletwo = $game_variables[VariableTwo] or
@variablethree = $game_variables[VariableThree] or
@variablefour = $game_variables[VariableFour])
end
end
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
# This will add the HUD in Scene_Map.
#
# Grid_One - The ID of the first Ability Grid.
# Grid_Two - The ID of the second Ability Grid.
# Grid_Three - The ID of the third Ability Grid.
# Grid_Four - The ID of the fourth Ability Grid.
#
# NOTE: the numbers in these variables "Grid_One", "Grid_Two", etc.
# Should be the same as the ones in the beginning of this script.
#
#
# This will make the HUD visible whenever the player is in any of the four
# "Grid.." map ID's.
#
#==============================================================================
class Scene_Map
# The map ID's of the Ability Grids.
Grid_One = 1
Grid_Two = 2
Grid_Three = 3
Grid_Four = 4
alias yourhud_main main
alias yourhud_update update
def main
@yourhud = Hud_AP.new
yourhud_main
@yourhud.dispose
end
def update
if ($game_map.map_id == Grid_One or
$game_map.map_id == Grid_Two or
$game_map.map_id == Grid_Three or
$game_map.map_id == Grid_Four)
@yourhud.visible = true
else
@yourhud.visible = false
end
@yourhud.update
yourhud_update
end
end