Guest User

Untitled

a guest
Oct 1st, 2011
696
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 5.45 KB | None | 0 0
  1. #==============================================================
  2. #
  3. # HSTC - Total HUD Control V 1.0
  4. #
  5. # This is a script which enables the user to fully take control
  6. # of the HUD.
  7. #
  8. #
  9. # How to use:
  10. #
  11. # 1) Set-up the config
  12. # 2) Switch the Switch_ID In-Game ON
  13. # 3) Finished
  14. #
  15. # Note:
  16. #
  17. # When you want to manually add a state with an event, do it like this:
  18. #
  19. # 1) Add the state you want to inflict
  20. # 2) Click: Script
  21. # 3) Write: $scene = Scene_Map.new
  22. # 4) Click OK
  23. #
  24. # Credit:
  25. #
  26. # HungrySnake
  27. #
  28. #==============================================================
  29.  
  30. module THC
  31.   module Config
  32.    
  33. #==============================================================
  34. #
  35. #                        Start Config
  36. #
  37. #==============================================================
  38.  
  39.       # Switch -----------------------------------------------------------------
  40.         SWITCH_ID = 20
  41.       # ------------------------------------------------------------------------
  42.    
  43.       # WLH --------------------------------------------------------------------
  44.         WLH = 24
  45.       # ------------------------------------------------------------------------
  46.      
  47.       # Visual -----------------------------------------------------------------
  48.         HUD_WINDOW_X = 250 # HUD Window X
  49.         HUD_WINDOW_Y = 268 # HUD Window Y
  50.         HUD_WINDOW_WIDTH = 296 # HUD Window width
  51.         HUD_WINDOW_HEIGHT = 150 # HUD Window height
  52.    
  53.       # For which actor does the window to draw
  54.       # the things beneath?
  55.       #
  56.       # Options:
  57.       #
  58.       # 0 = Current active actor
  59.       # 1 = Second party member
  60.       # 2 = Third party member
  61.       # 4 = Fourth party member
  62.      
  63.         DRAW_ACTOR = 0
  64.    
  65.         DRAW_STUFF = [ # Don't delete
  66.      
  67.         true, # << draw_actor_face
  68.         true, # << draw_actor_name
  69.         true, # << draw_actor_graphic
  70.         true, # << draw_actor_level
  71.         true, # << draw_actor_hp
  72.         true, # << draw_actor_mp
  73.         true, # << draw_actor_class
  74.         true, # << draw_actor_state
  75.      
  76.       ] # << Don't delete
  77.      
  78.         ACTOR_FACE_X = 10 # Actor Face X coordinate
  79.         ACTOR_FACE_Y = 20 # Actor Face Y coordinate
  80.      
  81.         ACTOR_NAME_X = 10 # Actor Name X coordinate
  82.         ACTOR_NAME_Y = -5 # Actor Name Y coordinate
  83.      
  84.         ACTOR_GRAPHIC_X = 60 # Actor Graphic X coordinate
  85.         ACTOR_GRAPHIC_Y = 96 + WLH - 5 # Actor Graphic Y coordinate
  86.      
  87.         ACTOR_LEVEL_X = 120 # Actor Level X coordinate
  88.         ACTOR_LEVEL_Y = 20 # Actor Level Y coordinate  
  89.      
  90.         ACTOR_HP_X = 120 # Actor HP X coordinate
  91.         ACTOR_HP_Y = 40 # Actor HP Y coordinate
  92.         ACTOR_HP_WIDTH = 120 # Actor HP Bar width
  93.      
  94.         ACTOR_MP_X = 120 # Actor MP X coordinate
  95.         ACTOR_MP_Y = 80 # Actor MP Y coordinate
  96.         ACTOR_MP_WIDTH = 120 # Actor MP Bar width
  97.      
  98.         ACTOR_CLASS_X = 120 # Actor Class X coordinate
  99.         ACTOR_CLASS_Y = -5 # Actor Class Y coordinate
  100.      
  101.         ACTOR_STATE_X = 230 # Actor State X coordinate
  102.         ACTOR_STATE_Y = 20 # Actor State Y coordinate
  103.       # ------------------------------------------------------------------------  
  104.      
  105.   end
  106. end
  107. #==============================================================
  108. #
  109. #                           End  Config
  110. #
  111. #==============================================================
  112.  
  113.  
  114.  
  115. class Window_HUD < Window_Base
  116.   include THC::Config
  117.  
  118.   def initialize
  119.     super(HUD_WINDOW_X,HUD_WINDOW_Y,HUD_WINDOW_WIDTH,HUD_WINDOW_HEIGHT)
  120.     self.visible = $game_switches[SWITCH_ID]
  121.     refresh
  122.   end
  123.  
  124.   def refresh
  125.     self.contents.clear
  126.     draw_actor_stuff
  127.   end
  128.  
  129.   def update
  130.     super
  131.     self.visible = $game_switches[SWITCH_ID]
  132.   end
  133.  
  134.   def draw_actor_stuff
  135.     actor = $game_party.members[DRAW_ACTOR]
  136.       if DRAW_STUFF[0]
  137.         draw_actor_face(actor, ACTOR_FACE_X, ACTOR_FACE_Y)
  138.       end
  139.       if DRAW_STUFF[1]
  140.         draw_actor_name(actor, ACTOR_NAME_X, ACTOR_NAME_Y)          
  141.       end
  142.       if DRAW_STUFF[2]
  143.         draw_actor_graphic(actor,ACTOR_GRAPHIC_X, ACTOR_GRAPHIC_Y)
  144.       end
  145.       if DRAW_STUFF[3]
  146.         draw_actor_level(actor,ACTOR_LEVEL_X, ACTOR_LEVEL_Y)
  147.       end
  148.       if DRAW_STUFF[4]
  149.         draw_actor_hp(actor,ACTOR_HP_X, ACTOR_HP_Y)
  150.       end
  151.       if DRAW_STUFF[5]
  152.         draw_actor_mp(actor,ACTOR_MP_X, ACTOR_MP_Y)
  153.       end
  154.       if DRAW_STUFF[6]
  155.         draw_actor_class(actor,ACTOR_CLASS_X, ACTOR_CLASS_Y)
  156.       end
  157.       if DRAW_STUFF[7]
  158.         draw_actor_state(actor,ACTOR_STATE_X, ACTOR_STATE_Y)
  159.       end
  160.   end    
  161. end
  162.  
  163. class Scene_Map < Scene_Base
  164.  
  165.   alias h_hud start unless $@
  166.   def start(*args, &block)
  167.     @hud_window = Window_HUD.new
  168.     h_hud(*args, &block)
  169.   end
  170.    
  171.   alias h_hud_update update unless $@
  172.   def update(*args, &block)
  173.     @hud_window.update
  174.     h_hud_update(*args, &block)
  175.   end
  176.  
  177.   alias h_hud_terminate terminate unless $@
  178.   def terminate(*args, &block)
  179.     @hud_window.dispose
  180.     h_hud_terminate(*args, &block)
  181.   end
  182.  
  183.   def hud_window
  184.     return @hud_window
  185.   end
  186. end
  187.  
  188. class Game_Party < Game_Unit
  189.  
  190.   alias hsnake_thc_addactor add_actor unless $@
  191.   def add_actor(actor_id,*args,&block)
  192.     $scene.hud_window.refresh
  193.     hsnake_thc_addactor(actor_id,*args,&block)
  194.   end
  195.  
  196.   alias hsnake_thc_ra remove_actor unless $@
  197.   def remove_actor(actor_id,*args,&block)
  198.     $scene.hud_window.refresh    
  199.     hsnake_thc_ra(actor_id,*args,&block)
  200.   end  
  201. end
  202.    
  203.  
Advertisement
Add Comment
Please, Sign In to add comment