dsiver144

Darksky Hud v3.0

Sep 13th, 2013
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 4.52 KB | None | 0 0
  1. #===============================================================================
  2. #  Name of script : Darksky Hud
  3. #  Version        : v3.0
  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. #  History :
  10. #     version 2.0 : - Change style of the face
  11. #                   - Add state of actor
  12. #     version 3.0 : - Remove state icon
  13. #                   - Add a small gold text and icon
  14. #                   - Add an exp bar
  15. #                   - Add map name
  16. #===============================================================================
  17. #  ** DarkSky_Module
  18. #===============================================================================
  19. module DarkSky
  20.   #-----------------------------------------------------------------------------
  21.   HUD_ON_SWITCH   = 1                  #The switch that turn off or on the hud
  22.   Font_Name       = "Times New Roman"  #Font of the hud
  23.   Font_Size       = 16                 #Font size of the hud
  24.   Red             = 0                  #Red Color
  25.   Gray            = 0                  #Gray Color
  26.   Blue            = 0                  #Blue Color
  27.   Actor_id        = 0                  #Actor id in database. Ex: 0 for Eric
  28.   #-----------------------------------------------------------------------------
  29. end
  30. include DarkSky
  31. #===============================================================================
  32. #  ** DarkSky_Hud
  33. #===============================================================================
  34. class Darksky_Hud < Window_Base
  35.   def initialize
  36.         super(-16, -16, Graphics.width + standard_padding * 2, Graphics.height + standard_padding * 2)
  37.         self.opacity = 0
  38.         refresh
  39.     end
  40.   #=============================================================================
  41.   #  * Refresh
  42.   #=============================================================================
  43.   def refresh
  44.     self.contents.clear
  45.     self.contents.font = Font.new(Font_Name, Font_Size)
  46.     actor = $game_party.members[Actor_id]
  47.     @sinhluc = actor.hp
  48.     @noiluc = actor.mp
  49.     @hp_rate = actor.hp_rate
  50.     @mp_rate = actor.mp_rate
  51.     @msinhluc = actor.mhp
  52.     @mnoiluc = actor.mmp
  53.     index = 0
  54.     colorback = Color.new(Red, Gray, Blue, 150)
  55.     colorback2 = Color.new(Red, Gray, Blue, 190)
  56.     if $game_switches[HUD_ON_SWITCH] == true
  57.     draw_gauge(260, 350, 200, @hp_rate, hp_gauge_color1, hp_gauge_color2)
  58.     draw_text(200, 354, 100, 32, "Sinh lực:")
  59.     draw_current_and_max_values(200, 358, 200, @sinhluc, @msinhluc, hp_color(actor), normal_color)
  60.     draw_gauge(260, 373, 200, @mp_rate, mp_gauge_color1, mp_gauge_color2)
  61.     draw_text(200, 376, 100, 32, "Nội lực :")
  62.     draw_current_and_max_values(200, 380, 200, @noiluc, @mnoiluc, mp_color(actor), normal_color)
  63.     draw_actor_name(actor,  -40 + 230, 335, 100)
  64.     draw_actor_level(actor, 240, 340)
  65.     draw_icon(actor.equips[index].icon_index, -64 + 218, 390, true)
  66.     draw_actor_icons(actor, 483, 369)
  67.     end
  68.   #=============================================================================
  69.   #  * Change Hud
  70.   #=============================================================================  
  71.       def change_hud
  72.         return true if @hp != $game_party.members[0].hp
  73.         return true if @mp != $game_party.members[0].mp
  74.         return true if $game_switches[HUD_ON_SWITCH] != "OFF"
  75.         return false
  76.         end      
  77.       end
  78.   #=============================================================================
  79.   #  * Update
  80.   #=============================================================================
  81.     def update
  82.         super
  83.         refresh if change_hud  
  84.       end
  85.     end
  86. #===============================================================================
  87. # ** Scene_Map
  88. #-------------------------------------------------------------------------------
  89. #  This class performs the map screen processing.
  90. #===============================================================================
  91. class Scene_Map
  92.   alias dark_hud create_all_windows
  93.      
  94.     def create_all_windows
  95.         create_hud_window
  96.         dark_hud
  97.       end
  98.       def create_hud_window
  99.         @main_hud = Darksky_Hud.new
  100.         end
  101.       end
  102. #===============================================================================
  103. #  *END OF FIDE
  104. #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment