Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ###############################################################################
- # DKP Resource Hud v1.0
- # Platform: VX Ace
- # Author: Dark Paladin
- # Description: A resources hud for my city builder series.
- # Terms of use: You MAY use this script for your Non-commercial Projects.
- # You MAY use this script for Commercial projects without my permission.
- # Credit is appreciated but not needed.
- # This script requires: Catchext
- # As of this moment there is not a switch to turn it on/off. I may add one in
- # the future but not any time soon.
- ###############################################################################
- # Instructions
- #------------------------------------------------------------------------------
- # To install this script, open up your script editor and copy/paste this script
- # to an open slot below Materials but above Main. Remember to save.
- # Place the "hud" image in Graphics/DPmenu/Hud/ Creating folders when needed.
- #
- # ** Only for RPG Maker VX Ace. **
- #==============================================================================
- module Hud_config
- #==============================================================================
- # ** Dkp Hud
- #==============================================================================
- #------------------------------------------------------------------------------
- # Config Area
- #------------------------------------------------------------------------------
- Var1 = 1 # Variable ID #1
- Var2 = 2 # Variable ID #2
- Var3 = 3 # Variable ID #3
- Var4 = 4 # Variable ID #4
- Var1_Icon = 298 # Variable Icon ID #1
- Var2_Icon = 331 # Variable Icon ID #2
- Var3_Icon = 359 # Variable Icon ID #3
- Var4_Icon = 117 # Variable Icon ID #4
- Hud_picture = "hud" # Name of file for hud background
- Gold_Icon = 361 # Gold Icon ID
- Font_Color = 3 # Font Color
- Opacity = 50 # Opacity of the default window
- end
- #############DO NOT EDIT PAST HERE UNLESS YOU KNOW WHAT YOUR DOING#############
- #------------------------------------------------------------------------------
- # Initialize
- #------------------------------------------------------------------------------
- class Scene_Map < Scene_Base
- alias dkp_hud_window_start start
- def start
- dkp_hud_window_start
- create_hud_window
- end
- alias dkp_hud_window_update update
- def update
- dkp_hud_window_update
- @hud_window.refresh
- @hud_window2.refresh
- @hud_window3.refresh
- @hud_window4.refresh
- @hud_window5.refresh
- end
- def create_hud_window
- @hud_back = Dkp_hudback.new
- @hud_window = Dkp_hud1.new
- @hud_window.x = 0
- @hud_window.y = -10
- @hud_window2 = Dkp_hud2.new
- @hud_window2.x = 105
- @hud_window2.y = -10
- @hud_window3 = Dkp_hud3.new
- @hud_window3.x = 210
- @hud_window3.y = -10
- @hud_window4 = Dkp_hud4.new
- @hud_window4.x = 320
- @hud_window4.y = -10
- @hud_window5 = Dkp_hud5.new
- @hud_window5.x = 435
- @hud_window5.y = -10
- end
- def dispose_hud_window
- @hud_window.dispose
- @hud_window2.dispose
- @hud_window3.dispose
- @hud_window4.dispose
- @hud_window5.dispose
- end
- def refresh
- contents.clear
- create_hud_window
- end
- end
- class Dkp_hudback < Window_Base
- def initialize
- super(0, 0, window_width, fitting_height(0.4))
- self.opacity = Hud_config::Opacity
- refresh
- end
- def refresh
- create_image_hud
- end
- def window_width
- return 544
- end
- def create_image_hud
- @hud_sprite = Sprite.new
- bitmap = Cachext.dphud(Hud_config::Hud_picture)
- @hud_sprite.bitmap = bitmap
- @hud_sprite.x = 0
- @hud_sprite.y = 0
- end
- def update
- refresh
- end
- end
- class Dkp_hud1 < Window_Base
- def initialize
- super(0, 0, window_width, fitting_height(1))
- self.opacity = 0
- refresh
- end
- def refresh
- contents.clear
- draw_var(var, draw_icon(Hud_config::Var1_Icon, 0, 0, enabled = true), 4, 0, contents.width - 10)
- end
- def draw_var(value, unit, x, y, width)
- def var_color; text_color(Hud_config::Font_Color); end;
- cx = text_size(unit).width
- change_color(var_color)
- draw_text(x, y, width - cx - 2, line_height, value, 2)
- change_color(var_color)
- draw_text(x, y, width, line_height, unit, 2)
- end
- def window_width
- return 120
- end
- def var
- $game_variables[Hud_config::Var1]
- end
- def update
- refresh
- end
- end
- class Dkp_hud2 < Window_Base
- def initialize
- super(0, 0, window_width, fitting_height(1))
- self.opacity = 0
- refresh
- end
- def refresh
- contents.clear
- draw_var(var, draw_icon(Hud_config::Var2_Icon, 0, 0, enabled = true), 4, 0, contents.width - 10)
- end
- def draw_var(value, unit, x, y, width)
- def var_color; text_color(Hud_config::Font_Color); end;
- cx = text_size(unit).width
- change_color(var_color)
- draw_text(x, y, width - cx - 2, line_height, value, 2)
- change_color(var_color)
- draw_text(x, y, width, line_height, unit, 2)
- end
- def window_width
- return 120
- end
- def var
- $game_variables[Hud_config::Var2]
- end
- end
- class Dkp_hud3 < Window_Base
- def initialize
- super(0, 0, window_width, fitting_height(1))
- self.opacity = 0
- refresh
- end
- def refresh
- contents.clear
- draw_var(var, draw_icon(Hud_config::Var3_Icon, 0, 0, enabled = true), 4, 0, contents.width - 10)
- end
- def draw_var(value, unit, x, y, width)
- def var_color; text_color(Hud_config::Font_Color); end;
- cx = text_size(unit).width
- change_color(var_color)
- draw_text(x, y, width - cx - 2, line_height, value, 2)
- change_color(var_color)
- draw_text(x, y, width, line_height, unit, 2)
- end
- def window_width
- return 120
- end
- def var
- $game_variables[Hud_config::Var3]
- end
- end
- class Dkp_hud4 < Window_Base
- def initialize
- super(0, 0, window_width, fitting_height(1))
- self.opacity = 0
- refresh
- end
- def refresh
- contents.clear
- draw_var(var, draw_icon(Hud_config::Var4_Icon, 0, 0, enabled = true), 4, 0, contents.width - 10)
- end
- def draw_var(value, unit, x, y, width)
- def var_color; text_color(Hud_config::Font_Color); end;
- cx = text_size(unit).width
- change_color(var_color)
- draw_text(x, y, width - cx - 2, line_height, value, 2)
- change_color(var_color)
- draw_text(x, y, width, line_height, unit, 2)
- end
- def window_width
- return 120
- end
- def var
- $game_variables[Hud_config::Var4]
- end
- end
- class Dkp_hud5 < Window_Base
- def initialize
- super(0, 0, window_width, fitting_height(1))
- self.opacity = 0
- refresh
- end
- def refresh
- contents.clear
- draw_var(var, draw_icon(Hud_config::Gold_Icon, 0, 0, enabled = true), 4, 0, contents.width - 10)
- end
- def draw_var(value, unit, x, y, width)
- def var_color; text_color(Hud_config::Font_Color); end;
- cx = text_size(unit).width
- change_color(var_color)
- draw_text(x, y, width - cx - 2, line_height, value, 2)
- change_color(var_color)
- draw_text(x, y, width, line_height, unit, 2)
- end
- def window_width
- return 120
- end
- def var
- $game_party.gold
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement