Advertisement
Dekita

$D13x Key Menu HUD v1.1

May 21st, 2013
501
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.78 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.2
  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. # 17/o5/2o13 - Update, (hide each hud item)
  21. # - Compatibility, (Event Keys v1.1)
  22. # o4/o4/2o13 - Compatibility, (Key Menu v1.2)
  23. # 29/o3/2o13 - Started, Finished,
  24. #
  25. #===============================================================================
  26. # ☆ Introduction
  27. #-------------------------------------------------------------------------------
  28. # This script shows a little HUD for the keys used to trigger each menu item.
  29. # The hud image for each item will only be shown if its switch is active.
  30. # Requires $D13x Key Menu.
  31. #
  32. # v1.2 allows for each Common Event Key (from my Event Keys script) to have its
  33. # own little hud image. requires Event Keys v1.1+
  34. # v1.2 also allows for each hud key to be hidden unless the its switch
  35. # is turned on. (Switches are set in the Key Menu script && Event Keys script)
  36. #
  37. #===============================================================================
  38. # ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
  39. #===============================================================================
  40. # 1. You MUST give credit to "Dekita" !!
  41. # 2. You are NOT allowed to repost this script.(or modified versions)
  42. # 3. You are NOT allowed to convert this script.
  43. # 4. You are NOT allowed to use this script for Commercial games.
  44. # 5. ENJOY!
  45. #
  46. # "FINE PRINT"
  47. # By using this script you hereby agree to the above terms and conditions,
  48. # if any violation of the above terms occurs "legal action" may be taken.
  49. # Not understanding the above terms and conditions does NOT mean that
  50. # they do not apply to you.
  51. # If you wish to discuss the terms and conditions in further detail you can
  52. # contact me at http://dekitarpg.wordpress.com/
  53. #
  54. #===============================================================================
  55. # ☆ Instructions
  56. #-------------------------------------------------------------------------------
  57. # Place Below " ▼ Materials " and Above " ▼ Main " in your script editor.
  58. # Place Below $D13x Key Menu
  59. #
  60. #===============================================================================
  61. # ☆ Additional Credit
  62. #-------------------------------------------------------------------------------
  63. # DarthVollis - Script Feature Ideas,
  64. #
  65. #===============================================================================
  66. module Key_Menu
  67. #===============================================================================
  68.  
  69. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  70. # ☆ Visible HUD Settings
  71. #-----------------------------------------------------------------------------
  72. # You can show a small graphic for each hud item,
  73. # NOTE : the graphic should be about 26x26 pixels in size
  74. # it will be shown below the icon for all visible key icons.
  75. # graphic should be placed in Graphics/System folder
  76. Show_HUD_Graphic = [ true , "Key_HUD_Square" ] # [ use? , graphic ]
  77.  
  78. # Text Settings, used to adjust various settings for the Key shown
  79. # for each visible menu icon.
  80. # Settings = [ x , y , size, bold , color , outline col ]
  81. Text_Settings = [ 10 , 27, 18 , false, Text_Color::White,Text_Color::Black ]
  82. Text_Opacity = [ 155 , 255 ] # [ not pressed , pressed ]
  83.  
  84. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  85. # ☆ Visible Icon Settings
  86. #-----------------------------------------------------------------------------
  87. # NOTE: will only be shown if the key is not :NONE
  88. # Menu Item = [show?, x , y , icon , icon hue]
  89. Menu_Key_HUD = [true , 0 , 0 , 0 , 0 ]
  90. Pause_Key_HUD = [true , 2 , 2 , 117 , 0 ]
  91. Save_Key_HUD = [true , 28 , 2 , 231 , 0 ]
  92. Items_Key_HUD = [true , 54 , 2 , 260 , 0 ]
  93. Status_Key_HUD = [true , 80 , 2 , 14 , 0 ]
  94. Skills_Key_HUD = [true , 106, 2 , 375 , 0 ]
  95. Equips_Key_HUD = [true , 132, 2 , 116 , 0 ]
  96.  
  97. # This is the extra x and y position added to each icon.
  98. Icon_Settings = [ 1 , 1 ] # [ xtra x , xtra y ]
  99.  
  100. end #####################
  101. # CUSTOMISATION END #
  102. #####################
  103. #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
  104. # #
  105. # http://dekitarpg.wordpress.com/ #
  106. # #
  107. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
  108. #===============================================================================#
  109. # ARE YOU MODIFYING BEYOND THIS POINT? \.\. #
  110. # YES?\.\. #
  111. # OMG, REALLY? \| #
  112. # WELL SLAP MY FACE AND CALL ME A DRAGONITE.\..\.. #
  113. # I REALLY DIDN'T THINK YOU HAD IT IN YOU.\..\.. #
  114. #===============================================================================#
  115. class KM_HUD < Sprite
  116. #===============================================================================
  117. #--------------------------------------------------------------------------
  118. # Initalize Litte Key HUD
  119. #--------------------------------------------------------------------------
  120. def initialize(key,x,y,icon_id,hue)
  121. super()
  122. create_bg(x,y)
  123. create_icon(x,y,icon_id,hue)
  124. create_letter(x,y,key)
  125. end
  126. #--------------------------------------------------------------------------
  127. # Create BG
  128. #--------------------------------------------------------------------------
  129. def create_bg(x,y)
  130. bg_info = Key_Menu::Show_HUD_Graphic
  131. if bg_info[0] ; self.bitmap = Cache.system(bg_info[1])
  132. else ; self.bitmap = Bitmap.new(26,26) ; end
  133. self.z = 201
  134. self.x = (x)
  135. self.y = (y)
  136. end
  137. #--------------------------------------------------------------------------
  138. # Create Icon
  139. #--------------------------------------------------------------------------
  140. def create_icon(x,y,icon_id,hue)
  141. @icon = Sprite.new
  142. @icon.bitmap = Cache.icon("IconSet", hue)
  143. rect = Rect.new(icon_id % 16 * 24, icon_id / 16 * 24, 24, 24)
  144. @icon.bitmap.blt(0, 0, @icon.bitmap, rect, 255)
  145. @icon.src_rect.set(rect.x, rect.y, 24, 24)
  146. @icon.z = (self.z)
  147. @icon.x = x+Key_Menu::Icon_Settings[0]
  148. @icon.y = y+Key_Menu::Icon_Settings[1]
  149. end
  150. #--------------------------------------------------------------------------
  151. # Create Letter
  152. #--------------------------------------------------------------------------
  153. def create_letter(x,y,key)
  154. @keys = key.to_s
  155. wids = (24 * @keys.size)
  156. @letter = Sprite.new
  157. @letter.bitmap = Bitmap.new(wids,18)
  158. @letter.bitmap.font.name = General::Fonts
  159. @letter.bitmap.font.size = Key_Menu::Text_Settings[2]
  160. @letter.bitmap.font.bold = Key_Menu::Text_Settings[3]
  161. @letter.bitmap.font.color = Key_Menu::Text_Settings[4]
  162. @letter.bitmap.font.out_color = Key_Menu::Text_Settings[5]
  163. @letter.bitmap.draw_text(0,0,wids,18,@keys)
  164. @letter.z = (self.z)
  165. @letter.x = x+Key_Menu::Text_Settings[0]
  166. @letter.y = y+Key_Menu::Text_Settings[1]
  167. @letter.opacity = Key_Menu::Text_Opacity[0]
  168. end
  169. #--------------------------------------------------------------------------
  170. # Dispose Litte Key HUD
  171. #--------------------------------------------------------------------------
  172. def dispose
  173. super
  174. @icon.dispose if @icon
  175. @letter.dispose if @letter
  176. end
  177. #--------------------------------------------------------------------------
  178. # Update Litte Key HUD
  179. #--------------------------------------------------------------------------
  180. def update
  181. super
  182. @letter.opacity = Key_Menu::Text_Opacity[0]
  183. if Keys.press?(Keys::Key[@keys.to_sym])
  184. @letter.opacity = Key_Menu::Text_Opacity[1]
  185. end
  186. end
  187.  
  188. end
  189.  
  190. #===============================================================================
  191. class Spriteset_Map
  192. #===============================================================================
  193. #--------------------------------------------------------------------------
  194. # Initalize Litte Key HUD
  195. #--------------------------------------------------------------------------
  196. alias :init_KEY_HUD_SM :initialize
  197. alias :updt_KEY_HUD_SM :dispose
  198. alias :disp_KEY_HUD_SM :update
  199. #--------------------------------------------------------------------------
  200. # Initalize Litte Key HUD
  201. #--------------------------------------------------------------------------
  202. def initialize
  203. init_KEY_HUD_SM
  204. create_KEY_HUD
  205. end
  206. #--------------------------------------------------------------------------
  207. # Create Key HUD
  208. #--------------------------------------------------------------------------
  209. def create_KEY_HUD
  210. @key_HUD.each {|kh| kh.dispose } if @key_HUD
  211. @pause_key_showing = false
  212. @menu_key_showing = false
  213. @items_key_showing = false
  214. @skills_key_showing = false
  215. @equips_key_showing = false
  216. @status_key_showing = false
  217. @save_key_showing = false
  218. @regen_key_showing = false
  219. @key_HUD = []
  220. create_pause_key_hud
  221. create_menu_key_hud
  222. create_items_key_hud
  223. create_skills_key_hud
  224. create_equips_key_hud
  225. create_status_key_hud
  226. create_save_key_hud
  227. create_regen_key
  228. create_common_ev_key_hud
  229. end
  230. #--------------------------------------------------------------------------
  231. # Create Pause Key Hud
  232. #--------------------------------------------------------------------------
  233. def create_pause_key_hud
  234. return if !((Key_Menu::Pause_Key[0] != :NONE) && Key_Menu::Pause_Key_HUD[0])
  235. if ((Key_Menu::Pause_Key[1] > 0) && $game_switches[Key_Menu::Pause_Key[1]])
  236. make_pause_HUD
  237. elsif (Key_Menu::Pause_Key[1] <= 0)
  238. make_pause_HUD
  239. end
  240. end
  241. #--------------------------------------------------------------------------
  242. # Create Pause Key Hud
  243. #--------------------------------------------------------------------------
  244. def make_pause_HUD
  245. k = Key_Menu::Pause_Key_HUD
  246. @key_HUD << KM_HUD.new(Key_Menu::Pause_Key[0],k[1],k[2],k[3],k[4])
  247. @pause_key_showing = true
  248. end
  249. #--------------------------------------------------------------------------
  250. # Create Menu Key Hud
  251. #--------------------------------------------------------------------------
  252. def create_menu_key_hud
  253. return if !((Key_Menu::Menu_Key[0] != :NONE) && Key_Menu::Menu_Key_HUD[0])
  254. if (Key_Menu::Menu_Key[1] > 0) && $game_switches[Key_Menu::Menu_Key[1]]
  255. make_menu_HUD
  256. elsif (Key_Menu::Menu_Key[1] <= 0)
  257. make_menu_HUD
  258. end
  259. end
  260. #--------------------------------------------------------------------------
  261. # Create Menu Key Hud
  262. #--------------------------------------------------------------------------
  263. def make_menu_HUD
  264. k = Key_Menu::Menu_Key_HUD
  265. @key_HUD << KM_HUD.new(Key_Menu::Menu_Key[0],k[1],k[2],k[3],k[4])
  266. @menu_key_showing = true
  267. end
  268. #--------------------------------------------------------------------------
  269. # Create Items Key Hud
  270. #--------------------------------------------------------------------------
  271. def create_items_key_hud
  272. return if !((Key_Menu::Items_Key[0] != :NONE) && Key_Menu::Items_Key_HUD[0])
  273. if (Key_Menu::Items_Key[1] > 0) && $game_switches[Key_Menu::Items_Key[1]]
  274. make_items_HUD
  275. elsif (Key_Menu::Items_Key[1] <= 0)
  276. make_items_HUD
  277. end
  278. end
  279. #--------------------------------------------------------------------------
  280. # Create Items Key Hud
  281. #--------------------------------------------------------------------------
  282. def make_items_HUD
  283. k = Key_Menu::Items_Key_HUD
  284. @key_HUD << KM_HUD.new(Key_Menu::Items_Key[0],k[1],k[2],k[3],k[4])
  285. @items_key_showing = true
  286. end
  287. #--------------------------------------------------------------------------
  288. # Create Skills Key Hud
  289. #--------------------------------------------------------------------------
  290. def create_skills_key_hud
  291. return if !((Key_Menu::Skills_Key[0] != :NONE) && Key_Menu::Skills_Key_HUD[0])
  292. if (Key_Menu::Skills_Key[1] > 0) && $game_switches[Key_Menu::Skills_Key[1]]
  293. make_skills_HUD
  294. elsif (Key_Menu::Skills_Key[1] <= 0)
  295. make_skills_HUD
  296. end
  297. end
  298. #--------------------------------------------------------------------------
  299. # Create Skills Key Hud
  300. #--------------------------------------------------------------------------
  301. def make_skills_HUD
  302. k = Key_Menu::Skills_Key_HUD
  303. @key_HUD << KM_HUD.new(Key_Menu::Skills_Key[0],k[1],k[2],k[3],k[4])
  304. @skills_key_showing = true
  305. end
  306. #--------------------------------------------------------------------------
  307. # Create Equips Key Hud
  308. #--------------------------------------------------------------------------
  309. def create_equips_key_hud
  310. return if !((Key_Menu::Equips_Key[0] != :NONE) && Key_Menu::Equips_Key_HUD[0])
  311. if (Key_Menu::Equips_Key[1] > 0) && $game_switches[Key_Menu::Equips_Key[1]]
  312. make_equips_HUD
  313. elsif (Key_Menu::Equips_Key[1] <= 0)
  314. make_equips_HUD
  315. end
  316. end
  317. #--------------------------------------------------------------------------
  318. # Create Equips Key Hud
  319. #--------------------------------------------------------------------------
  320. def make_equips_HUD
  321. k = Key_Menu::Equips_Key_HUD
  322. @key_HUD << KM_HUD.new(Key_Menu::Equips_Key[0],k[1],k[2],k[3],k[4])
  323. @equips_key_showing = true
  324. end
  325. #--------------------------------------------------------------------------
  326. # Create Status Key Hud
  327. #--------------------------------------------------------------------------
  328. def create_status_key_hud
  329. return if !((Key_Menu::Status_Key[0] != :NONE) && Key_Menu::Status_Key_HUD[0])
  330. if (Key_Menu::Status_Key[1] > 0) && $game_switches[Key_Menu::Status_Key[1]]
  331. make_status_HUD
  332. elsif (Key_Menu::Status_Key[1] <= 0)
  333. make_status_HUD
  334. end
  335. end
  336. #--------------------------------------------------------------------------
  337. # Create Status Key Hud
  338. #--------------------------------------------------------------------------
  339. def make_status_HUD
  340. k = Key_Menu::Status_Key_HUD
  341. @key_HUD << KM_HUD.new(Key_Menu::Status_Key[0],k[1],k[2],k[3],k[4])
  342. @status_key_showing = true
  343. end
  344. #--------------------------------------------------------------------------
  345. # Create Save Key Hud
  346. #--------------------------------------------------------------------------
  347. def create_save_key_hud
  348. return if !((Key_Menu::Save_Key[0] != :NONE) && Key_Menu::Save_Key_HUD[0])
  349. if (Key_Menu::Save_Key[1] > 0) && $game_switches[Key_Menu::Save_Key[1]]
  350. make_save_HUD
  351. elsif (Key_Menu::Save_Key[1] <= 0)
  352. make_save_HUD
  353. end
  354. end
  355. #--------------------------------------------------------------------------
  356. # Create Save Key Hud
  357. #--------------------------------------------------------------------------
  358. def make_save_HUD
  359. k = Key_Menu::Save_Key_HUD
  360. @key_HUD << KM_HUD.new(Key_Menu::Save_Key[0],k[1],k[2],k[3],k[4])
  361. @save_key_showing = true
  362. end
  363. #--------------------------------------------------------------------------
  364. # Create Common Event Key Hud(s)
  365. #--------------------------------------------------------------------------
  366. def create_common_ev_key_hud
  367. return unless $D13x[:Common_Ev_Keys]
  368. counter = 0
  369. CMN_Ev_Keys::Triggers.each do |b|
  370. next unless (b[3] == true)
  371. next if (b[2] != 0) && (!$game_switches[b[2]])
  372. @key_HUD << KM_HUD.new(b[0],b[4],b[5],b[6],b[7])
  373. toev = "@key_HUD_#{counter.to_s} = true"
  374. eval(toev)
  375. counter += 1
  376. end
  377. end
  378. #--------------------------------------------------------------------------
  379. # Create Regen Key
  380. #--------------------------------------------------------------------------
  381. def create_regen_key
  382. return unless $D13x[:MMO_Regen]
  383. k = MMO_Regen::Regen_HUD
  384. return unless k[2]
  385. return unless $game_switches[k[0]] if (k[0] != 0)
  386. @key_HUD << KM_HUD.new(MMO_Regen::Regen_Key,k[2],k[3],k[4],k[5])
  387. @regen_key_showing = true
  388. end
  389. #--------------------------------------------------------------------------
  390. # Dispose Litte Key HUD
  391. #--------------------------------------------------------------------------
  392. def dispose
  393. updt_KEY_HUD_SM
  394. if @key_HUD
  395. @key_HUD.each {|kh| kh.dispose }
  396. end
  397. end
  398. #--------------------------------------------------------------------------
  399. # Update Litte Key HUD
  400. #--------------------------------------------------------------------------
  401. def update
  402. disp_KEY_HUD_SM
  403. update_visible
  404. @key_HUD.each {|kh| kh.update } if @key_HUD
  405. end
  406. #--------------------------------------------------------------------------
  407. # Update Visible Hud Items
  408. #--------------------------------------------------------------------------
  409. def update_visible
  410. return unless @key_HUD
  411. update_pause_key
  412. update_menu_key
  413. update_items_key
  414. update_skills_key
  415. update_equips_key
  416. update_status_key
  417. update_save_key
  418. update_regen_key
  419. end
  420. #--------------------------------------------------------------------------
  421. # Update Pause Key
  422. #--------------------------------------------------------------------------
  423. def update_pause_key
  424. if (Key_Menu::Pause_Key[1] > 0)
  425. if $game_switches[Key_Menu::Pause_Key[1]]
  426. create_pause_key_hud if @pause_key_showing == false
  427. else
  428. create_KEY_HUD if (@pause_key_showing == true)
  429. end
  430. end
  431. end
  432. #--------------------------------------------------------------------------
  433. # Update Menu Key
  434. #--------------------------------------------------------------------------
  435. def update_menu_key
  436. if (Key_Menu::Menu_Key[1] > 0)
  437. if $game_switches[Key_Menu::Menu_Key[1]]
  438. create_menu_key_hud if @menu_key_showing == false
  439. else
  440. create_KEY_HUD if (@menu_key_showing == true)
  441. end
  442. end
  443. end
  444. #--------------------------------------------------------------------------
  445. # Update Items Key
  446. #--------------------------------------------------------------------------
  447. def update_items_key
  448. if (Key_Menu::Items_Key[1] > 0)
  449. if $game_switches[Key_Menu::Items_Key[1]]
  450. create_items_key_hud if @items_key_showing == false
  451. else
  452. create_KEY_HUD if (@items_key_showing == true)
  453. end
  454. end
  455. end
  456. #--------------------------------------------------------------------------
  457. # Update Skills Key
  458. #--------------------------------------------------------------------------
  459. def update_skills_key
  460. if (Key_Menu::Skills_Key[1] > 0)
  461. if $game_switches[Key_Menu::Skills_Key[1]]
  462. create_skills_key_hud if (@skills_key_showing == false)
  463. else
  464. create_KEY_HUD if (@skills_key_showing == true)
  465. end
  466. end
  467. end
  468. #--------------------------------------------------------------------------
  469. # Update Equips Key
  470. #--------------------------------------------------------------------------
  471. def update_equips_key
  472. if (Key_Menu::Equips_Key[1] > 0)
  473. if $game_switches[Key_Menu::Equips_Key[1]]
  474. create_equips_key_hud if @equips_key_showing == false
  475. else
  476. create_KEY_HUD if (@equips_key_showing == true)
  477. end
  478. end
  479. end
  480. #--------------------------------------------------------------------------
  481. # Update Status Key
  482. #--------------------------------------------------------------------------
  483. def update_status_key
  484. if (Key_Menu::Status_Key[1] > 0)
  485. if $game_switches[Key_Menu::Status_Key[1]]
  486. create_status_key_hud if @status_key_showing == false
  487. else
  488. create_KEY_HUD if (@status_key_showing == true)
  489. end
  490. end
  491. end
  492. #--------------------------------------------------------------------------
  493. # Update Save Key
  494. #--------------------------------------------------------------------------
  495. def update_save_key
  496. if (Key_Menu::Save_Key[1] > 0)
  497. if $game_switches[Key_Menu::Save_Key[1]]
  498. create_save_key_hud if @save_key_showing == false
  499. else
  500. create_KEY_HUD if (@save_key_showing == true)
  501. end
  502. end
  503. end
  504. #--------------------------------------------------------------------------
  505. # Update Regen Key
  506. #--------------------------------------------------------------------------
  507. def update_regen_key
  508. return unless $D13x[:MMO_Regen]
  509. k = MMO_Regen::Regen_HUD
  510. return unless k[2]
  511. if k[0] > 0
  512. if $game_switches[k[0]]
  513. create_regen_key if @regen_key_showing == false
  514. else
  515. create_KEY_HUD if (@regen_key_showing == true)
  516. end
  517. end
  518. end
  519.  
  520. end
  521.  
  522. #==============================================================================#
  523. # http://dekitarpg.wordpress.com/ #
  524. #==============================================================================#
  525. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement