Advertisement
u5ern4m3123

Button_Common_Events.rb

Apr 9th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 4.93 KB | None | 0 0
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Button Common Events v1.00
  4. # -- Last Updated: 2012.01.09
  5. # -- Level: Normal
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================
  9.  
  10. $imported = {} if $imported.nil?
  11. $imported["YEA-ButtonCommonEvents"] = true
  12.  
  13. #==============================================================================
  14. # ▼ Updates
  15. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  16. # 2012.01.09 - Started Script and Finished.
  17. # 2019 - Anonymous edit that added all the applicable key bindings
  18. #==============================================================================
  19. # ▼ Introduction
  20. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  21. # RPG Maker VX Ace supports 8 different action buttons to use. However, only
  22. # 3 of those are used (A, B, and C) on the field map. The rest of them aren't
  23. # used at all. This script allows usage of the L, R, X, Y, and Z buttons by
  24. # binding them to common events.
  25. #
  26. #==============================================================================
  27. # ▼ Instructions
  28. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  29. # To install this script, open up your script editor and copy/paste this script
  30. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  31. #
  32. # Modify the COMMON_EVENT hash in the script module to adjust which common
  33. # events are used for each button.
  34. #
  35. #==============================================================================
  36. # ▼ Compatibility
  37. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  38. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  39. # it will run with RPG Maker VX without adjusting.
  40. #
  41. #==============================================================================
  42.  
  43. module YEA
  44.   module BUTTON_EVENT
  45.    
  46.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  47.     # - Button Settings -
  48.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  49.     # This sets the common events that are to run when the particular button
  50.     # is pressed. The following chart shows the respective keyboard buttons.
  51.     #
  52.     #   :Button    Default Keyboard Button
  53.     #      :L        Q
  54.     #      :R        W
  55.     #      :X        A
  56.     #      :Y        S
  57.     #      :Z        D
  58.     #
  59.     # If you do not wish to associate a button with a common event, set the
  60.     # common event for that button to 0.
  61.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  62.     COMMON_EVENT ={
  63.     # :Button => Common Event,
  64.            :L =>   1,    # Runs common event 1
  65.            :R =>   0,
  66.            :X =>   0,
  67.            :Y =>   0,
  68.            :Z =>   0,
  69.  
  70.            :SHIFT =>   0,  #Since this is the run button, I don't recommend this one
  71.  
  72.            :CTRL =>   0,
  73.            :ALT =>   0,
  74.            
  75.            :F5 =>   0,
  76.            :F6 =>   0,
  77.            :F7 =>   0,
  78.            :F8 =>   0,
  79.            :F9 =>   0,      
  80.            
  81.            #These are not recommended to be used, for obvious reasons
  82.            :UP =>   0,
  83.            :DOWN =>   0,
  84.            :LEFT =>   0,
  85.            :RIGHT =>   0,
  86.            
  87.     } # Do not remove this.
  88.    
  89.   end # BUTTON_EVENT
  90. end # YEA
  91.  
  92. #==============================================================================
  93. # ▼ Editting anything past this point may potentially result in causing
  94. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  95. # halitosis so edit at your own risk.
  96. #==============================================================================
  97.  
  98. #==============================================================================
  99. # ■ Scene_Map
  100. #==============================================================================
  101.  
  102. class Scene_Map < Scene_Base
  103.  
  104.   #--------------------------------------------------------------------------
  105.   # alias method: update_scene
  106.   #--------------------------------------------------------------------------
  107.   alias scene_map_update_scene_bce update_scene
  108.   def update_scene
  109.     scene_map_update_scene_bce
  110.     update_button_common_events unless scene_changing?
  111.   end
  112.  
  113.   #--------------------------------------------------------------------------
  114.   # new method: update_button_common_events
  115.   #--------------------------------------------------------------------------
  116.   def update_button_common_events
  117.     for key in YEA::BUTTON_EVENT::COMMON_EVENT
  118.       next unless Input.trigger?(key[0])
  119.       next if key[1] <= 0
  120.       $game_temp.reserve_common_event(key[1])
  121.     end
  122.   end
  123.  
  124. end # Scene_Map
  125.  
  126. #==============================================================================
  127. #
  128. # ▼ End of File
  129. #
  130. #==============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement