Advertisement
TheSixth

Kadafi - Command Disabler - Modified by Sixth

Jun 19th, 2016
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 3.86 KB | None | 0 0
  1. # =============================================================================
  2. # Kadafi - Command Disabler
  3. # Version : 1.2
  4. # Contact : http://kakakadafi.blogspot.com or umarqadafi1@hotmail.com
  5. # =============================================================================
  6. ($imported ||= {})[:Kadafi_CommandDisabler] = true
  7. # =============================================================================
  8. # CHANGE LOGS:
  9. # -----------------------------------------------------------------------------
  10. # 2014.06.19 - Started and Finished script
  11. # 2014.06.20 - Added Formation, Save, and Escape Commands to configuration
  12. # 2014.06.20 - Updated the Script Structures
  13. # =============================================================================
  14. =begin
  15.  
  16.   Introduction :
  17.   This script allows you to disable almost all of the commands in every scene
  18.   by just turn ON / OFF the switches.
  19.  
  20.   How to Use :
  21.   [*] Turn ON the Switches to DISABLE the commands.
  22.   [*] Turn OFF the Switches to RE-ENABLE the commands.
  23.  
  24.   Special Thanks :
  25.   TheoAllen
  26.   KilloZapit
  27.  
  28.   TERMS OF USE :
  29.   Free for use on any non-Commercial or Commercial Game Projects.
  30.   If you use this for commercial uses,
  31.   give me a free copy of your game would be nice :)
  32.   Credit: Kadafi
  33.  
  34. =end
  35. # =============================================================================
  36. # Configuration
  37. # =============================================================================
  38. module Kadafi
  39.   module CommandDisabler
  40.    
  41.   Switch_Disabler = {
  42.  
  43. # =============================================================================
  44. #   "Command Name" => switch_id
  45. #   The name of the "Command Name" must be the same as Command Name
  46. #   in the database or vocab.
  47. # =============================================================================
  48.     "Scene_Menu" => { # Menu
  49.       "Items"     => 1,  # Items switch
  50.       "Skills"    => 2,  # Skills switch
  51.       "Equipment" => 3,  # Equipment switch
  52.       "Status"    => 4,  # Status switch
  53.       "Formation" => 5,  # Formation switch
  54.       "Save"      => 6,  # Save switch
  55.       "Game End"  => 7,  # Game End switch
  56.     },
  57.    
  58.     "Scene_Item" => { # Menu > Items
  59.       "Items"     => 8,  # Weapons switch
  60.       "Weapons"   => 9,  # Weapons switch
  61.       "Armours"   => 10, # Armours switch
  62.       "Key Items" => 11, # Key Items switch
  63.     },
  64.    
  65.     "Scene_Skill" => { # Menu > Skills
  66.       "Special"   => 12, # Game End switch
  67.     },
  68.    
  69.     "Scene_Equipment" => { # Menu > Equipment
  70.       "Change"    => 13, # Change switch
  71.       "Optimize"  => 14, # Optimize switch
  72.       "Clear"     => 15, # Clear switch
  73.     },
  74.    
  75.     "Scene_Shop" => { # Shop
  76.       "Buy"       => 16, # Buy switch
  77.     },
  78.    
  79.     "Scene_Battle" => { # Battle
  80.      
  81.       "Escape"    => 17, # Escape switch
  82.       "Attack"    => 18, # Attack switch
  83.       "Special"   => 19, # Skills switch
  84.       "Guard"     => 20, # Guard switch
  85.       "Items"     => 21, # Items switch
  86.     },
  87.    
  88.   } # <<< Don't touch this. - Or anything below this. :P
  89.  
  90.   def self.reg_check(txt)
  91.     result = txt =~ /#<(.*):(.*)>/
  92.     return $1
  93.   end
  94.  
  95.   end
  96. end
  97. # =============================================================================
  98. # End of Configuration
  99. # =============================================================================
  100. class Window_Command < Window_Selectable
  101.   alias_method :add_command_switch_base, :add_command
  102.   def add_command(name, symbol, enabled = true, ext = nil)
  103.     c_scene = Kadafi::CommandDisabler.reg_check(SceneManager.scene.to_s)
  104.     if Kadafi::CommandDisabler::Switch_Disabler[c_scene] &&
  105.       Kadafi::CommandDisabler::Switch_Disabler[c_scene][name]
  106.     switch_id = Kadafi::CommandDisabler::Switch_Disabler[c_scene][name]
  107.     enabled = !$game_switches[switch_id] if switch_id
  108.     end
  109.     add_command_switch_base(name, symbol, enabled, ext)
  110.   end
  111. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement