Advertisement
Guest User

rmxpHUD#98734563456

a guest
Oct 25th, 2014
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.45 KB | None | 0 0
  1. class Scene_Map
  2.  
  3. SWITCH_ID = 3
  4. $center_hud = false
  5.  
  6. alias raz_hud_main main
  7. alias raz_hud_update update
  8.  
  9. def main
  10. @size = $game_party.actors.size
  11. raz_hud_main
  12. @hud_window.dispose
  13. for i in 0...$game_party.actors.size
  14. @hud_dummy[i].dispose
  15. end
  16. end
  17. ################################################################################
  18. def update
  19. if @size != $game_party.actors.size
  20. @hud_window.refresh
  21. show_window
  22. end
  23. if @hud != true
  24. main_window
  25. end
  26. #turn_hud_on_off
  27.  
  28. if Input.trigger?(Input::Key['H'])
  29. @hud_window.visible = !@hud_window.visible
  30. for i in 0...$game_party.actors.size
  31. @hud_dummy[i].visible = !@hud_dummy[i].visible
  32. end
  33. end
  34.  
  35. @hud_window.update
  36. raz_hud_update
  37. end
  38. ################################################################################
  39. def show_window
  40. @size = $game_party.actors.size
  41. for i in 0..3
  42. @hud_dummy[i].visible = ($game_party.actors[i] != nil)
  43. end
  44. end
  45.  
  46. def main_window
  47. @opacity = 100 #200 fenster transparentz#100=leicht durchsichtig
  48. @hud_dummy = []
  49. for i in 0...4
  50. y = $game_party.actors.size - 1
  51. x = 240 - (y * 80)
  52. if $center_hud == true
  53. @hud_dummy[i] = Window_Base.new(160 * i + x, 372,200, 108) #160 * i + x, 372,200, 108
  54. else
  55. @hud_dummy[i] = Window_Base.new(160 * i, 372,200, 108) #160 * i, 372,200, 108
  56. end
  57. @hud_dummy[i].opacity = @opacity
  58. @hud_dummy[i].visible = false
  59. end
  60. @hud_window = Window_HUD.new
  61. for i in 0...$game_party.actors.size
  62. @hud_dummy[i].visible = $game_party.actors[i] != nil
  63. end
  64. @hud = true
  65. end
  66.  
  67. def turn_hud_on_off
  68. if $game_switches[SWITCH_ID] == false
  69. @hud_window.visible = false
  70. for i in 0...$game_party.actors.size
  71. @hud_dummy[i].visible = false
  72. end
  73. end
  74.  
  75.  
  76. if $game_switches[SWITCH_ID] == true
  77. @hud_window.visible = true
  78. for i in 0...$game_party.actors.size
  79. @hud_dummy[i].visible = true #true standart
  80. end
  81. end
  82. end
  83.  
  84. end
  85.  
  86.  
  87. class Window_HUD < Window_Base
  88. def initialize
  89. super(0, 0, 800, 600)
  90. self.contents = Bitmap.new(width - 32, height - 32)
  91. self.opacity = 0
  92. for i in 0...$game_party.actors.size
  93. actor = $game_party.actors[i]
  94. eval("@old_hp#{i+1} = actor.hp; @old_sp#{i+1} = actor.sp; @old_exp#{i+1} = actor.now_exp")#
  95. end
  96. refresh
  97. end
  98.  
  99. def refresh
  100. self.contents.clear
  101. for i in 0...$game_party.actors.size
  102. a = $game_party.actors.size - 1
  103. actor = $game_party.actors[i]
  104. if $center_hud == true
  105. x = (i * 160 + 25) + (240 - (a * 80))
  106. else
  107. x = i * 160 + 25 #160 + 25
  108. end
  109. self.contents.font.size = 21
  110. ## draw_actor_graphic(actor, x - 15, 445)
  111. self.contents.font.color = normal_color
  112. ## self.contents.draw_text(x - 25, 360, 100, 32, actor.name)
  113. width = 100#100#130
  114. height = 6#6#12
  115. draw_slant_bar(x + 8, 396, actor.hp, actor.maxhp, width, height, Color.new(150, 0, 0), Color.new(155, 155, 60))
  116. draw_slant_bar(x + 8, 416, actor.sp, actor.maxsp, width, height, Color.new(0, 0, 150), Color.new(60, 155, 155))
  117. unless actor.level == 99
  118. draw_slant_bar(x + 8, 436, actor.now_exp, actor.next_exp, width, height, Color.new(0, 150, 0), Color.new(60, 255, 60)) #wurde abgestellt
  119. else
  120. draw_slant_bar(x + 8, 436, 1, 1, width = 100, height = 6, Color.new(0, 150, 0), Color.new(60, 255, 60))
  121. end
  122. self.contents.font.size = 12#16#20
  123. draw_actor_state(actor, x + 45, 360)
  124. self.contents.font.color = normal_color
  125. self.contents.font.bold = false
  126. self.contents.font.color = actor.hp == 0 ? knockout_color : actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
  127. self.contents.draw_text(x + 16, 382, 100, 32, "#{actor.hp}/#{actor.maxhp}", 1)
  128. self.contents.font.color = actor.sp == 0 ? crisis_color : actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
  129. self.contents.draw_text(x + 16, 402, 100, 32, "#{actor.sp}/#{actor.maxsp}", 1)
  130. #self.contents.font.color = actor.exp == 0 ? crisis_color : actor.exp <= actor.now_exp / 4 ? crisis_color : normal_color
  131. self.contents.draw_text(x + 16, 422, 100, 32, "#{actor.exp_s}/#{actor.next_exp_s}", 1)#exp_s next_rest_exp_s
  132. self.contents.font.color = system_color
  133. self.contents.font.size = 12#20
  134. self.contents.font.bold = false
  135. self.contents.draw_text(0, 384, 50, 32, "HP")#(x, 384, 50, 32, "Pwr")
  136. self.contents.draw_text(0, 404, 50, 32, "ST")#(x, 404, 50, 32, "Enr")
  137. self.contents.draw_text(0, 424, 50, 32, "EP")#(0, 424, 50, 32, "EP")
  138. end
  139. end
  140. #$data_system.words.hp $data_system.words.sp
  141. def update
  142. super
  143. for i in 0...$game_party.actors.size
  144. actor = $game_party.actors[i]
  145. if (eval("@old_hp#{i+1}") != actor.hp or eval("@old_sp#{i+1}") != actor.sp or
  146. eval("@old_exp#{i+1}") != actor.now_exp)
  147. refresh
  148. eval("@old_hp#{i+1} = actor.hp; @old_sp#{i+1} = actor.sp; @old_exp#{i+1} = actor.now_exp")
  149. end
  150. end
  151. end
  152. end
  153.  
  154. class Window_Base < Window
  155. def draw_slant_bar(x, y, min, max, width = 152, height = 6,
  156. bar_color = Color.new(150, 0, 0, 255), end_color = Color.new(255, 255, 60, 255))
  157. for i in 0..height
  158. self.contents.fill_rect(x + i, y + height - i, width + 1, 1, Color.new(50, 50, 50, 255))
  159. end
  160. for i in 1..(height - 1)
  161. r = 100 * (height - i) / height + 0 * i / height
  162. g = 100 * (height - i) / height + 0 * i / height
  163. b = 100 * (height - i) / height + 0 * i / height
  164. a = 255 * (height - i) / height + 255 * i / height
  165. self.contents.fill_rect(x + i, y + height - i, width, 1, Color.new(r, b, g, a))
  166. end
  167. for i in 1..(width - 1)
  168. for j in 1..(height - 1)
  169. r = bar_color.red * (width - i) / width + end_color.red * i / width
  170. g = bar_color.green * (width - i) / width + end_color.green * i / width
  171. b = bar_color.blue * (width - i) / width + end_color.blue * i / width
  172. a = bar_color.alpha * (width - i) / width + end_color.alpha * i / width
  173. self.contents.fill_rect(x + i + j, y + height - j, 1, 1, Color.new(r, g, b, a))
  174. end
  175. end
  176. end
  177. end
  178.  
  179. class Game_Actor
  180. def now_exp
  181. return @exp - @exp_list[@level]
  182. end
  183. def next_exp
  184. return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
  185. end
  186. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement