I found this script from Symptco Designs and then used an edited version to make the HUD disappear and reappear using a switch. The problem I have is that even when I have the switch on so that the HUD is off screen, it'll appear for a second or two before disappearing. This is annoying especially when I want to begin a game with a cut scene. Is there a way to further edit this script so that the HUD does not appear unless a call script command is used?
HUD Script
Script Edit
**EDIT** Symptco Designs is currently down. Here is the actual script that I have in my game.
HUD Script
Script Edit
**EDIT** Symptco Designs is currently down. Here is the actual script that I have in my game.
#==============================================================================
# ** Game_Actor
# Script by MeisMe
# Graphics added by Peaches
# Icons made by Joshie666 & Axerax
#------------------------------------------------------------------------------
# This class handles the actor. It's used within the Game_Actors class
# ($game_actors) and refers to the Game_Party class ($game_party).
#==============================================================================
class Game_Actor
#--------------------------------------------------------------------------
# * Get the current EXP
#--------------------------------------------------------------------------
def now_exp
return @exp - @exp_list[@level]
end
#--------------------------------------------------------------------------
# * Get the next level's EXP
#--------------------------------------------------------------------------
def next_exp
return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
end
end
#==============================================================================
# ** Window_HUD
#------------------------------------------------------------------------------
# This class is used to display HP, SP and Gold on the map.
#==============================================================================
class Window_HUD < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(-16, -16, 672, 150)
self.contents = Bitmap.new(width-32, height-32)
self.opacity = 0
self.contents.font.size = 17
self.contents.font.name = "Invitation"
@actors = []
@old_hp = []
@old_sp = []
@old_exp = []
@old_level = []
for i in 0...$game_party.actors.size
@actors.push($game_party.actors)
@old_hp.push(@actors.hp)
@old_sp.push(@actors.sp)
@old_exp.push(@actors.now_exp)
@old_level.push(@actors.level)
end
@old_gold = $game_party.gold
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
#self.contents.draw_text(6, 0, 32, 14, $data_system.words.hp + "")
#self.contents.draw_text(6, 14, 32, 14, $data_system.words.sp + "")
self.contents.draw_text(6, 28, 32, 14, "")
#self.contents.draw_text(6, 42, 32, 14, $data_system.words.gold + "")
self.contents.font.color = normal_color
#Images
case @actors.size
when 1
bitmap = RPG::Cache.picture("HUD Graphic")
self.contents.blt(0, 0, bitmap, Rect.new(0, 10, 500, 500))
when 2
bitmap = RPG::Cache.picture("HUD Graphic2")
self.contents.blt(0, 0, bitmap, Rect.new(0, 10, 500, 500))
when 3
bitmap = RPG::Cache.picture("HUD Graphic2")
self.contents.blt(0, 0, bitmap, Rect.new(0, 10, 500, 500))
when 4
bitmap = RPG::Cache.picture("HUD Graphic3")
self.contents.blt(0, 0, bitmap, Rect.new(0, 10, 640, 500))
when 5
bitmap = RPG::Cache.picture("HUD Graphic3")
self.contents.blt(0, 0, bitmap, Rect.new(0, 10, 640, 500))
end
#bitmap = RPG::Cache.picture("HUD Graphic")
#self.contents.blt(0, 0, bitmap, Rect.new(0, 10, 500, 500))
bitmap = RPG::Cache.icon("HP Symbol")
self.contents.blt(3, 10, bitmap, Rect.new(0, 0, 24, 24))
bitmap = RPG::Cache.icon("SP Symbol")
self.contents.blt(3, 30, bitmap, Rect.new(0, 0, 24, 24))
bitmap = RPG::Cache.icon("EXP Symbol")
self.contents.blt(3, 50, bitmap, Rect.new(0, 0, 24, 24))
bitmap = RPG::Cache.icon("Hero")
self.contents.blt(25, 67, bitmap, Rect.new(0, 0, 24, 24))
if $game_switches[99] == true
if $game_variables[99] == 0
self.contents.draw_text(x, y, 210, 14, $game_party.item_number[1])
elsif $game_variables[98] == 1
self.contents.draw_text(x, y, 210, 14, $game_party.item_number(2))
elsif $game_variables[98] ==2
self.contents.draw_text(x, y, 110, 14, @actors.name)
end
end
x = 32
for i in 0...@actors.size
y = 6
self.contents.draw_text(x, y, 110, 14, @actors.name)
self.contents.draw_text(x, y, 110, 14, "Lv#{@actors.level}", 2)
y += 16
draw_hp_bar(@actors, x, y, 112, 3)
y += 19
draw_sp_bar(@actors, x, y, 112, 3)
y += 19
draw_exp_bar(@actors, x, y, 112, 3)
y += 19
x += 130
end
x = 32
self.contents.draw_text(45, 73, 110, 14, $game_party.gold.to_s)
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
if @actors.size != $game_party.actors.size
@actors = []
for i in 0...$game_party.actors.size
@actors.push($game_party.actors)
end
refresh
return
end
for i in 0...@actors.size
if @old_hp != @actors.hp or
@old_sp != @actors.sp or
@old_exp != @actors.now_exp or
@old_level != @actors.level or
@old_gold != $game_party.gold
refresh
@old_hp = @actors.hp
@old_sp = @actors.sp
@old_exp = @actors.now_exp
@old_level = @actors.level
@old_gold = $game_party.gold
end
end
end
#--------------------------------------------------------------------------
# * Draw HP Bar
#--------------------------------------------------------------------------
def draw_hp_bar(actor, x, y, length, thick)
width = length
height = 3
c1 = Color.new(100, 255,100, 255)
c2 = Color.new(0, 0, 0, 0)
e1 = actor.hp
e2 = actor.maxhp
self.contents.fill_rect(x-1, y - 1, width+2, height + 3, Color.new(0, 0, 0, 0))
self.contents.fill_rect(x, y, width, height + 1, Color.new(0, 0, 0, 255))
w = width * e1 / e2
for i in 0..height
r = c1.red + (c2.red - c1.red) * (height -i)/height + 0 * i/height
g = c1.green + (c2.green - c1.green) * (height -i)/height + 0 * i/height
b = c1.blue + (c2.blue - c1.blue) * (height -i)/height + 0 * i/height
a = c1.alpha + (c2.alpha - c1.alpha)* (height -i)/height + 255 * i/height
self.contents.fill_rect(x, y+i, w, 1, Color.new(r, g, b, a))
end
end
#--------------------------------------------------------------------------
# * Draw SP Bar
#--------------------------------------------------------------------------
def draw_sp_bar(actor, x, y, length, thick)
width = length
height = 3
c1 = Color.new(128, 255, 255, 128)
c2 = Color.new(0, 0, 0, 0)
e1 = actor.sp
e2 = actor.maxsp
self.contents.fill_rect(x-1, y - 1, width+2, height + 3, Color.new(0, 0, 0, 0))
self.contents.fill_rect(x, y, width, height + 1, Color.new(0, 0, 0, 255))
w = width * e1 / e2
for i in 0..height
r = c1.red + (c2.red - c1.red) * (height -i)/height + 0 * i/height
g = c1.green + (c2.green - c1.green) * (height -i)/height + 0 * i/height
b = c1.blue + (c2.blue - c1.blue) * (height -i)/height + 0 * i/height
a = c1.alpha + (c2.alpha - c1.alpha)* (height -i)/height + 255 * i/height
self.contents.fill_rect(x, y+i, w, 1, Color.new(r, g, b, a))
end
end
#--------------------------------------------------------------------------
# * Draw EXP Bar
#--------------------------------------------------------------------------
def draw_exp_bar(actor, x, y, length, thick)
width = length
height = 3
c1 = Color.new(255, 128, 255, 255)
c2 = Color.new(0, 0, 0, 0)
e1 = actor.now_exp
e2 = actor.next_exp
if actor.next_exp == 0
e1 = 1
e2 = 1
end
self.contents.fill_rect(x-1, y - 1, width+2, height + 3, Color.new(0, 0, 0, 0))
self.contents.fill_rect(x, y, width, height + 1, Color.new(0, 0, 0, 255))
w = width * e1 / e2
for i in 0..height
r = c1.red + (c2.red - c1.red) * (height -i)/height + 0 * i/height
g = c1.green + (c2.green - c1.green) * (height -i)/height + 0 * i/height
b = c1.blue + (c2.blue - c1.blue) * (height -i)/height + 0 * i/height
a = c1.alpha + (c2.alpha - c1.alpha)* (height -i)/height + 255 * i/height
self.contents.fill_rect(x, y+i, w, 1, Color.new(r, g, b, a))
end
end
end
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
# This class performs map screen processing.
#==============================================================================
class Scene_Map
#--------------------------------------------------------------------------
# * Object Aliasing
#--------------------------------------------------------------------------
alias hud_scene_map_main main
alias hud_scene_map_update update
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def main
@HUD = Window_HUD.new
hud_scene_map_main
@HUD.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
if $game_switches[0001] == false
if @HUD.visible == true
@HUD.visible = false
end
end
if $game_switches[0001] == true
if @HUD.visible == false
@HUD.visible = true
end
end
@HUD.update
hud_scene_map_update
end
end
# ** Game_Actor
# Script by MeisMe
# Graphics added by Peaches
# Icons made by Joshie666 & Axerax
#------------------------------------------------------------------------------
# This class handles the actor. It's used within the Game_Actors class
# ($game_actors) and refers to the Game_Party class ($game_party).
#==============================================================================
class Game_Actor
#--------------------------------------------------------------------------
# * Get the current EXP
#--------------------------------------------------------------------------
def now_exp
return @exp - @exp_list[@level]
end
#--------------------------------------------------------------------------
# * Get the next level's EXP
#--------------------------------------------------------------------------
def next_exp
return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
end
end
#==============================================================================
# ** Window_HUD
#------------------------------------------------------------------------------
# This class is used to display HP, SP and Gold on the map.
#==============================================================================
class Window_HUD < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(-16, -16, 672, 150)
self.contents = Bitmap.new(width-32, height-32)
self.opacity = 0
self.contents.font.size = 17
self.contents.font.name = "Invitation"
@actors = []
@old_hp = []
@old_sp = []
@old_exp = []
@old_level = []
for i in 0...$game_party.actors.size
@actors.push($game_party.actors)
@old_hp.push(@actors.hp)
@old_sp.push(@actors.sp)
@old_exp.push(@actors.now_exp)
@old_level.push(@actors.level)
end
@old_gold = $game_party.gold
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
#self.contents.draw_text(6, 0, 32, 14, $data_system.words.hp + "")
#self.contents.draw_text(6, 14, 32, 14, $data_system.words.sp + "")
self.contents.draw_text(6, 28, 32, 14, "")
#self.contents.draw_text(6, 42, 32, 14, $data_system.words.gold + "")
self.contents.font.color = normal_color
#Images
case @actors.size
when 1
bitmap = RPG::Cache.picture("HUD Graphic")
self.contents.blt(0, 0, bitmap, Rect.new(0, 10, 500, 500))
when 2
bitmap = RPG::Cache.picture("HUD Graphic2")
self.contents.blt(0, 0, bitmap, Rect.new(0, 10, 500, 500))
when 3
bitmap = RPG::Cache.picture("HUD Graphic2")
self.contents.blt(0, 0, bitmap, Rect.new(0, 10, 500, 500))
when 4
bitmap = RPG::Cache.picture("HUD Graphic3")
self.contents.blt(0, 0, bitmap, Rect.new(0, 10, 640, 500))
when 5
bitmap = RPG::Cache.picture("HUD Graphic3")
self.contents.blt(0, 0, bitmap, Rect.new(0, 10, 640, 500))
end
#bitmap = RPG::Cache.picture("HUD Graphic")
#self.contents.blt(0, 0, bitmap, Rect.new(0, 10, 500, 500))
bitmap = RPG::Cache.icon("HP Symbol")
self.contents.blt(3, 10, bitmap, Rect.new(0, 0, 24, 24))
bitmap = RPG::Cache.icon("SP Symbol")
self.contents.blt(3, 30, bitmap, Rect.new(0, 0, 24, 24))
bitmap = RPG::Cache.icon("EXP Symbol")
self.contents.blt(3, 50, bitmap, Rect.new(0, 0, 24, 24))
bitmap = RPG::Cache.icon("Hero")
self.contents.blt(25, 67, bitmap, Rect.new(0, 0, 24, 24))
if $game_switches[99] == true
if $game_variables[99] == 0
self.contents.draw_text(x, y, 210, 14, $game_party.item_number[1])
elsif $game_variables[98] == 1
self.contents.draw_text(x, y, 210, 14, $game_party.item_number(2))
elsif $game_variables[98] ==2
self.contents.draw_text(x, y, 110, 14, @actors.name)
end
end
x = 32
for i in 0...@actors.size
y = 6
self.contents.draw_text(x, y, 110, 14, @actors.name)
self.contents.draw_text(x, y, 110, 14, "Lv#{@actors.level}", 2)
y += 16
draw_hp_bar(@actors, x, y, 112, 3)
y += 19
draw_sp_bar(@actors, x, y, 112, 3)
y += 19
draw_exp_bar(@actors, x, y, 112, 3)
y += 19
x += 130
end
x = 32
self.contents.draw_text(45, 73, 110, 14, $game_party.gold.to_s)
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
if @actors.size != $game_party.actors.size
@actors = []
for i in 0...$game_party.actors.size
@actors.push($game_party.actors)
end
refresh
return
end
for i in 0...@actors.size
if @old_hp != @actors.hp or
@old_sp != @actors.sp or
@old_exp != @actors.now_exp or
@old_level != @actors.level or
@old_gold != $game_party.gold
refresh
@old_hp = @actors.hp
@old_sp = @actors.sp
@old_exp = @actors.now_exp
@old_level = @actors.level
@old_gold = $game_party.gold
end
end
end
#--------------------------------------------------------------------------
# * Draw HP Bar
#--------------------------------------------------------------------------
def draw_hp_bar(actor, x, y, length, thick)
width = length
height = 3
c1 = Color.new(100, 255,100, 255)
c2 = Color.new(0, 0, 0, 0)
e1 = actor.hp
e2 = actor.maxhp
self.contents.fill_rect(x-1, y - 1, width+2, height + 3, Color.new(0, 0, 0, 0))
self.contents.fill_rect(x, y, width, height + 1, Color.new(0, 0, 0, 255))
w = width * e1 / e2
for i in 0..height
r = c1.red + (c2.red - c1.red) * (height -i)/height + 0 * i/height
g = c1.green + (c2.green - c1.green) * (height -i)/height + 0 * i/height
b = c1.blue + (c2.blue - c1.blue) * (height -i)/height + 0 * i/height
a = c1.alpha + (c2.alpha - c1.alpha)* (height -i)/height + 255 * i/height
self.contents.fill_rect(x, y+i, w, 1, Color.new(r, g, b, a))
end
end
#--------------------------------------------------------------------------
# * Draw SP Bar
#--------------------------------------------------------------------------
def draw_sp_bar(actor, x, y, length, thick)
width = length
height = 3
c1 = Color.new(128, 255, 255, 128)
c2 = Color.new(0, 0, 0, 0)
e1 = actor.sp
e2 = actor.maxsp
self.contents.fill_rect(x-1, y - 1, width+2, height + 3, Color.new(0, 0, 0, 0))
self.contents.fill_rect(x, y, width, height + 1, Color.new(0, 0, 0, 255))
w = width * e1 / e2
for i in 0..height
r = c1.red + (c2.red - c1.red) * (height -i)/height + 0 * i/height
g = c1.green + (c2.green - c1.green) * (height -i)/height + 0 * i/height
b = c1.blue + (c2.blue - c1.blue) * (height -i)/height + 0 * i/height
a = c1.alpha + (c2.alpha - c1.alpha)* (height -i)/height + 255 * i/height
self.contents.fill_rect(x, y+i, w, 1, Color.new(r, g, b, a))
end
end
#--------------------------------------------------------------------------
# * Draw EXP Bar
#--------------------------------------------------------------------------
def draw_exp_bar(actor, x, y, length, thick)
width = length
height = 3
c1 = Color.new(255, 128, 255, 255)
c2 = Color.new(0, 0, 0, 0)
e1 = actor.now_exp
e2 = actor.next_exp
if actor.next_exp == 0
e1 = 1
e2 = 1
end
self.contents.fill_rect(x-1, y - 1, width+2, height + 3, Color.new(0, 0, 0, 0))
self.contents.fill_rect(x, y, width, height + 1, Color.new(0, 0, 0, 255))
w = width * e1 / e2
for i in 0..height
r = c1.red + (c2.red - c1.red) * (height -i)/height + 0 * i/height
g = c1.green + (c2.green - c1.green) * (height -i)/height + 0 * i/height
b = c1.blue + (c2.blue - c1.blue) * (height -i)/height + 0 * i/height
a = c1.alpha + (c2.alpha - c1.alpha)* (height -i)/height + 255 * i/height
self.contents.fill_rect(x, y+i, w, 1, Color.new(r, g, b, a))
end
end
end
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
# This class performs map screen processing.
#==============================================================================
class Scene_Map
#--------------------------------------------------------------------------
# * Object Aliasing
#--------------------------------------------------------------------------
alias hud_scene_map_main main
alias hud_scene_map_update update
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def main
@HUD = Window_HUD.new
hud_scene_map_main
@HUD.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
if $game_switches[0001] == false
if @HUD.visible == true
@HUD.visible = false
end
end
if $game_switches[0001] == true
if @HUD.visible == false
@HUD.visible = true
end
end
@HUD.update
hud_scene_map_update
end
end