viewing paste Simple Hud | Ruby

Posted on the | Last edited on
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
#===== Rpg Makver VX ACE Script =============================
#= Simple Hud
#===== By: ==================================================
#= lilcooldude69
#===== Current Version: =====================================
#= 1.0
#===== Compatible With: =====================================
#= Rpg Maker VX ACE
#===== Description: =========================================
#= Sells items useful for 2-2 Classes
#===== Additional Comments: =================================
#=
#============================================================
 
 
 
module Hud_config
#Configuration
SWITCH = 1 #the number of the switched used to make it visible Example: if this is 1 then Switch 001 will turn on the hud.
EXPTERM = "Exp" #Term used for The Exp Bar
GOLD = "G" #Term used for the Gold, You may have to make adjustments below if > 1 character
OPACITY = 70 #used for the opacity of the window, Mess with this to your liking :P
#end config
end
#=====DO NOT EDIT PAST HERE UNLESS YOU KNOW WHAT YOUR DOING======#
#=================EXCLUDING WHAT WAS SAID ABOVE==================#
 
include Hud_config
 
class Window_Hud < Window_Base
#----------------------------------------------------
# * Object Initialization
#----------------------------------------------------
def initialize
super(0,0, 125,125)
create_contents
self.visible = $game_switches[SWITCH]
@actor = $game_party.members[0]
refresh
end
 
def exp_gauge_color1; text_color(31); end;
def exp_gauge_color2; text_color(27); end;
 
#----------------------------------------------------
# * Refresh
#----------------------------------------------------
def refresh
self.contents.clear
contents.clear
draw_window_content
 
end
 
#----------------------------------------------------
# * Draw Window Contents * Drawing of all the contents gold, hp bar, etc
#----------------------------------------------------
def draw_window_content
@gold = $game_party.gold
@level = @actor.level
@hp = @actor.hp
@mp = @actor.mp
@tp = @actor.tp
@exp = @actor.exp
draw_face(@actor.face_name, @actor.face_index, 0, 0, enable = false)
contents.font.size = 20
draw_actor_name(@actor, 0, 0)
draw_actor_level(@actor, 45, 0)
draw_actor_hp(@actor, 0, 17, 48)
draw_exp(@actor, 0, 60, 102)
draw_actor_mp(@actor, 55, 17, 48)
draw_actor_tp(@actor, 0, 37, 102)
#==========Make the Adjustment here if you edited the GOLD variable to be longer than 1 Character===============
contents.font.size = Font.default_size
draw_currency_value(@gold, GOLD, 0, 82, 102)
#draw_currency_value(Gold Variable, Term Variable, X-pos, Y-Pos, Width) change the width if you make the term longer than 1 char
#example, draw_currency_value(@gold, GOLD, 0, 155, 110)
#==========Make the Adjustment here if you edited the GOLD variable to be longer than 1 Character===============
end
 
#-----------------------------------------------------
# * Update * used to keep things up to date
#-----------------------------------------------------
def update
super
self.visible = $game_switches[SWITCH]
return if !self.visible
if @level != @actor.level or @hp != @actor.hp or @mp != @actor.mp or
@tp != @actor.tp or @exp != @actor.exp or @gold != $game_party.gold
refresh
end
end
 
#-----------------------------------------------------
# * Custom Definition for the experience bar free to use if you like
#-----------------------------------------------------
def draw_exp(actor, x, y, width = 124)
s1 = @actor.max_level? ? "---------" : @actor.exp
s2 = @actor.max_level? ? "---------" : @actor.next_level_exp - @actor.exp
if @actor.max_level? ? draw_gauge(x, y, width, 1, exp_gauge_color1, exp_gauge_color2)
:
draw_gauge(x, y, width,(((actor.exp.to_f/100) / (actor.next_level_exp.to_f/100)) * 100),
exp_gauge_color1, exp_gauge_color2)
end
change_color(system_color)
draw_text(x, y, 30, line_height, EXPTERM)
change_color(text_color(27))
if @actor.max_level? ? draw_text(x + width - 72, y, 72, line_height, "------------", 2)
:
draw_text(x + width - 72, y, 72, line_height, actor.next_level_exp.to_i - actor.exp.to_i, 2)
end
end
end
 
#------------------------------------------------------
# * Scene_Map Class, For keeping it on the map
#------------------------------------------------------
class Scene_Map < Scene_Base
alias start_window start
alias term_window terminate
alias update_window update
def start
start_window
@winhud = Window_Hud.new
update
end
def terminate
@winhud.dispose
term_window
end
def update
update_window
@winhud.update
end
end
Viewed 6680 times, submitted by lilcooldude69.