Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if true # << Make true to use this script, false to disable.
- #===============================================================================
- #
- # ☆ $D13x - Key Menu HUD
- # -- Author : Dekita
- # -- Version : 1.2
- # -- Level : Easy / Normal
- # -- Requires : $D13x Key Menu v1.2+
- # -- Engine : RPG Maker VX Ace.
- #
- #===============================================================================
- # ☆ Import
- #-------------------------------------------------------------------------------
- $D13x={}if$D13x==nil
- $D13x[:Key_Menu]=true
- #===============================================================================
- # ☆ Updates
- #-------------------------------------------------------------------------------
- # D /M /Y
- # 17/o5/2o13 - Update, (hide each hud item)
- # - Compatibility, (Event Keys v1.1)
- # o4/o4/2o13 - Compatibility, (Key Menu v1.2)
- # 29/o3/2o13 - Started, Finished,
- #
- #===============================================================================
- # ☆ Introduction
- #-------------------------------------------------------------------------------
- # This script shows a little HUD for the keys used to trigger each menu item.
- # The hud image for each item will only be shown if its switch is active.
- # Requires $D13x Key Menu.
- #
- # v1.2 allows for each Common Event Key (from my Event Keys script) to have its
- # own little hud image. requires Event Keys v1.1+
- # v1.2 also allows for each hud key to be hidden unless the its switch
- # is turned on. (Switches are set in the Key Menu script && Event Keys script)
- #
- #===============================================================================
- # ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
- #===============================================================================
- # 1. You MUST give credit to "Dekita" !!
- # 2. You are NOT allowed to repost this script.(or modified versions)
- # 3. You are NOT allowed to convert this script.
- # 4. You are NOT allowed to use this script for Commercial games.
- # 5. ENJOY!
- #
- # "FINE PRINT"
- # By using this script you hereby agree to the above terms and conditions,
- # if any violation of the above terms occurs "legal action" may be taken.
- # Not understanding the above terms and conditions does NOT mean that
- # they do not apply to you.
- # If you wish to discuss the terms and conditions in further detail you can
- # contact me at http://dekitarpg.wordpress.com/
- #
- #===============================================================================
- # ☆ Instructions
- #-------------------------------------------------------------------------------
- # Place Below " ▼ Materials " and Above " ▼ Main " in your script editor.
- # Place Below $D13x Key Menu
- #
- #===============================================================================
- # ☆ Additional Credit
- #-------------------------------------------------------------------------------
- # DarthVollis - Script Feature Ideas,
- #
- #===============================================================================
- module Key_Menu
- #===============================================================================
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # ☆ Visible HUD Settings
- #-----------------------------------------------------------------------------
- # You can show a small graphic for each hud item,
- # NOTE : the graphic should be about 26x26 pixels in size
- # it will be shown below the icon for all visible key icons.
- # graphic should be placed in Graphics/System folder
- Show_HUD_Graphic = [ true , "Key_HUD_Square" ] # [ use? , graphic ]
- # Text Settings, used to adjust various settings for the Key shown
- # for each visible menu icon.
- # Settings = [ x , y , size, bold , color , outline col ]
- Text_Settings = [ 10 , 27, 18 , false, Text_Color::White,Text_Color::Black ]
- Text_Opacity = [ 155 , 255 ] # [ not pressed , pressed ]
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # ☆ Visible Icon Settings
- #-----------------------------------------------------------------------------
- # NOTE: will only be shown if the key is not :NONE
- # Menu Item = [show?, x , y , icon , icon hue]
- Menu_Key_HUD = [true , 0 , 0 , 0 , 0 ]
- Pause_Key_HUD = [true , 2 , 2 , 117 , 0 ]
- Save_Key_HUD = [true , 28 , 2 , 231 , 0 ]
- Items_Key_HUD = [true , 54 , 2 , 260 , 0 ]
- Status_Key_HUD = [true , 80 , 2 , 14 , 0 ]
- Skills_Key_HUD = [true , 106, 2 , 375 , 0 ]
- Equips_Key_HUD = [true , 132, 2 , 116 , 0 ]
- # This is the extra x and y position added to each icon.
- Icon_Settings = [ 1 , 1 ] # [ xtra x , xtra y ]
- end #####################
- # CUSTOMISATION END #
- #####################
- #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
- # #
- # http://dekitarpg.wordpress.com/ #
- # #
- #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
- #===============================================================================#
- # ARE YOU MODIFYING BEYOND THIS POINT? \.\. #
- # YES?\.\. #
- # OMG, REALLY? \| #
- # WELL SLAP MY FACE AND CALL ME A DRAGONITE.\..\.. #
- # I REALLY DIDN'T THINK YOU HAD IT IN YOU.\..\.. #
- #===============================================================================#
- class KM_HUD < Sprite
- #===============================================================================
- #--------------------------------------------------------------------------
- # Initalize Litte Key HUD
- #--------------------------------------------------------------------------
- def initialize(key,x,y,icon_id,hue)
- super()
- create_bg(x,y)
- create_icon(x,y,icon_id,hue)
- create_letter(x,y,key)
- end
- #--------------------------------------------------------------------------
- # Create BG
- #--------------------------------------------------------------------------
- def create_bg(x,y)
- bg_info = Key_Menu::Show_HUD_Graphic
- if bg_info[0] ; self.bitmap = Cache.system(bg_info[1])
- else ; self.bitmap = Bitmap.new(26,26) ; end
- self.z = 201
- self.x = (x)
- self.y = (y)
- end
- #--------------------------------------------------------------------------
- # Create Icon
- #--------------------------------------------------------------------------
- def create_icon(x,y,icon_id,hue)
- @icon = Sprite.new
- @icon.bitmap = Cache.icon("IconSet", hue)
- rect = Rect.new(icon_id % 16 * 24, icon_id / 16 * 24, 24, 24)
- @icon.bitmap.blt(0, 0, @icon.bitmap, rect, 255)
- @icon.src_rect.set(rect.x, rect.y, 24, 24)
- @icon.z = (self.z)
- @icon.x = x+Key_Menu::Icon_Settings[0]
- @icon.y = y+Key_Menu::Icon_Settings[1]
- end
- #--------------------------------------------------------------------------
- # Create Letter
- #--------------------------------------------------------------------------
- def create_letter(x,y,key)
- @keys = key.to_s
- wids = (24 * @keys.size)
- @letter = Sprite.new
- @letter.bitmap = Bitmap.new(wids,18)
- @letter.bitmap.font.name = General::Fonts
- @letter.bitmap.font.size = Key_Menu::Text_Settings[2]
- @letter.bitmap.font.bold = Key_Menu::Text_Settings[3]
- @letter.bitmap.font.color = Key_Menu::Text_Settings[4]
- @letter.bitmap.font.out_color = Key_Menu::Text_Settings[5]
- @letter.bitmap.draw_text(0,0,wids,18,@keys)
- @letter.z = (self.z)
- @letter.x = x+Key_Menu::Text_Settings[0]
- @letter.y = y+Key_Menu::Text_Settings[1]
- @letter.opacity = Key_Menu::Text_Opacity[0]
- end
- #--------------------------------------------------------------------------
- # Dispose Litte Key HUD
- #--------------------------------------------------------------------------
- def dispose
- super
- @icon.dispose if @icon
- @letter.dispose if @letter
- end
- #--------------------------------------------------------------------------
- # Update Litte Key HUD
- #--------------------------------------------------------------------------
- def update
- super
- @letter.opacity = Key_Menu::Text_Opacity[0]
- if Keys.press?(Keys::Key[@keys.to_sym])
- @letter.opacity = Key_Menu::Text_Opacity[1]
- end
- end
- end
- #===============================================================================
- class Spriteset_Map
- #===============================================================================
- #--------------------------------------------------------------------------
- # Initalize Litte Key HUD
- #--------------------------------------------------------------------------
- alias :init_KEY_HUD_SM :initialize
- alias :updt_KEY_HUD_SM :dispose
- alias :disp_KEY_HUD_SM :update
- #--------------------------------------------------------------------------
- # Initalize Litte Key HUD
- #--------------------------------------------------------------------------
- def initialize
- init_KEY_HUD_SM
- create_KEY_HUD
- end
- #--------------------------------------------------------------------------
- # Create Key HUD
- #--------------------------------------------------------------------------
- def create_KEY_HUD
- @key_HUD.each {|kh| kh.dispose } if @key_HUD
- @pause_key_showing = false
- @menu_key_showing = false
- @items_key_showing = false
- @skills_key_showing = false
- @equips_key_showing = false
- @status_key_showing = false
- @save_key_showing = false
- @regen_key_showing = false
- @key_HUD = []
- create_pause_key_hud
- create_menu_key_hud
- create_items_key_hud
- create_skills_key_hud
- create_equips_key_hud
- create_status_key_hud
- create_save_key_hud
- create_regen_key
- create_common_ev_key_hud
- end
- #--------------------------------------------------------------------------
- # Create Pause Key Hud
- #--------------------------------------------------------------------------
- def create_pause_key_hud
- return if !((Key_Menu::Pause_Key[0] != :NONE) && Key_Menu::Pause_Key_HUD[0])
- if ((Key_Menu::Pause_Key[1] > 0) && $game_switches[Key_Menu::Pause_Key[1]])
- make_pause_HUD
- elsif (Key_Menu::Pause_Key[1] <= 0)
- make_pause_HUD
- end
- end
- #--------------------------------------------------------------------------
- # Create Pause Key Hud
- #--------------------------------------------------------------------------
- def make_pause_HUD
- k = Key_Menu::Pause_Key_HUD
- @key_HUD << KM_HUD.new(Key_Menu::Pause_Key[0],k[1],k[2],k[3],k[4])
- @pause_key_showing = true
- end
- #--------------------------------------------------------------------------
- # Create Menu Key Hud
- #--------------------------------------------------------------------------
- def create_menu_key_hud
- return if !((Key_Menu::Menu_Key[0] != :NONE) && Key_Menu::Menu_Key_HUD[0])
- if (Key_Menu::Menu_Key[1] > 0) && $game_switches[Key_Menu::Menu_Key[1]]
- make_menu_HUD
- elsif (Key_Menu::Menu_Key[1] <= 0)
- make_menu_HUD
- end
- end
- #--------------------------------------------------------------------------
- # Create Menu Key Hud
- #--------------------------------------------------------------------------
- def make_menu_HUD
- k = Key_Menu::Menu_Key_HUD
- @key_HUD << KM_HUD.new(Key_Menu::Menu_Key[0],k[1],k[2],k[3],k[4])
- @menu_key_showing = true
- end
- #--------------------------------------------------------------------------
- # Create Items Key Hud
- #--------------------------------------------------------------------------
- def create_items_key_hud
- return if !((Key_Menu::Items_Key[0] != :NONE) && Key_Menu::Items_Key_HUD[0])
- if (Key_Menu::Items_Key[1] > 0) && $game_switches[Key_Menu::Items_Key[1]]
- make_items_HUD
- elsif (Key_Menu::Items_Key[1] <= 0)
- make_items_HUD
- end
- end
- #--------------------------------------------------------------------------
- # Create Items Key Hud
- #--------------------------------------------------------------------------
- def make_items_HUD
- k = Key_Menu::Items_Key_HUD
- @key_HUD << KM_HUD.new(Key_Menu::Items_Key[0],k[1],k[2],k[3],k[4])
- @items_key_showing = true
- end
- #--------------------------------------------------------------------------
- # Create Skills Key Hud
- #--------------------------------------------------------------------------
- def create_skills_key_hud
- return if !((Key_Menu::Skills_Key[0] != :NONE) && Key_Menu::Skills_Key_HUD[0])
- if (Key_Menu::Skills_Key[1] > 0) && $game_switches[Key_Menu::Skills_Key[1]]
- make_skills_HUD
- elsif (Key_Menu::Skills_Key[1] <= 0)
- make_skills_HUD
- end
- end
- #--------------------------------------------------------------------------
- # Create Skills Key Hud
- #--------------------------------------------------------------------------
- def make_skills_HUD
- k = Key_Menu::Skills_Key_HUD
- @key_HUD << KM_HUD.new(Key_Menu::Skills_Key[0],k[1],k[2],k[3],k[4])
- @skills_key_showing = true
- end
- #--------------------------------------------------------------------------
- # Create Equips Key Hud
- #--------------------------------------------------------------------------
- def create_equips_key_hud
- return if !((Key_Menu::Equips_Key[0] != :NONE) && Key_Menu::Equips_Key_HUD[0])
- if (Key_Menu::Equips_Key[1] > 0) && $game_switches[Key_Menu::Equips_Key[1]]
- make_equips_HUD
- elsif (Key_Menu::Equips_Key[1] <= 0)
- make_equips_HUD
- end
- end
- #--------------------------------------------------------------------------
- # Create Equips Key Hud
- #--------------------------------------------------------------------------
- def make_equips_HUD
- k = Key_Menu::Equips_Key_HUD
- @key_HUD << KM_HUD.new(Key_Menu::Equips_Key[0],k[1],k[2],k[3],k[4])
- @equips_key_showing = true
- end
- #--------------------------------------------------------------------------
- # Create Status Key Hud
- #--------------------------------------------------------------------------
- def create_status_key_hud
- return if !((Key_Menu::Status_Key[0] != :NONE) && Key_Menu::Status_Key_HUD[0])
- if (Key_Menu::Status_Key[1] > 0) && $game_switches[Key_Menu::Status_Key[1]]
- make_status_HUD
- elsif (Key_Menu::Status_Key[1] <= 0)
- make_status_HUD
- end
- end
- #--------------------------------------------------------------------------
- # Create Status Key Hud
- #--------------------------------------------------------------------------
- def make_status_HUD
- k = Key_Menu::Status_Key_HUD
- @key_HUD << KM_HUD.new(Key_Menu::Status_Key[0],k[1],k[2],k[3],k[4])
- @status_key_showing = true
- end
- #--------------------------------------------------------------------------
- # Create Save Key Hud
- #--------------------------------------------------------------------------
- def create_save_key_hud
- return if !((Key_Menu::Save_Key[0] != :NONE) && Key_Menu::Save_Key_HUD[0])
- if (Key_Menu::Save_Key[1] > 0) && $game_switches[Key_Menu::Save_Key[1]]
- make_save_HUD
- elsif (Key_Menu::Save_Key[1] <= 0)
- make_save_HUD
- end
- end
- #--------------------------------------------------------------------------
- # Create Save Key Hud
- #--------------------------------------------------------------------------
- def make_save_HUD
- k = Key_Menu::Save_Key_HUD
- @key_HUD << KM_HUD.new(Key_Menu::Save_Key[0],k[1],k[2],k[3],k[4])
- @save_key_showing = true
- end
- #--------------------------------------------------------------------------
- # Create Common Event Key Hud(s)
- #--------------------------------------------------------------------------
- def create_common_ev_key_hud
- return unless $D13x[:Common_Ev_Keys]
- counter = 0
- CMN_Ev_Keys::Triggers.each do |b|
- next unless (b[3] == true)
- next if (b[2] != 0) && (!$game_switches[b[2]])
- @key_HUD << KM_HUD.new(b[0],b[4],b[5],b[6],b[7])
- toev = "@key_HUD_#{counter.to_s} = true"
- eval(toev)
- counter += 1
- end
- end
- #--------------------------------------------------------------------------
- # Create Regen Key
- #--------------------------------------------------------------------------
- def create_regen_key
- return unless $D13x[:MMO_Regen]
- k = MMO_Regen::Regen_HUD
- return unless k[2]
- return unless $game_switches[k[0]] if (k[0] != 0)
- @key_HUD << KM_HUD.new(MMO_Regen::Regen_Key,k[2],k[3],k[4],k[5])
- @regen_key_showing = true
- end
- #--------------------------------------------------------------------------
- # Dispose Litte Key HUD
- #--------------------------------------------------------------------------
- def dispose
- updt_KEY_HUD_SM
- if @key_HUD
- @key_HUD.each {|kh| kh.dispose }
- end
- end
- #--------------------------------------------------------------------------
- # Update Litte Key HUD
- #--------------------------------------------------------------------------
- def update
- disp_KEY_HUD_SM
- update_visible
- @key_HUD.each {|kh| kh.update } if @key_HUD
- end
- #--------------------------------------------------------------------------
- # Update Visible Hud Items
- #--------------------------------------------------------------------------
- def update_visible
- return unless @key_HUD
- update_pause_key
- update_menu_key
- update_items_key
- update_skills_key
- update_equips_key
- update_status_key
- update_save_key
- update_regen_key
- end
- #--------------------------------------------------------------------------
- # Update Pause Key
- #--------------------------------------------------------------------------
- def update_pause_key
- if (Key_Menu::Pause_Key[1] > 0)
- if $game_switches[Key_Menu::Pause_Key[1]]
- create_pause_key_hud if @pause_key_showing == false
- else
- create_KEY_HUD if (@pause_key_showing == true)
- end
- end
- end
- #--------------------------------------------------------------------------
- # Update Menu Key
- #--------------------------------------------------------------------------
- def update_menu_key
- if (Key_Menu::Menu_Key[1] > 0)
- if $game_switches[Key_Menu::Menu_Key[1]]
- create_menu_key_hud if @menu_key_showing == false
- else
- create_KEY_HUD if (@menu_key_showing == true)
- end
- end
- end
- #--------------------------------------------------------------------------
- # Update Items Key
- #--------------------------------------------------------------------------
- def update_items_key
- if (Key_Menu::Items_Key[1] > 0)
- if $game_switches[Key_Menu::Items_Key[1]]
- create_items_key_hud if @items_key_showing == false
- else
- create_KEY_HUD if (@items_key_showing == true)
- end
- end
- end
- #--------------------------------------------------------------------------
- # Update Skills Key
- #--------------------------------------------------------------------------
- def update_skills_key
- if (Key_Menu::Skills_Key[1] > 0)
- if $game_switches[Key_Menu::Skills_Key[1]]
- create_skills_key_hud if (@skills_key_showing == false)
- else
- create_KEY_HUD if (@skills_key_showing == true)
- end
- end
- end
- #--------------------------------------------------------------------------
- # Update Equips Key
- #--------------------------------------------------------------------------
- def update_equips_key
- if (Key_Menu::Equips_Key[1] > 0)
- if $game_switches[Key_Menu::Equips_Key[1]]
- create_equips_key_hud if @equips_key_showing == false
- else
- create_KEY_HUD if (@equips_key_showing == true)
- end
- end
- end
- #--------------------------------------------------------------------------
- # Update Status Key
- #--------------------------------------------------------------------------
- def update_status_key
- if (Key_Menu::Status_Key[1] > 0)
- if $game_switches[Key_Menu::Status_Key[1]]
- create_status_key_hud if @status_key_showing == false
- else
- create_KEY_HUD if (@status_key_showing == true)
- end
- end
- end
- #--------------------------------------------------------------------------
- # Update Save Key
- #--------------------------------------------------------------------------
- def update_save_key
- if (Key_Menu::Save_Key[1] > 0)
- if $game_switches[Key_Menu::Save_Key[1]]
- create_save_key_hud if @save_key_showing == false
- else
- create_KEY_HUD if (@save_key_showing == true)
- end
- end
- end
- #--------------------------------------------------------------------------
- # Update Regen Key
- #--------------------------------------------------------------------------
- def update_regen_key
- return unless $D13x[:MMO_Regen]
- k = MMO_Regen::Regen_HUD
- return unless k[2]
- if k[0] > 0
- if $game_switches[k[0]]
- create_regen_key if @regen_key_showing == false
- else
- create_KEY_HUD if (@regen_key_showing == true)
- end
- end
- end
- end
- #==============================================================================#
- # http://dekitarpg.wordpress.com/ #
- #==============================================================================#
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement