dsiver144

RGSS3 - Darksky Hud

Sep 12th, 2013
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 4.17 KB | None | 0 0
  1. #===============================================================================
  2. #  Name of script : Darksky Hud
  3. #  Version        : v0.1
  4. #  Author         : Darksky
  5. #  Website        : www.taotrochoi.com
  6. #  Terms of Use   : Can be use in a commercial project
  7. #                   Credit me :) if you want to use this script. Thanks
  8. #===============================================================================
  9.  
  10. #===============================================================================
  11. #  ** DarkSky_Module
  12. #===============================================================================
  13. module DarkSky
  14.   #-----------------------------------------------------------------------------
  15.   HUD_ON_SWITCH   = 1                  #The switch that turn off or on the hud
  16.   Font_Name       = "Times New Roman"  #Font of the hud
  17.   Font_Size       = 16                 #Font size of the hud
  18.   Red             = 0                  #Red Color
  19.   Gray            = 0                  #Gray Color
  20.   Blue            = 0                  #Blue Color
  21.   Actor_id        = 0                  #Actor id in database. Ex: 0 for Eric
  22.   #-----------------------------------------------------------------------------
  23. end
  24. include DarkSky
  25. #===============================================================================
  26. #  ** DarkSky_Hud
  27. #===============================================================================
  28. class Darksky_Hud < Window_Base
  29.   def initialize
  30.         super(-16, -16, Graphics.width + standard_padding * 2, Graphics.height + standard_padding * 2)
  31.         self.opacity = 0
  32.         refresh
  33.     end
  34.   #=============================================================================
  35.   #  * Refresh
  36.   #=============================================================================
  37.   def refresh
  38.     self.contents.clear
  39.     self.contents.font = Font.new(Font_Name, Font_Size)
  40.     actor = $game_party.members[Actor_id]
  41.     @sinhluc = actor.hp
  42.     @noiluc = actor.mp
  43.     @msinhluc = actor.mhp
  44.     @mnoiluc = actor.mmp
  45.     index = 0
  46.     colorback = Color.new(Red, Gray, Blue, 150)
  47.     colorback2 = Color.new(Red, Gray, Blue, 190)
  48.     if $game_switches[HUD_ON_SWITCH] == true
  49.     draw_gauge(260, 350, 200, actor.hp_rate, hp_gauge_color1, hp_gauge_color2)
  50.     draw_text(200, 354, 100, 32, "Sinh lực:")
  51.     draw_current_and_max_values(200, 358, 200, actor.hp, actor.mhp, hp_color(actor), normal_color)
  52.     draw_gauge(260, 373, 200, actor.mp_rate, mp_gauge_color1, mp_gauge_color2)
  53.     draw_text(200, 376, 100, 32, "Nội lực :")
  54.     draw_current_and_max_values(200, 380, 200, actor.mp, actor.mmp, mp_color(actor), normal_color)
  55.     draw_actor_name(actor,  -40 + 150, 330, 100)
  56.     draw_actor_level(actor, 110, 395)
  57.     draw_icon(actor.equips[index].icon_index, -64 + 175, 360, true)
  58.     end
  59.   #=============================================================================
  60.   #  * Change Hud
  61.   #=============================================================================  
  62.       def change_hud
  63.         return true if @hp != $game_party.members[0].hp
  64.         return true if @mp != $game_party.members[0].mp
  65.         return true if $game_switches[HUD_ON_SWITCH] != "OFF"
  66.         return false
  67.         end      
  68.       end
  69.   #=============================================================================
  70.   #  * Update
  71.   #=============================================================================
  72.     def update
  73.         super
  74.         refresh if change_hud  
  75.       end
  76.     end
  77. #===============================================================================
  78. # ** Scene_Map
  79. #-------------------------------------------------------------------------------
  80. #  This class performs the map screen processing.
  81. #===============================================================================
  82. class Scene_Map
  83.   alias dark_hud create_all_windows
  84.      
  85.     def create_all_windows
  86.         create_hud_window
  87.         dark_hud
  88.       end
  89.       def create_hud_window
  90.         @main_hud = Darksky_Hud.new
  91.         end
  92.       end
  93. #===============================================================================
  94. #  *END OF FIDE
  95. #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment