I edited a bunch of the old code to give it the enable/disable function, I also changed it to show a sprite instead of a window, this way you do not need to worry about windows being shown and may even be slightly less laggy (not that it lagged in the first place). I also included a simple outlined text method so you can see the text more clearly
CODE
# Corner Hud for displaying a Variable
# by yamina-chan for Donotfeedthemax
module CORNER
#easy method of enabling hud
def self.enable
$game_system.corner_hud = true
return
end
#easy method of disabled the hud
def self.disable
$game_system.corner_hud = false
return
end
end
class Game_System
attr_accessor :corner_hud
alias max_corner_initialize_later initialize
def initialize
max_corner_initialize_later
#added a variable to enable/disable the hud
@corner_hud = true
end
end
class Bitmap
#draws outlined text
def draw_text_corner(x, y, w, h, text, align = 0)
#save old font color
old_color = self.font.color.clone
#change font color to the outline color
self.font.color = Color.new(0,0,0,100)
#draw the outline around the text
draw_text(x + 1, y + 1, w, h, text, align)
draw_text(x + 1, y - 1, w, h, text, align)
draw_text(x - 1, y + 1, w, h, text, align)
draw_text(x - 1, y - 1, w, h, text, align)
#reset the font color
self.font.color = old_color
#draw the original text
draw_text(x, y, w, h, text, align)
end
end
#changed to inherit from the sprite class instead of window
class Corner_HUD < Sprite
def initialize(viewport = nil)
super(viewport)
#create the sprite bitmap
self.bitmap = Bitmap.new(130, 54)
#location variables
self.x, self.y, self.z = 511, 427, 9000
#refresh content
refresh
end
def refresh
#clear the bitmap
self.bitmap.clear
#change the corner variable to game variable 1
@corner_var = $game_variables[1]
#draw the word Rupee's
self.bitmap.draw_text_corner(0, 0, 130, 32, 'Rupees')
#draw the corner variable as a string
self.bitmap.draw_text_corner(80, 0, 130, 32, @corner_var.to_s)
end
def update
#refresh if needed
refresh if @corner_var != $game_variables[1]
end
end
class Scene_Map
alias corner_hud_main main
alias corner_hud_update update
def main
#create the corner hud if enabled
@corner_hud = Corner_HUD.new if $game_system.corner_hud
#run the old main method
corner_hud_main
#dispose corner hud if it exists
@corner_hud.dispose unless @corner_hud.nil?
end
def update
#run the old update method
corner_hud_update
#if the corner hud is enabled
if $game_system.corner_hud
#creat the corner hud if it doesn't exist
@corner_hud = Corner_HUD.new if @corner_hud.nil?
#update the corner hud
@corner_hud.update
#else if the corner hud is disabled and the corner hud exists
elsif !@corner_hud.nil?
#dispose the corner hud
@corner_hud.dispose
@corner_hud = nil
end
end
end
To enable/disable the hud simply type one of the following in the script event command
CODE
CORNER.enable
CORNER.disable
If you want to replace the word Rupee's with a picture you could replace the line:
self.bitmap.draw_text_corner(0, 0, 130, 32, 'Rupees')
with these two lines
bitmap = RPG::Cache.picture(NAME OF THE FILE)
self.bitmap.blt(0,0,bitmap,bitmap.rect)
That way it will look into your pictures folder and draw whatever the name of the file you specified. Make sure the name of the file is enclosed in "quotes"
BTW the PZE will be releasing a south clock town demo very soon including a bunch of scripts(Majora's Mask Time system, Navi, Ocarina, Minimap, Map name display) that may be useful to you.