VanCoolz

[RGSS/2] Map Shortcut

May 17th, 2012
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 6.80 KB | None | 0 0
  1. #==============================================================================
  2. # [RGSS/2] Map Shortcut
  3. # Version : 1.1
  4. # Author : LowlingLife
  5. # Original Script Author : Nefusa 7
  6. #==============================================================================
  7. # Re-make dari Nufus Simple Shortcut Key. Memanggil suatu scene atau common
  8. # event jika condition terpenuhi.
  9. #==============================================================================
  10. # Note :
  11. # Script ini adalah hasil remake script buatan Nefusa 7 yang bernama Nufus
  12. # Simple Shortcut Key. Jika ingin memakai, credit ke Nefusa 7 dan LowlingLife.
  13. #==============================================================================
  14. # CHANGELOG
  15. # V.1.0 | Original Release
  16. # V.1.1 | Add SWITCH_EVENT_SHORTCUT, KEY_EVENT_SHORTCUT, & VAR_EVENT_SHORTCUT.
  17. #==============================================================================
  18. module MapShortcut
  19.   #----------------------------------------------------------------------------
  20.   # * Switch
  21.   #----------------------------------------------------------------------------
  22.   # Switch ID => [Condition, Scene]
  23.   # Switch ID : ID dari Switch.
  24.   # Conditon : true = Memanggil scene jika Switch ON.
  25.   #             false = Memanggil scene jika Switch OFF.
  26.   # Scene : Nama scene yang akan dipanggil.
  27.   #----------------------------------------------------------------------------
  28.   SWITCH_SHORTCUT = {
  29.   1 => [true, Scene_Title.new],
  30.   2 => [true, Scene_Title.new]
  31.   } # Jangan di delete.
  32.  
  33.   #----------------------------------------------------------------------------
  34.   # * Variable
  35.   #----------------------------------------------------------------------------
  36.   # Variable ID => [Value, Scene]
  37.   # Variable ID : ID dari Variable.
  38.   # Value : Nilai variable yang jika tercapai memanggil scene.
  39.   # Scene : Nama scene yang akan dipanggil.
  40.   #----------------------------------------------------------------------------
  41.   VAR_SHORTCUT = {
  42.   1 => [5, Scene_Gameover.new],
  43.   2 => [6, Scene_Menu.new]
  44.   } # Jangan di delete.
  45.  
  46.   #---------------------------------------------------------------------------
  47.   # * Key
  48.   #---------------------------------------------------------------------------
  49.   # [Input Mode, Button, Scene]
  50.   # Input Mode : 1 = Input.press?
  51.   #            : 2 = Input.trigger? (Standard)
  52.   #            : 3 = Input.repeat?
  53.   # Button : Tombol di keyboard. Pencet F1 di game jika ingin mengetahui lebih
  54.   #          lanjut.
  55.   # Scene : Nama scene yang akan dipanggil.
  56.   #---------------------------------------------------------------------------
  57.   KEY_SHORTCUT = [
  58.   [2, Input::Y, Scene_Title.new],
  59.   [2, Input::X, Scene_Item.new]
  60.   ] # Jangan di delete.
  61.  
  62.   #----------------------------------------------------------------------------
  63.   # * Switch Common Event
  64.   #----------------------------------------------------------------------------
  65.   # Switch ID => [Condition, Common Event ID]
  66.   # Switch ID : ID dari Switch.
  67.   # Conditon : true = Memanggil scene jika Switch ON.
  68.   #            false = Memanggil scene jika Switch OFF.
  69.   # Common Event ID : ID dari Common Event yang akan dipanggil.
  70.   #----------------------------------------------------------------------------
  71.   SWITCH_EVENT_SHORTCUT = {
  72.    3 => [true, 11],
  73.    4 => [true, 21]
  74.    } # Jangan di delete.
  75.    
  76.   #----------------------------------------------------------------------------
  77.   # * Variable Common Event
  78.   #----------------------------------------------------------------------------
  79.   # Variable ID => [Value, Common Event ID]
  80.   # Variable ID : ID dari Variable.
  81.   # Value : Nilai variable yang jika tercapai memanggil scene.
  82.   # Common Event ID : ID dari Common Event yang akan dipanggil.
  83.   #----------------------------------------------------------------------------
  84.   VAR_EVENT_SHORTCUT = {
  85.   4 => [1, 31],
  86.   5 => [2, 41]
  87.   } # Jangan di delete.
  88.  
  89.   #---------------------------------------------------------------------------
  90.   # * Key Common Event
  91.   #---------------------------------------------------------------------------
  92.   # [Input Mode, Button, Scene]
  93.   # Input Mode : 1 = Input.press?
  94.   #            : 2 = Input.trigger? (Standard)
  95.   #            : 3 = Input.repeat?
  96.   # Button : Tombol di keyboard. Pencet F1 di game jika ingin mengetahui lebih
  97.   #          lanjut.
  98.   # Common Event ID : ID dari Common Event yang akan dipanggil.
  99.   #---------------------------------------------------------------------------
  100.   KEY_EVENT_SHORTCUT = [
  101.   [1, Input::L, 11]
  102.   ] # Jangan di delete.
  103.    
  104. end
  105. #==============================================================================
  106. # EDITING BEYOND THIS LINE CAN CAUSE DAMAGE TO YOUR GAME, THEREFORE EDIT
  107. # WITH YOUR OWN RISK.
  108. #==============================================================================
  109.  
  110. VX = defined?(Window_ActorCommand)
  111. mog1 = VX ? "Scene_Map < Scene_Base" : "Scene_Map"
  112. eval"
  113.  
  114. class #{mog1}
  115.  include MapShortcut
  116.  
  117.  alias map_shortcut_update update unless $@
  118.  def update
  119.    # Call Check Shortcut method.
  120.    check_shortcut
  121.    # Call the old method.
  122.    map_shortcut_update
  123.  end
  124.  
  125.  #----------------------------------------------------------------------------
  126.  # * Check Shortcut
  127.  #----------------------------------------------------------------------------
  128.  def check_shortcut
  129.    SWITCH_SHORTCUT.each{|switch, process|
  130.    if $game_switches[switch] == process[0]
  131.      $scene = process[1]
  132.    end
  133.    }
  134.    
  135.    KEY_SHORTCUT.each{|process|
  136.    if process[0] == 1
  137.      if Input.press?(process[1])
  138.        $scene = process[2]
  139.      end
  140.    elsif process[0] == 2
  141.      if Input.trigger?(process[1])
  142.        $scene = process[2]
  143.      end
  144.    elsif process[0] == 3
  145.      if Input.repeat?(process[1])
  146.        $scene = process[2]
  147.      end
  148.    end
  149.    }
  150.    
  151.    VAR_SHORTCUT.each{|variable, process|
  152.    if $game_variables[variable] == process[0]
  153.      $scene = process[1]
  154.    end
  155.    }
  156.    
  157.    SWITCH_EVENT_SHORTCUT.each{|switch, common|
  158.    if $game_switches[switch] == common[0]
  159.      $game_temp.common_event_id = common[1]
  160.    end
  161.    }
  162.    
  163.    VAR_EVENT_SHORTCUT.each{|variable, common|
  164.    if $game_variables[variable] == common[0]
  165.      $game_temp.common_event_id = common[1]
  166.    end
  167.    }
  168.    
  169.    KEY_EVENT_SHORTCUT.each{|common|
  170.    if common[0] == 1
  171.      if Input.press?(common[1])
  172.        $game_temp.common_event_id = common[2]
  173.      end
  174.    elsif common[0] == 2
  175.      if Input.trigger?(common[1])
  176.        $game_temp.common_event_id = common[2]
  177.      end
  178.    elsif common[0] == 3
  179.      if Input.repeat?(common[1])
  180.        $game_temp.common_event_id = common[2]
  181.      end
  182.    end
  183.    }
  184.    
  185.  end
  186.  #----------------------------------------------------------------------------
  187.  # END OF SCRIPT
  188.  #----------------------------------------------------------------------------
  189. end#"
Advertisement
Add Comment
Please, Sign In to add comment