Advertisement
Dekita

$D13x KMHud 1.1

Apr 20th, 2013
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.23 KB | None | 0 0
  1. if true # << Make true to use this script, false to disable.
  2. #===============================================================================
  3. #
  4. # ☆ $D13x - Key Menu HUD
  5. # -- Author : Dekita
  6. # -- Version : 1.1
  7. # -- Level : Easy / Normal
  8. # -- Requires : $D13x Key Menu v1.2+
  9. # -- Engine : RPG Maker VX Ace.
  10. #
  11. #===============================================================================
  12. # ☆ Import
  13. #-------------------------------------------------------------------------------
  14. $D13x={}if$D13x==nil
  15. $D13x[:Key_Menu]=true
  16. #===============================================================================
  17. # ☆ Updates
  18. #-------------------------------------------------------------------------------
  19. # D /M /Y
  20. # o4/o4/2o13 - Compatibility, (Key Menu v1.2)
  21. # 29/o3/2o13 - Started, Finished,
  22. #
  23. #===============================================================================
  24. # ☆ Introduction
  25. #-------------------------------------------------------------------------------
  26. # This script shows a little HUD for the keys used to trigger each menu item.
  27. # Requires $D13x Key Menu.
  28. #
  29. #===============================================================================
  30. # ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
  31. #===============================================================================
  32. # 1. You MUST give credit to "Dekita" !!
  33. # 2. You are NOT allowed to repost this script.(or modified versions)
  34. # 3. You are NOT allowed to convert this script.
  35. # 4. You are NOT allowed to use this script for Commercial games.
  36. # 5. ENJOY!
  37. #
  38. # "FINE PRINT"
  39. # By using this script you hereby agree to the above terms and conditions,
  40. # if any violation of the above terms occurs "legal action" may be taken.
  41. # Not understanding the above terms and conditions does NOT mean that
  42. # they do not apply to you.
  43. # If you wish to discuss the terms and conditions in further detail you can
  44. # contact me at http://dekitarpg.wordpress.com/
  45. #
  46. #===============================================================================
  47. # ☆ Instructions
  48. #-------------------------------------------------------------------------------
  49. # Place Below " ▼ Materials " and Above " ▼ Main " in your script editor.
  50. # Place Below $D13x Key Menu
  51. #
  52. #===============================================================================
  53. module Key_Menu
  54. #===============================================================================
  55.  
  56. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  57. # ☆ Visible HUD Settings
  58. #-----------------------------------------------------------------------------
  59. # You can show a small graphic for each hud item,
  60. # NOTE : the graphic should be about 26x26 pixels in size
  61. # it will be shown below the icon for all visible key icons.
  62. # graphic should be placed in Graphics/System folder
  63. Show_HUD_Graphic = [ false , "GRAPHIC NAME" ] # [ use? , graphic ]
  64.  
  65. # Text Settings, used to adjust various settings for the Key shown
  66. # for each visible menu icon.
  67. # Settings = [ x , y , size, bold , color , outline col ]
  68. Text_Settings = [ 26 , 5 , 18 , true , Text_Color::Grey, Text_Color::Black ]
  69. Text_Opacity = [ 155 , 255 ] # [ not pressed , pressed ]
  70.  
  71. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  72. # ☆ Visible Icon Settings
  73. #-----------------------------------------------------------------------------
  74. # NOTE: will only be shown if the key is not :NONE
  75. # Menu Item = [show?, x , y , icon , icon hue]
  76. Menu_Key_HUD = [true , 0 , 0 , 0 , 0 ]
  77. Pause_Key_HUD = [true , 10 , 100 , 1 , 0 ]
  78. Items_Key_HUD = [true , 10 , 126 , 2 , 0 ]
  79. Skills_Key_HUD = [true , 10 , 152 , 3 , 0 ]
  80. Equips_Key_HUD = [true , 10 , 178 , 4 , 0 ]
  81. Status_Key_HUD = [true , 10 , 204 , 5 , 0 ]
  82. Save_Key_HUD = [true , 10 , 230 , 6 , 0 ]
  83.  
  84. # This is the extra x and y position added to each icon.
  85. Icon_Settings = [ 2 , 2 ] # [ xtra x , xtra y ]
  86.  
  87. end #####################
  88. # CUSTOMISATION END #
  89. #####################
  90. #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
  91. # #
  92. # http://dekitarpg.wordpress.com/ #
  93. # #
  94. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
  95. #===============================================================================#
  96. # ARE YOU MODIFYING BEYOND THIS POINT? \.\. #
  97. # YES?\.\. #
  98. # OMG, REALLY? \| #
  99. # WELL SLAP MY FACE AND CALL ME A DRAGONITE.\..\.. #
  100. # I REALLY DIDN'T THINK YOU HAD IT IN YOU.\..\.. #
  101. #===============================================================================#
  102. class KM_HUD < Sprite
  103. #===============================================================================
  104. #--------------------------------------------------------------------------
  105. # Initalize Litte Key HUD
  106. #--------------------------------------------------------------------------
  107. def initialize(key,x,y,icon_id,hue)
  108. super()
  109. create_bg(x,y)
  110. create_icon(x,y,icon_id,hue)
  111. create_letter(x,y,key)
  112. end
  113. #--------------------------------------------------------------------------
  114. # Create BG
  115. #--------------------------------------------------------------------------
  116. def create_bg(x,y)
  117. bg_info = Key_Menu::Show_HUD_Graphic
  118. if bg_info[0] ; self.bitmap = Cache.system(bg_info[1])
  119. else ; self.bitmap = Bitmap.new(26,26) ; end
  120. self.z = 201
  121. self.x = (x)
  122. self.y = (y)
  123. end
  124. #--------------------------------------------------------------------------
  125. # Create Icon
  126. #--------------------------------------------------------------------------
  127. def create_icon(x,y,icon_id,hue)
  128. @icon = Sprite.new
  129. @icon.bitmap = Cache.icon("IconSet", hue)
  130. rect = Rect.new(icon_id % 16 * 24, icon_id / 16 * 24, 24, 24)
  131. @icon.bitmap.blt(0, 0, @icon.bitmap, rect, 255)
  132. @icon.src_rect.set(rect.x, rect.y, 24, 24)
  133. @icon.z = (self.z)
  134. @icon.x = x+Key_Menu::Icon_Settings[0]
  135. @icon.y = y+Key_Menu::Icon_Settings[1]
  136. end
  137. #--------------------------------------------------------------------------
  138. # Create Letter
  139. #--------------------------------------------------------------------------
  140. def create_letter(x,y,key)
  141. @keys = key.to_s
  142. wids = (18 * @keys.size)
  143. @letter = Sprite.new
  144. @letter.bitmap = Bitmap.new(wids,18)
  145. @letter.bitmap.font.name = General::Fonts
  146. @letter.bitmap.font.size = Key_Menu::Text_Settings[2]
  147. @letter.bitmap.font.bold = Key_Menu::Text_Settings[3]
  148. @letter.bitmap.font.color = Key_Menu::Text_Settings[4]
  149. @letter.bitmap.font.out_color = Key_Menu::Text_Settings[5]
  150. @letter.bitmap.draw_text(0,0,wids,18,@keys)
  151. @letter.z = (self.z)
  152. @letter.x = x+Key_Menu::Text_Settings[0]
  153. @letter.y = y+Key_Menu::Text_Settings[1]
  154. @letter.opacity = Key_Menu::Text_Opacity[0]
  155. end
  156. #--------------------------------------------------------------------------
  157. # Dispose Litte Key HUD
  158. #--------------------------------------------------------------------------
  159. def dispose
  160. super
  161. @icon.dispose if @icon
  162. @letter.dispose if @letter
  163. end
  164. #--------------------------------------------------------------------------
  165. # Update Litte Key HUD
  166. #--------------------------------------------------------------------------
  167. def update
  168. super
  169. @letter.opacity = Key_Menu::Text_Opacity[0]
  170. if Keys.press?(Keys::Key[@keys.to_sym])
  171. @letter.opacity = Key_Menu::Text_Opacity[1]
  172. end
  173. end
  174.  
  175. end
  176.  
  177. #===============================================================================
  178. class Spriteset_Map
  179. #===============================================================================
  180. #--------------------------------------------------------------------------
  181. # Initalize Litte Key HUD
  182. #--------------------------------------------------------------------------
  183. alias :init_KEY_HUD_SM :initialize
  184. alias :updt_KEY_HUD_SM :dispose
  185. alias :disp_KEY_HUD_SM :update
  186. #--------------------------------------------------------------------------
  187. # Initalize Litte Key HUD
  188. #--------------------------------------------------------------------------
  189. def initialize
  190. init_KEY_HUD_SM
  191. create_KEY_HUD
  192. end
  193. #--------------------------------------------------------------------------
  194. # Create Key HUD
  195. #--------------------------------------------------------------------------
  196. def create_KEY_HUD
  197. @key_HUD = []
  198. if Key_Menu::Pause_Key[0] != :NONE && Key_Menu::Pause_Key_HUD[0]
  199. k = Key_Menu::Pause_Key_HUD
  200. @key_HUD << KM_HUD.new(Key_Menu::Pause_Key[0],k[1],k[2],k[3],k[4])
  201. end
  202. if Key_Menu::Menu_Key[0] != :NONE && Key_Menu::Menu_Key_HUD[0]
  203. k = Key_Menu::Menu_Key_HUD
  204. @key_HUD << KM_HUD.new(Key_Menu::Menu_Key[0],k[1],k[2],k[3],k[4])
  205. end
  206. if Key_Menu::Items_Key[0] != :NONE && Key_Menu::Items_Key_HUD[0]
  207. k = Key_Menu::Items_Key_HUD
  208. @key_HUD << KM_HUD.new(Key_Menu::Items_Key[0],k[1],k[2],k[3],k[4])
  209. end
  210. if Key_Menu::Skills_Key[0] != :NONE && Key_Menu::Skills_Key_HUD[0]
  211. k = Key_Menu::Skills_Key_HUD
  212. @key_HUD << KM_HUD.new(Key_Menu::Skills_Key[0],k[1],k[2],k[3],k[4])
  213. end
  214. if Key_Menu::Equips_Key[0] != :NONE && Key_Menu::Equips_Key_HUD[0]
  215. k = Key_Menu::Equips_Key_HUD
  216. @key_HUD << KM_HUD.new(Key_Menu::Equips_Key[0],k[1],k[2],k[3],k[4])
  217. end
  218. if Key_Menu::Status_Key[0] != :NONE && Key_Menu::Status_Key_HUD[0]
  219. k = Key_Menu::Status_Key_HUD
  220. @key_HUD << KM_HUD.new(Key_Menu::Status_Key[0],k[1],k[2],k[3],k[4])
  221. end
  222. if Key_Menu::Save_Key[0] != :NONE && Key_Menu::Save_Key_HUD[0]
  223. k = Key_Menu::Save_Key_HUD
  224. @key_HUD << KM_HUD.new(Key_Menu::Save_Key[0],k[1],k[2],k[3],k[4])
  225. end
  226. end
  227. #--------------------------------------------------------------------------
  228. # Dispose Litte Key HUD
  229. #--------------------------------------------------------------------------
  230. def dispose
  231. updt_KEY_HUD_SM
  232. if @key_HUD
  233. @key_HUD.each {|kh| kh.dispose }
  234. end
  235. end
  236. #--------------------------------------------------------------------------
  237. # Update Litte Key HUD
  238. #--------------------------------------------------------------------------
  239. def update
  240. disp_KEY_HUD_SM
  241. if @key_HUD
  242. @key_HUD.each {|kh| kh.update }
  243. end
  244. end
  245.  
  246. end
  247.  
  248. #==============================================================================#
  249. # http://dekitarpg.wordpress.com/ #
  250. #==============================================================================#
  251. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement