Demo – Version 1.7 > (Demo uses old version)
This demo uses Tsukihime’s Rotate Formation script found here.
#------------------------------------------------------------------------------#
# Galv's Explorer's HUD
#------------------------------------------------------------------------------#
# For: RPGMAKER VX ACE
# Version 2.0
#------------------------------------------------------------------------------#
# 2013-01-31 - Version 2.0 - Fixed a bug with not drawing TP in battle option
# 2013-01-30 - Version 1.9 - Missed some things fixing the no actors crash
# 2013-01-24 - Version 1.8 - Fixed crash if no actors in party
# 2012-11-07 - Version 1.7 - some optimisation thanks to Niclas
# 2012-11-06 - Version 1.6 - more bug fixes
# 2012-11-06 - Version 1.5 - fixed so HUD doesn't appear in battle
# 2012-11-06 - Version 1.4 - added tp option and functionality
# 2012-11-06 - Version 1.3 - added options to disable windows
# 2012-11-06 - Version 1.2 - fixed map name bug not updating
# 2012-11-06 - Version 1.1 - changed z values of HUD
# 2012-11-06 - Version 1.0 - release
#------------------------------------------------------------------------------#
# A HUD that displays information that might be useful for an RPG with a lot of
# exploring. Can toggle it on or off when needed with a button. The info
# displayed is the actor leading the party, so it works well with a script
# such as Tsukihime's Rotate Formation to switch the lead actor with the press
# of a button.
#------------------------------------------------------------------------------#
# Visit: http://xtsukihime.wordpress.com/rmvxa-scripts/
# To find latest versions of Tsukihime's scripts.
#------------------------------------------------------------------------------#
($imported ||= {})["Galv_Explorers_Hud"] = true
module Galvs_Hud
#------------------------------------------------------------------------------#
# SCRIPT SETUP OPTIONS
#------------------------------------------------------------------------------#
# GENERAL
TOGGLE_SWITCH = 1 # Switch ID. When ON, hud is visible. When OFF its not
ACTIVATE_BUTTON = :Z # Button to toggle hud visibility switch. (:Z is "D")
# to disable make ACTIVATE_BUTTON = nil
HUD_SKIN = "Window" # A windowskin to apply to the HUD. Located in
# /Graphics/System/
# Change to "Window" to use normal skin.
SHOW_EQUIP = 0 # The equipment piece shown. This is the slot ID.
# 0 = weapon
# 1 = shield
# 2 = head
# 3 = body
# 4 = accessory
SHOW_TP = true # Show TP in top bar.
# BOTTOM BAR
SHOW_GOLD = true # display gold in bottom bar
SHOW_MAPNAME = true # display map display name in bottom bar
SHOW_COORDS = true # display x,y coordinates in bottom bar
REMOVE_WINDOWS = false # This applies for above options that are set to false
# true = windows removed. false = windows blank
#------------------------------------------------------------------------------#
# SCRIPT SETUP OPTIONS
#------------------------------------------------------------------------------#
end
class Scene_Map < Scene_Base
alias galv_hud_create_spriteset create_spriteset
def create_spriteset
galv_hud_create_spriteset
create_hud
end
alias galv_hud_update update
def update
galv_hud_update
check_trigger
update_hud if !@galv_hud.nil? && !scene_changing?
end
def update_hud
@galv_hud.update
end
def create_hud
@galv_hud = Galv_Hud.new(@viewport2)
end
def check_trigger
if Input.trigger?(Galvs_Hud::ACTIVATE_BUTTON)
$game_switches[Galvs_Hud::TOGGLE_SWITCH] ^= true
end
end
alias galv_hud_dispose_spriteset dispose_spriteset
def dispose_spriteset
galv_hud_dispose_spriteset
@galv_hud.dispose
end
end
class Galv_Hud < Scene_Base
def initialize(viewport)
super(viewport)
create_gold_window
create_coords_window
create_location_window
create_status_window
$game_temp.hud_update[4] = []
$game_temp.hud_update[6] = ""
$game_temp.hud_update[7] = 0 #$game_party.members[0].tp
end
def create_status_window
@status_window = Window_HudStatus.new
@status_window.x = 0
@status_window.y = 0
@status_window.z = @status_window.z - 10
@status_window.hide if !$game_switches[Galvs_Hud::TOGGLE_SWITCH]
end
def create_gold_window
@gold_window = Window_QuickGold.new
@gold_window.x = 0
@gold_window.y = Graphics.height - @gold_window.height
@gold_window.z = @gold_window.z - 10
@gold_window.hide if !$game_switches[Galvs_Hud::TOGGLE_SWITCH]
end
def dispose
@location_window.dispose
@gold_window.dispose
@status_window.dispose
@coords_window.dispose
end
def create_coords_window
@coords_window = Window_Coords.new
@coords_window.x = Graphics.width - @coords_window.width
@coords_window.y = Graphics.height - @coords_window.height
@coords_window.z = @coords_window.z - 10
@coords_window.hide if !$game_switches[Galvs_Hud::TOGGLE_SWITCH]
end
def create_location_window
@location_window = Window_Location.new
@location_window.x = @gold_window.width
@location_window.y = Graphics.height - @location_window.height
@location_window.z = @location_window.z - 10
@location_window.hide if !$game_switches[Galvs_Hud::TOGGLE_SWITCH]
end
def update
check_need_refresh
hide_windows if !$game_switches[Galvs_Hud::TOGGLE_SWITCH]
show_windows if $game_switches[Galvs_Hud::TOGGLE_SWITCH]
@coords_window.refresh if Galvs_Hud::SHOW_COORDS
end
def check_need_refresh
a = $game_party.members[0]
return if a.nil?
if $game_temp.hud_update != [a.id,a.hp,a.mp,a.exp,a.state_icons,$game_party.gold,$game_map.display_name,a.tp]
refresh_windows
else
return
end
end
def refresh_windows
@status_window.refresh
@gold_window.refresh
@location_window.refresh
$game_temp.hud_update[5] = $game_party.gold
end
def hide_windows
if @status_window.visible
@gold_window.hide
@location_window.hide
@coords_window.hide
@status_window.hide
end
end
def show_windows
if !@status_window.visible
@gold_window.show
@location_window.show
@coords_window.show
@status_window.show
end
end
end # Galv_Hud
class Window_Location < Window_Base
def initialize
super(0, 0, window_width, fitting_height(1))
self.openness = 255
self.windowskin = Cache.system(Galvs_Hud::HUD_SKIN)
self.opacity = 0 if !Galvs_Hud::SHOW_MAPNAME && Galvs_Hud::REMOVE_WINDOWS
refresh
end
def window_width
return (Graphics.width - 130 - 130)
end
def refresh
$game_temp.hud_update[6] = $game_map.display_name
return if !Galvs_Hud::SHOW_MAPNAME
contents.clear
draw_text((contents.width / 2) - ((locate_text.length * 10) / 2), 0, Graphics.width / 2, line_height, locate_text)
end
def locate_text
$game_map.display_name
end
def open
refresh
super
end
end # Window_Location < Window_Base
class Window_Coords < Window_Base
def initialize
super(0, 0, window_width, fitting_height(1))
self.openness = 255
self.windowskin = Cache.system(Galvs_Hud::HUD_SKIN)
self.opacity = 0 if !Galvs_Hud::SHOW_COORDS && Galvs_Hud::REMOVE_WINDOWS
refresh
end
def window_width
return 130
end
def refresh
return if !Galvs_Hud::SHOW_COORDS
contents.clear
change_color(normal_color)
draw_text(15, 0, contents.width, line_height, $game_player.x.to_s)
draw_text(70, 0, contents.width, line_height, $game_player.y.to_s)
change_color(system_color)
draw_text(0, 0, window_width, line_height, "X")
draw_text(55, 0, window_width, line_height, "Y")
end
def open
refresh
super
end
end # Window_Coords < Window_Base
class Window_QuickGold < Window_Base
def initialize
super(0, 0, window_width, fitting_height(1))
self.openness = 255
self.windowskin = Cache.system(Galvs_Hud::HUD_SKIN)
self.opacity = 0 if !Galvs_Hud::SHOW_GOLD && Galvs_Hud::REMOVE_WINDOWS
refresh
end
def window_width
return 130
end
def refresh
return if !Galvs_Hud::SHOW_GOLD
contents.clear
draw_currency_value(value, currency_unit, 4, 0, contents.width - 8)
end
def value
$game_party.gold
end
def currency_unit
Vocab::currency_unit
end
def open
refresh
super
end
end # Window_QuickGold < Window_Base
class Window_HudStatus < Window_Selectable
def initialize
super(0, 0, window_width, window_height)
refresh if $game_party.leader
self.openness = 255
self.windowskin = Cache.system(Galvs_Hud::HUD_SKIN)
end
def window_width
Graphics.width
end
def window_height
fitting_height(visible_line_number)
end
def visible_line_number
return 2
end
def item_max
1
end
def refresh
contents.clear
draw_item(0)
draw_equips($game_party.members[0].equips[Galvs_Hud::SHOW_EQUIP].id) unless $game_party.members[0].equips[Galvs_Hud::SHOW_EQUIP].nil?
end
def draw_item(index)
actor = $game_party.battle_members[index]
draw_basic_area(basic_area_rect(index), actor)
draw_gauge_area(gauge_area_rect(index), actor)
draw_face(actor.face_name, actor.face_index, x, y - 30, actor.hp > 0)
draw_actor_level(actor, Graphics.width - 90, y + line_height * 1)
$game_temp.hud_update[0] = $game_party.members[0].id
end
def draw_equips(index)
if Galvs_Hud::SHOW_EQUIP <= 0
item = $data_weapons[index]
else
item = $data_armors[index]
end
if item
rect = item_rect(1)
rect.width -= 4
draw_item_name(item, rect.x + 100, rect.y, $game_party.members[0].hp > 0)
end
end
def basic_area_rect(index)
rect = item_rect_for_text(index)
rect.width -= gauge_area_width + 10
rect
end
def gauge_area_rect(index)
rect = item_rect_for_text(index)
rect.x += rect.width - gauge_area_width
rect.width = gauge_area_width
rect
end
def gauge_area_width
return 220
end
def draw_basic_area(rect, actor)
draw_actor_icons(actor, rect.x + 104, rect.y, rect.width - 104)
$game_temp.hud_update[4] = $game_party.members[0].state_icons
end
def draw_gauge_area(rect, actor)
if $data_system.opt_display_tp
draw_gauge_area_with_tp(rect, actor)
else
draw_gauge_area_without_tp(rect, actor)
end
end
def draw_gauge_area_with_tp(rect, actor)
draw_actor_hp(actor, rect.x - 60, rect.y, 132)
draw_actor_tp(actor, rect.x + 82, rect.y + 25, 64) unless !Galvs_Hud::SHOW_TP
draw_actor_mp(actor, rect.x + 82, rect.y, 64)
draw_actor_xp(actor, rect.x + 156, rect.y, 64)
$game_temp.hud_update[1] = $game_party.members[0].hp
$game_temp.hud_update[2] = $game_party.members[0].mp
$game_temp.hud_update[3] = $game_party.members[0].exp
$game_temp.hud_update[7] = $game_party.members[0].tp
end
def draw_gauge_area_without_tp(rect, actor)
draw_actor_hp(actor, rect.x - 60, rect.y, 132)
draw_actor_mp(actor, rect.x + 82, rect.y, 64)
draw_actor_xp(actor, rect.x + 156, rect.y, 64)
$game_temp.hud_update[1] = $game_party.members[0].hp
$game_temp.hud_update[2] = $game_party.members[0].mp
$game_temp.hud_update[3] = $game_party.members[0].exp
$game_temp.hud_update[7] = $game_party.members[0].tp
end
def draw_actor_xp(actor, x, y, width = 124)
draw_gauge(x, y, width, (actor.exp.to_f - actor.class.exp_for_level(actor.level)) / (actor.class.exp_for_level(actor.level + 1) - actor.class.exp_for_level(actor.level)), text_color(6), text_color(14))
change_color(system_color)
draw_text(x, y, 30, line_height, "EXP")
end
end # Window_HudStatus < Window_Selectable
class Sprite_Timer < Sprite
alias galv_hud_update_position update_position
def update_position
galv_hud_update_position
self.y = 70 if $game_switches[Galvs_Hud::TOGGLE_SWITCH]
end
end # Sprite_Timer < Sprite
class Window_MapName < Window_Base
alias galv_hud_update update
def update
galv_hud_update
update_position if $game_map.name_display
end
def update_position
if $game_switches[Galvs_Hud::TOGGLE_SWITCH]
self.y = 70
else
self.y = 0
end
end
end # Window_MapName < Window_Base
class Game_Temp
attr_accessor :hud_update
alias galv_hud_initialize initialize
def initialize
galv_hud_initialize
@hud_update = []
end
end # Game_Temp
hey, it works great.
but how to remove the top bar hud ?
i only want to show the botton bar hud ( gold, mapname, and coordinates )
thanks
Removing the top bar is not part of the script functionality. You’ll need to edit the script to do that.
can i make this as request for you ? or maybe could you give me some references for displaying only gold hud ?
i really need that.
Sorry, I’m very busy at the moment and not currently taking requests. I recommend requesting a script that does what you are after in one of the popular forums
Hey galv, i need a help here, how do i disable the HUD to show when i teleport from one map to another ? i have a event that teleports my character, and the HUD keeps showing up. Thanks.
The hud should be invisible while the specified switch is off
There’s no way your HUD shows up when is teleporting or changing maps ? I couldnt understand well what you’ve said… I have an event that teleports my hero to another map, and the HUD shows up. I want to know if there’s some part of your script that disables it… Idk. I was looking in your script and found some refreshes variables but as i cant script i tried some stuff but ended up screwing your script lol. So i came here to ask you help ^^ Thanks. Waiting for answer !! =D
In the script setup options:
TOGGLE_SWITCH = 1 # Switch ID. When ON, hud is visible. When OFF its not
It means if switch 1 in your game is ON then the hud is visible. If switch 1 in your game is OFF then the hud is not visible.
Here’s a checklist of things to try to error trap your problem.
Oh God, thanks Galv’s, thanks a lot ^^
It’s solved now, i though this line was different. I mean, i though this would disable the HUD AT ALL, like, when i press D it would never shows up, and because of that i didnt tried to mess with it… But thanks a lot ^^
I’m wracking my brain trying to change the box holding xy cords to show instead current skill equipped. any ideas? I been on this 16 hrs. btw the explorer hud is awesome. its been something I needed
Sorry, I don’t have time to do modifications for people. I recommend asking in a forum for help.
I put the script in, but nothing shows up in game. Was there something I was supposed to do? I’m not really using anything else that would counter your script.
Need to read the instructions and settings :)
TOGGLE_SWITCH = 1 # Switch ID. When ON, hud is visible. When OFF its not
Choose a switch number in the settings to use Control Switches to turn it on or off.
Hey, Galv. I have a question. I can’t seem to figure out how to display the actor’s name on the HUD, right above the weapon they have equipped. Is there some way to do that?
If you modify the script, yeah but I dont have time for requests, sorry :(
Hey Galv! I really like your scripts and customize them for my needs, but theres one thing i dont get working. I use this script and the Quick Weapon Swap script, if I switch my weapons with Q or W the HUD doesn’t update, until i open the menu or trigger something else, is there a way to update it the HUD in real time? Or everytime i press Q or W or something.
Some changes I think would have to be made for that to work by the sound of it. I recommend asking in a forum, it’s easier to post code there and someone might get to it before I have time to look into it :D
Allright, I’ll ask there. Thanks for your fast reply ♥
Where to put script
Below “Materials”, above “Main” in the script manager.
Your HUD turns itself back ON after battle, even when it was turned OFF before the battle.
Please confirm that the “Toggle Switch” you assigned wasn’t turned on/off during that battle.
Hi Galv!
I got a syntax error on line 39 when using this script. Can you fix it?
“Script “Galv Explorer HUD” line 39: SyntaxError occured.
Unexpected tIDENTIFIER, expecting keyword_end
…TOGGLE_SWITCH = 5 #Switch ID. When ON hud is…”
try copying the script again, you might have missed some of the code. Try copying from the demo also
Oh, my bad,I copy-pasted only half of your script.. It’s worked fine now..
Thanks for replying :D
Amazing! 10/10! You can also edit the script to display just the gold when your in a town and then the full hud when you enter the wilderness. Thank you very much!
This is going to sound like the biggest n00b question EVER, but how do I go about setting the switch for this script? where do I find the switch ID?
When you use the ‘Control Switches’ event command, there is a number next to them. That’s the switch ID (but you don’t need to 00 before the number)
Hey, Galv
Really like the script
But, I got a question
Is there a way to put sound into the HUD being activated or Deactivated?
For example:
Player presses D, plays a sound effect, and the Hud opens up
Player Presses D, plays a sound effect, and the HUDS shuts down.
It’s not THAT big of deal if not, but I just wanted to ask.
Very possible, you would have to modify the code, though. Unfortunately I do not have time to do this but I recommend asking in a forum for someone to add it for you
—————————
Kate’s Test
—————————
Script ‘add on’ line 217: NoMethodError occurred.
undefined method `galv_hud’ for #
—————————
OK
—————————
I don’t know why this is happening, it only when i run out of health normally or call game over
dying to bombs doesn’t
Try recopying the script – that error looks like the code wasn’t pasted in right.
Make sure to start a new game after adding the script.