Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- # Kingdom Age of Empires HUD
- # Por King Gerar
- #-------------------------------------------------------------------------------
- # Este script permite a visalização de uma HUD na tela mediante a ativação de
- # uma switch. Essa HUD permite mostrar 5 valores, com ícones e nome.
- # Este script foi baseado no sistema de matéria-prima de Age of Empires e no
- # script "HUD com Variáveis Estilo Age of Empires 1" de autoria de Alucard_2.
- #===============================================================================
- module KAoE_HUD_Config
- Swch_Eneable = 1 # ID da Switch que ativa/desativa a HUD.
- Wdw_Default = "Window" # Gráfico da window utilizada.
- SystemFont = "Bauhaus" # Fonte do menu.
- FontSize = 17 # Tamanho da fonte.
- Icon_Gold = 360 # Ícone do ouro.
- Icon_Wood = 331 # Ícone da madeira.
- Icon_Stone = 350 # Ícone da pedra.
- Icon_Metal = 342 # Ícone do metal.
- Icon_Pop = 121 # Ícone da população.
- Txt_Gold = "Ouro:" # Texto do ouro.
- Txt_Wood = "Madeira:" # Texto da madeira.
- Txt_Stone = "Pedra:" # Texto da pedra.
- Txt_Metal = "Cristal:" # Texto do metal.
- Txt_Pop = "População:" # Texto da população.
- #-----------------------------------------------------------------------------
- # Defina as variáveis utilizadas. Coloque o ID.
- #-----------------------------------------------------------------------------
- Var_Gold = 10 # Ouro.
- Var_Wood = 11 # Madeira.
- Var_Stone = 12 # Pedra.
- Var_Metal = 13 # Metal.
- Var_Pop = 14 # População.
- Var_MaxPop = 15 # População máxima.
- #-----------------------------------------------------------------------------
- # Defina a cor das escritas.
- #-----------------------------------------------------------------------------
- Clr_Main = Color.new(255, 255, 0, 255)
- #-----------------------------------------------------------------------------
- # A opção abaixo define a posição da HUD na tela.
- # 0 = Horizontal superior 1 = Horizontal inferior
- # 2 = Vertical esquerda 3 = Vertical direita
- #-----------------------------------------------------------------------------
- Position = 3
- end
- #===============================================================================
- # Window_KingdomAoEHUD
- #-------------------------------------------------------------------------------
- # Esta classe exibe uma HUD no mapa com a quantidade das matérias-primas em
- # posse.
- #===============================================================================
- class Window_KingdomAoEHUD < Window_Base
- include KAoE_HUD_Config
- #-----------------------------------------------------------------------------
- # Inicialização do processo.
- #-----------------------------------------------------------------------------
- def initialize
- super(0, 0, Graphics.width, 80) if Position == 0
- super(0, 336, Graphics.width, 80) if Position == 1
- super(0, 0, 96, Graphics.height) if Position == 2
- super(448, 0, 96, Graphics.height) if Position == 3
- self.windowskin = Cache.system(Wdw_Default)
- self.contents.font.name = SystemFont
- self.contents.font.size = FontSize
- self.visible = $game_switches[Swch_Eneable]
- update
- end
- #-----------------------------------------------------------------------------
- # Criação das informações.
- #-----------------------------------------------------------------------------
- def draw_contents
- @materia = Array.new(5)
- @text = [Txt_Gold, Txt_Wood, Txt_Stone, Txt_Metal, Txt_Pop]
- @icon = [Icon_Gold, Icon_Wood, Icon_Stone, Icon_Metal, Icon_Pop]
- @value = [Var_Gold, Var_Wood, Var_Stone, Var_Metal, Var_Pop]
- if Position == 0 or Position == 1
- for n in 0...@materia.size
- change_color(Clr_Main)
- draw_text(n * 104, 0, 96, line_height, @text[n], 0)
- change_color(normal_color)
- draw_icon(@icon[n], n * 104, line_height)
- draw_text((n * 104) + 26, line_height, 60, line_height, $game_variables[@value[n]].to_s, 0)
- draw_text(474, line_height, 16, line_height, "/", 1)
- draw_text(490, line_height, 32, line_height, $game_variables[Var_MaxPop].to_s, 0)
- end
- end
- if Position == 2 or Position == 3
- for n in 0...@materia.size
- change_color(Clr_Main)
- draw_text(0, n * 80, 72, line_height, @text[n], 1)
- change_color(normal_color)
- draw_icon(@icon[n], 0, (n * 80) + line_height)
- draw_text(26, (n * 80) + line_height, 38, line_height, $game_variables[@value[n]].to_s, 0)
- draw_text(28, 344, 38, line_height, "/", 1)
- draw_text(50, 344, 18, line_height, $game_variables[Var_MaxPop].to_s, 0)
- end
- end
- end
- #-----------------------------------------------------------------------------
- # Condição de atualização das informações.
- #-----------------------------------------------------------------------------
- def update
- super
- self.visible = $game_switches[Swch_Eneable]
- if Var_Gold != $game_variables[Var_Gold] or Var_Wood != $game_variables[Var_Wood] or
- Var_Stone != $game_variables[Var_Stone] or Var_Metal != $game_variables[Var_Metal] or
- Var_Pop != $game_variables[Var_Pop] or Var_MaxPop != $game_variables[Var_MaxPop]
- contents.clear
- draw_contents
- end
- end
- end
- #===============================================================================
- # Scene_Map
- #-------------------------------------------------------------------------------
- # Esta classe executa o processamento da tela de mapa.
- #===============================================================================
- class Scene_Map < Scene_Base
- alias start_window start
- alias term_window terminate
- alias update_window update
- def start
- start_window
- @materia_hud = Window_KingdomAoEHUD.new
- update
- end
- def terminate
- @materia_hud.dispose
- term_window
- end
- def update
- update_window
- @materia_hud.update
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement