Fashy

Rhyan RGSS3 HUD

May 7th, 2020
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.89 KB | None | 0 0
  1. =begin
  2.  
  3. Termos de Uso:
  4.  
  5. - Não comercial: Me credite.
  6. - Comercial = Me mande uma mensagem privada dizendo que vai usar. Também, se for
  7. usar comercialmente, não é obrigatório, mas divulgue meu github/pastebin:
  8.  
  9. - Pastebin: https://pastebin.com/u/Fashy.
  10. - Github: https://github.com/Rhyan-crypto.
  11.  
  12. Nome: Rhyan RGSS3 Hud
  13. Versão: 1.0
  14. Descrição: Mostre uma HUD com: TP, HP, NICK, MP.
  15.  
  16. #================== Instruções ========================#
  17.  
  18. Para alterar o ícone (HP || MP), chame uma Script Call (evento, com o seguinte código:
  19.  
  20. "Main_RHud_Config::Icone_HP = index_do_seu_icone" para alterar o ícone de HP. Ou, para alterar o ícone de MP:
  21. "Main_RHud_Config::Icone_MP = index_do_seu_icone" para alterar o ícone de MP. Ou, para alterar o ícone de TP ('-'):
  22. "Main_RHud_Config::Icone_TP = index_do_seu_icone" para alterar o ícone de TP.
  23.  
  24. Sem as aspas.
  25.  
  26. Para alterar a opacidade, chame uma script call (event) com o seguinte código:
  27.  
  28. "Main_RHud_Config::Opacidade = sua_opacidade"
  29.  
  30. Sem as aspas, claro.
  31.  
  32. Para desativar a Hud:
  33.  
  34. "Main_RHud_Config::Hud = true/false"
  35.  
  36. false: Desativar;
  37. true = Ativar.
  38.  
  39. #======================================================#
  40.  
  41.  
  42. =end
  43.  
  44. module Main_RHud_Config
  45.   Icone_HP = 122 #<- Ícone HP;
  46.   Icone_MP = 353 #<- Ícone MP.
  47.   Icone_TP = 147
  48.  
  49.   Opacidade = 255
  50.  
  51.   Hud = true #<- Constante para ativar/desativar a hud.
  52. end
  53.  
  54.  
  55. class Scene_Map < Scene_Base
  56.  
  57.   include Main_RHud_Config
  58.  
  59.   alias :rhyan_hud_menu_start :start
  60.   alias :rhyan_hud_menu_update :update
  61.  
  62.   def start
  63.    
  64.     rhyan_hud_menu_start
  65.    
  66.     @window_hud = Window_Hud.new(0, 0, window_width, window_height) #<- Desenhando a janela da hud. (x, y, width, height)  
  67.   end
  68.  
  69.   def update
  70.     rhyan_hud_menu_update
  71.    
  72.     if Hud != true
  73.       @window_hud.close
  74.     elsif Hud == true
  75.       @window_hud.open
  76.     end
  77.   end
  78.  
  79.   def window_width
  80.     return 200 #<- Largura da janela.
  81.   end
  82.  
  83.   def window_height
  84.     return 120 #<- Altura da janela.
  85.   end
  86.  
  87.   def terminate
  88.     @window_hud.dispose
  89.   end
  90. end
  91.  
  92. class Window_Hud < Window_Base
  93.  
  94.   include Main_RHud_Config #<- Incluindo módulo de Configuração Principal.
  95.  
  96.   def initialize(x, y, width, height)
  97.     super
  98.     refresh
  99.    
  100.     self.opacity = Opacidade #<- Opacidade
  101.    
  102.   end
  103.  
  104.   def update
  105.     super
  106.     contents.clear #<- Limpando conteúdo da janela.
  107.     refresh
  108.   end
  109.  
  110.   def refresh
  111.     #= Desenhando status =#
  112.       draw_actor_hp($game_party.members[0], 26, 6) #<- Desenhando o HP;
  113.       draw_actor_mp($game_party.members[0], 26, 34) #<- Desenhando o MP;
  114.       draw_actor_tp($game_party.members[0], 26, 62) #<- Desenhando o TP;
  115.     #= Desenhando ícones =#
  116.       draw_icon(Icone_HP, 0, 2) # Desenhando ícone HP.
  117.       draw_icon(Icone_MP, 0, 30) # Desenhando ícone MP.
  118.       draw_icon(Icone_TP, 0, 58) # Desenhando ícone TP.
  119.     #= FIM =-
  120.   end
  121. end
Advertisement
Add Comment
Please, Sign In to add comment