[XP] Heretic's Disable Battle Commands

Heretic's Disable Battle Commands
Authors: Heretic
Version: 1.0
Type: Battle Add-on



Introduction

This script allows you to Disable or Enable the commands for "Attack", "Skill", "Defend", or "Item", and whatever other custom Commands may be a part of your Battle System.

It is very useful for creating Tutorials for players where you need to force a Player to choose a specific action. To do this, you just disable the commands you do not want the Player to choose.

Features


[list=]Easy Script Calls to Enable or Disable any Commands
Should be compatible with other Languages
Commands are based on the Text of the Command itself for high compatability.[/list]


Screenshots

No Screenshots. Basically it just makes commands that you choose to disable come up in "disabled_color" and plays your systems "Buzzer-SE" to let a Player know that they are not able to select that specific command.

Demo

No demo yet. I'll throw it in as part of the "Collection" and edit this to link to it or another demo once a demo is created.

Script

Put above Main, but below your Battle System and Menu Systems.

Content Hidden Spoiler
  1. #===============================================================================
  2. #
  3. #           HERETIC'S DISABLE BATTLE COMMANDS
  4. #           Version 1.0
  5. #           Monday, June 2nd, 2014
  6. #
  7. #===============================================================================
  8. #
  9. #  This script will allow you to easily Enable and Disable the Battle Commands
  10. #  for your Actors.  The default Battle Menu Commands like "Attack", "Skill"
  11. #  "Defend", and "Item".  This script was designed to check the text of
  12. #  each Command so you can disable the French word for "Attack", or if you
  13. #  changed stuff to allow for "Super Attack", you can enable or disable
  14. #  those Commands as well.
  15. #
  16. #  All Battle Commands are Enabled by Default.
  17. #
  18. #  There are times that it is useful to Disable Commands.  Some Tutorials can
  19. #  take advantage of disabling all the Battle Commands except the one you want
  20. #  the Player to select.  Other times, it may be based on some condition in
  21. #  your game.
  22. #
  23. #  This script will check the context of each word, so if your "Words" are
  24. #  different, this script should still work, or can be easily modified to
  25. #  be compatible with other Battle Systems.  This also allows foreign Laguages
  26. #  to also be compatible.
  27. #
  28. #  To enable or disable a Command, just put in the Actors ID from the Database
  29. #  and the "Word" you want to disable.
  30. #
  31. #  disable_command(1, "Attack")
  32. #
  33. #  NOTE: The "Word" you want to change MUST BE IN QUOTES.
  34. #
  35. #
  36. #  The above command will make the Battle Command of "Attack" come up greyed
  37. #  out as a visual indication to the Player that it has been disabled.  If
  38. #  the Player tries to enter the command anyway, the system will play the
  39. #  "Buzzer Sound" set in the Database.
  40. #
  41. #  To ENABLE a Command, simply use the Actors ID from the Database and the
  42. #  the "Word" you want to enable.
  43. #
  44. #  enable_command(1, "Attack")
  45. #
  46. #  Once a Command has been Disabled, you MUST re-enable it for the Player
  47. #  to ever use it again.  The Disabled Command will not reset after battle.
  48. #
  49. #  You can enable disable Multiple Commands also, just not in one script call.
  50. #
  51. #  disable_command(1, "Skill")
  52. #  disable_command(1, "Defend")
  53. #  disable_command(1, "Item")
  54. #
  55. #  The above script calls will prevent your Player from selecting any of
  56. #  those Commands from the Command Window.  However, the Player can still
  57. #  "Cancel" and skip to the next actor, or whatever your Battle System is
  58. #  configured to do.
  59. #
  60. #  To prevent a Player from being able to "Cancel", use the following script.
  61. #
  62. #  disable_cancel(1)
  63. #
  64. #  That script call will prevent Aluxes from being able to "Cancel" to the
  65. #  next Actor.  When combined with disable_command(actor_id, word), you force
  66. #  the Player to have only one option to choose from.  Its VERY useful for
  67. #  creating Tutorial Battles.
  68. #
  69. #  You can enable or disable Commands or Cancels for more than just one Actor
  70. #  at a time.  For that, I put together a couple quick script calls to do it
  71. #  all for you.
  72. #
  73. #  These script calls can be run either During Battle or Outside of Battle.
  74. #
  75. #  Note: They are Per Actor.  It doesnt matter what position they are in.
  76. #
  77. #
  78. #  ---  LIST OF SCRIPT CALLS  ---
  79. #
  80. #  - Single Actor Commands -
  81. #
  82. #  enable_command(actor_id, "Word to Enable in Quotes")
  83. #  disable_command(actor_id, "Word to Disable in Quotes")
  84. #
  85. #
  86. #  - Single Actor Cancel (skip to next actor or defend) -
  87. #
  88. #  enable_cancel(actor_id)
  89. #  disable_cancel(actor_id)
  90. #
  91. #
  92. #  - Party Actor Commands and Cancels -
  93. #
  94. #  enable_command_party("Word to Enable")
  95. #  disable_command_party("Word to Disable")
  96. #  enable_cancel_party
  97. #  disable_cancel_party
  98. #
  99. #
  100. #  - All Actors, even ones NOT in your Party -
  101. #  
  102. #  enable_command_all("Word to Enable")
  103. #  disable_command_all("Word to Disable")
  104. #  enable_cancel_all
  105. #  disable_cancel_all
  106. #
  107. #
  108. #  ---  NOTES  ---
  109. #
  110. #  Please be careful if you Add or Remove Actors as Commands, once Disabled
  111. #  will STAY that way.
  112. #
  113. #  ---  COMPATABILITY  ---
  114. #
  115. #  This script should work with most Battle Systems, excluding Map Based Systems
  116. #  like BlizzABS.  The Actor Command Window is normally a Window_Command which
  117. #  inherits from Window_Selectable.  If the Battle System you are using has
  118. #  altered @actor_command_window = Window_Command.new(params) to NOT be a
  119. #  class of Window_Command, the fix should be super easy.  Just change the
  120. #  name of the class in this script for Window_Command to whatever your
  121. #  Battle System uses.
  122. #
  123. #==============================================================================
  124.  
  125. #==============================================================================
  126. # ** Interpreter
  127. #==============================================================================
  128. class Interpreter
  129.   #--------------------------------------------------------------------------
  130.   # * Enable Cancel - Enables ability to Cancel while Command Window is open
  131.   #     actor_id  : Actor ID in the Database, does not matter where in Party
  132.   #--------------------------------------------------------------------------    
  133.   def enable_cancel(actor_id)
  134.     # If Actor ID isnt a Number
  135.     if not actor_id.is_a?(Numeric)
  136.       # Explain Error
  137.       print "Warning: enable_cancel(actor_id) expects\n",
  138.             "actor_id to be a Number!\n\n",
  139.             actor_id, " is not a Number!" if $DEBUG
  140.       # Note: I would have actually allowed for disabling by Names, but
  141.       # I cant do it because Actors Names can be changed during gameplay
  142.       # which can lead to unpredictable outcomes
  143.            
  144.       # Prevent Crash
  145.       return
  146.     # Actor isnt a Valid Actor
  147.     elsif not $data_actors[actor_id]
  148.       # Explain Error
  149.       print "Warning: enable_cancel(actor_id)\n\n",
  150.             "The Actor: ", actor_id, " isn't a Valid Actor!" if $DEBUG
  151.       # Prevent Crash
  152.       return
  153.     end
  154.     # Get the Actor based on Actor ID
  155.     actor = $game_actors[actor_id]
  156.     # If Cancel not already Disabled
  157.     if actor.disabled_menu_words.include?("Cancel")
  158.       # Disable Cancelling Inputs for that Actor
  159.       actor.disabled_menu_words.delete("Cancel")
  160.     end
  161.   end  
  162.   #--------------------------------------------------------------------------
  163.   # * Disable Cancel - Disables ability to Cancel while Command Window is open
  164.   #     actor_id  : Actor ID in the Database, does not matter where in Party
  165.   #--------------------------------------------------------------------------    
  166.   def disable_cancel(actor_id)
  167.     # If Actor ID isnt a Number
  168.     if not actor_id.is_a?(Numeric)
  169.       # Explain Error
  170.       print "Warning: disable_cancel(actor_id) expects\n",
  171.             "actor_id to be a Number!\n\n",
  172.             actor_id, " is not a Number!" if $DEBUG
  173.       # Note: I would have actually allowed for disabling by Names, but
  174.       # I cant do it because Actors Names can be changed during gameplay
  175.       # which can lead to unpredictable outcomes
  176.            
  177.       # Prevent Crash
  178.       return
  179.     # Actor isnt a Valid Actor
  180.     elsif not $data_actors[actor_id]
  181.       # Explain Error
  182.       print "Warning: disable_cancel(actor_id)\n\n",
  183.             "The Actor: ", actor_id, " isn't a Valid Actor!" if $DEBUG
  184.       # Prevent Crash
  185.       return
  186.     end
  187.     # Get the Actor based on Actor ID
  188.     actor = $game_actors[actor_id]
  189.     # If Cancel not already Disabled
  190.     if not actor.disabled_menu_words.include?("Cancel")
  191.       # Disable Cancelling Inputs for that Actor
  192.       actor.disabled_menu_words.push("Cancel")
  193.     end
  194.   end
  195.   #--------------------------------------------------------------------------
  196.   # * Enable Cancel Party - Enables Cancelling Command Windows for Party
  197.   #
  198.   #   - Note: Watch for changes to your Party!
  199.   #--------------------------------------------------------------------------    
  200.   def enable_cancel_party
  201.     # For each Actor in your active Party
  202.     for actor in $game_party.actors
  203.       # Enable the ability to Cancel
  204.       enable_cancel(actor.id)
  205.     end
  206.   end
  207.   #--------------------------------------------------------------------------
  208.   # * Disable Cancel Party - Disables Cancelling Command Windows for Party
  209.   #
  210.   #   - Note: Watch for changes to your Party!
  211.   #--------------------------------------------------------------------------    
  212.   def disable_cancel_party
  213.     # For each Actor in your active Party
  214.     for actor in $game_party.actors
  215.       # Enable the ability to Cancel
  216.       disable_cancel(actor.id)
  217.     end
  218.   end  
  219.   #--------------------------------------------------------------------------
  220.   # * Enable Cancel All - Enables Cancelling Command Windows for All Actors
  221.   #
  222.   #   - Note: Enables Cancel for Actors not in your Party also
  223.   #--------------------------------------------------------------------------    
  224.   def enable_cancel_all
  225.     # For Everyone, All Actors, even ones not in Party
  226.     for i in 0..$game_actors.size
  227.       # Get the Actor
  228.       actor = $game_actors[i]
  229.       # Enable the ability to Cancel
  230.       enable_cancel(actor.id) if not actor.nil?
  231.     end
  232.   end
  233.   #--------------------------------------------------------------------------
  234.   # * Disable Cancel All - Disables Cancelling Command Windows for All Actors
  235.   #
  236.   #   - Note: Disables Cancel for Actors not in your Party also
  237.   #--------------------------------------------------------------------------    
  238.   def disable_cancel_all
  239.     # For Everyone, All Actors, even ones not in Party
  240.     for i in 0..$game_actors.size
  241.       # Get the Actor
  242.       actor = $game_actors[i]
  243.       # Enable the ability to Cancel
  244.       disable_cancel(actor.id) if not actor.nil?
  245.     end
  246.   end
  247.   #--------------------------------------------------------------------------
  248.   # * Enable Command - Disables Command for Battle Commands (Item, Skill, etc)
  249.   #     actor_id  : Actor ID in the Database, does not matter where in Party
  250.   #     menu_word : The Text of the Menu Word to be disabled (Attack, Item, etc)
  251.   #
  252.   #   - Note: Default is all Commands are already Enabled
  253.   #   - Useful for Tutorial Battles
  254.   #--------------------------------------------------------------------------  
  255.   def enable_command(actor_id, menu_word)
  256.     # If Actor ID isnt a Number
  257.     if not actor_id.is_a?(Numeric)
  258.       # Explain Error
  259.       print "Warning: disable_menu(actor_id, menu_word) expects\n",
  260.             "actor_id to be a Number!\n\n",
  261.             actor_id, " is not a Number!" if $DEBUG
  262.       # Note: I would have actually allowed for disabling by Names, but
  263.       # I cant do it because Actors Names can be changed during gameplay
  264.       # which can lead to unpredictable outcomes
  265.            
  266.       # Prevent Crash
  267.       return
  268.     # Actor isnt a Valid Actor
  269.     elsif not $data_actors[actor_id]
  270.       # Explain Error
  271.       print "Warning: disable_menu(actor_id, menu_word)\n\n",
  272.             "The Actor: ", actor_id, " isn't a Valid Actor!" if $DEBUG
  273.       # Prevent Crash
  274.       return
  275.     # If the Menu Word is not a String like "Fight" or "Item"
  276.     elsif not menu_word.is_a?(String)
  277.       # Explain Error
  278.       print "Warning: disable_menu(actor_id, menu_word)\n\n",
  279.             "menu_word needs to be the Battle Command Word that\n",
  280.             "you wish to Disable!\n\n",
  281.             "Examples:\n",
  282.             "# Disable Aluxes Fight Menu Item\n",
  283.             "disable_menu(1, \"Fight\"\n",
  284.             "# Disable Hilda Skill Menu Item\n",
  285.             "disable_menu(8, \"Skill\"" if $DEBUG
  286.       # Prevent Crash
  287.       return
  288.     elsif menu_word == ""
  289.       # Explain Error
  290.       print "Warning: disable_menu(actor_id, menu_word)\n\n",
  291.             "menu_item can not be blank!\n",
  292.             "disable_menu(", actor_id," \"\")" if $DEBUG
  293.       # Prevent Crash
  294.       return        
  295.     end
  296.     # Get the Actor based on Actor ID
  297.     actor = $game_actors[actor_id]
  298.     # If Item not already Disabled
  299.     if actor.disabled_menu_words.include?(menu_word)
  300.       # Disable the Menu Item for that Actor
  301.       actor.disabled_menu_words.delete(menu_word)
  302.     end
  303.   end
  304.   #--------------------------------------------------------------------------
  305.   # * Disable Command - Disables Commands for Battle Commands (Item, Skill, etc)
  306.   #     actor_id  : Actor ID in the Database, does not matter where in Party
  307.   #     menu_word : The Text of the Menu Word to be disabled (Attack, Item, etc)
  308.   #--------------------------------------------------------------------------  
  309.   def disable_command(actor_id, menu_word)
  310.     # If Actor ID isnt a Number
  311.     if not actor_id.is_a?(Numeric)
  312.       # Explain Error
  313.       print "Warning: disable_menu(actor_id, menu_word) expects\n",
  314.             "actor_id to be a Number!\n\n",
  315.             actor_id, " is not a Number!" if $DEBUG
  316.       # Note: I would have actually allowed for disabling by Names, but
  317.       # I cant do it because Actors Names can be changed during gameplay
  318.       # which can lead to unpredictable outcomes
  319.            
  320.       # Prevent Crash
  321.       return
  322.     # Actor isnt a Valid Actor
  323.     elsif not $data_actors[actor_id]
  324.       # Explain Error
  325.       print "Warning: disable_menu(actor_id, menu_word)\n\n",
  326.             "The Actor: ", actor_id, " isn't a Valid Actor!" if $DEBUG
  327.       # Prevent Crash
  328.       return
  329.     # If the Menu Word is not a String like "Fight" or "Item"
  330.     elsif not menu_word.is_a?(String)
  331.       # Explain Error
  332.       print "Warning: disable_menu(actor_id, menu_word)\n\n",
  333.             "menu_word needs to be the Battle Command Word that\n",
  334.             "you wish to Disable!\n\n",
  335.             "Examples:\n",
  336.             "# Disable Aluxes Fight Menu Item\n",
  337.             "disable_menu(1, \"Fight\"\n",
  338.             "# Disable Hilda Skill Menu Item\n",
  339.             "disable_menu(8, \"Skill\"" if $DEBUG
  340.       # Prevent Crash
  341.       return
  342.     elsif menu_word == ""
  343.       # Explain Error
  344.       print "Warning: disable_menu(actor_id, menu_word)\n\n",
  345.             "menu_item can not be blank!\n",
  346.             "disable_menu(", actor_id," \"\")" if $DEBUG
  347.       # Prevent Crash
  348.       return        
  349.     end
  350.     # Get the Actor based on Actor ID
  351.     actor = $game_actors[actor_id]
  352.     # If Item not already Disabled
  353.     if not actor.disabled_menu_words.include?(menu_word)
  354.       # Disable the Menu Item for that Actor
  355.       actor.disabled_menu_words.push(menu_word)
  356.     end
  357.   end
  358.   #--------------------------------------------------------------------------
  359.   # * Enable Command Party - Enables Battle Commands for everyone in the Party
  360.   #    menu_word : The Text of the Menu Word to be disabled (Attack, Item, etc)  
  361.   #
  362.   #   - Note: Watch for changes to your Party!
  363.   #--------------------------------------------------------------------------    
  364.   def enable_command_party(menu_word)
  365.     # For each Actor in your active Party
  366.     for actor in $game_party.actors
  367.       # Enable the Command from the Menu
  368.       enable_command(actor.id, menu_word)
  369.     end
  370.   end
  371.   #--------------------------------------------------------------------------
  372.   # * Disable Command Party - Disables Battle Commands for everyone in Party
  373.   #    menu_word : The Text of the Menu Word to be disabled (Attack, Item, etc)  
  374.   #
  375.   #   - Note: Watch for changes to your Party!
  376.   #--------------------------------------------------------------------------    
  377.   def disable_command_party(menu_word)
  378.     # For each Actor in your active Party
  379.     for actor in $game_party.actors
  380.       # Disable the Command from the Menu
  381.       disable_command(actor.id, menu_word)
  382.     end
  383.   end  
  384.   #--------------------------------------------------------------------------
  385.   # * Enable Command All - Enables Battle Commands for everyone in Party
  386.   #    menu_word : The Text of the Menu Word to be disabled (Attack, Item, etc)  
  387.   #
  388.   #   - Note: Enables Commands for Actors not in your Party also
  389.   #--------------------------------------------------------------------------    
  390.   def enable_command_all(menu_word)
  391.     # For Everyone, All Actors, even ones not in Party
  392.     for i in 0..$game_actors.size
  393.       # Get the Actor
  394.       actor = $game_actors[i]
  395.       # Enable the Command from the Menu
  396.       enable_command(actor.id, menu_word) if not actor.nil?
  397.     end
  398.   end
  399.   #--------------------------------------------------------------------------
  400.   # * Disable Command All - Disables Battle Commands for everyone in Party
  401.   #    menu_word : The Text of the Menu Word to be disabled (Attack, Item, etc)  
  402.   #
  403.   #   - Note: Disables Commands for Actors not in your Party also
  404.   #--------------------------------------------------------------------------    
  405.   def disable_command_all(menu_word)
  406.     # For Everyone, All Actors, even ones not in Party
  407.     for i in 0..$game_actors.size
  408.       # Get the Actor
  409.       actor = $game_actors[i]
  410.       # Enable the ability to Cancel
  411.       disable_command(actor.id, menu_word) if not actor.nil?
  412.     end
  413.   end
  414. end
  415.  
  416. #==============================================================================
  417. # ** Window_Command
  418. #
  419. #  NOTE:  You may need to change the name of the class here to make this
  420. #         script compatible with certain Battle Systems.
  421. #
  422. #==============================================================================
  423. class Window_Command < Window_Selectable
  424.   #--------------------------------------------------------------------------
  425.   # * Public Instance Variables
  426.   #--------------------------------------------------------------------------
  427.   attr_accessor :commands           # Contains Command Words for Battle Menu
  428.   attr_accessor :actor_window       # Tells if Window is for Actor Commands
  429.   #--------------------------------------------------------------------------
  430.   # * Object Initialization
  431.   #     width    : window width
  432.   #     commands : command text string array
  433.   #--------------------------------------------------------------------------
  434.   alias disable_battle_menu_window_command_initialize initialize
  435.   def initialize(width, commands)
  436.     # Call Original or other Aliases
  437.     disable_battle_menu_window_command_initialize(width, commands)
  438.     # Add new Property
  439.     @actor_window = false
  440.   end
  441.   #--------------------------------------------------------------------------
  442.   # * Visible=
  443.   #     value : true / false
  444.   #
  445.   #   - Sets the Visibility of this Window while doing other checks
  446.   #--------------------------------------------------------------------------
  447.   def visible=(value)
  448.     # Ignore if this Command Window is not used for Actor Battle Commands
  449.     if value == true and @actor_window == true and $scene.is_a?(Scene_Battle)
  450.       # Check the Actor Command Window for Disabled Items
  451.       $scene.check_actor_window_commands
  452.     end
  453.     # Set the Value of Parent regardless of Value, typically True or False
  454.     super(value)
  455.   end
  456. end
  457.  
  458. #==============================================================================
  459. # ** Scene_Battle
  460. #
  461. #    If the name of your Command Window is not @actor_command_window, then
  462. #    you'll need to edit this part of the script to call to whatever your
  463. #    Battle or Menu System uses.
  464. #    
  465. #    It may also be necessary to change the name of the method for checking
  466. #    the Inputs from the Player to match the method used in your game.
  467. #
  468. #==============================================================================
  469. class Scene_Battle
  470.   #--------------------------------------------------------------------------
  471.   # * Start Pre-Battle Phase
  472.   #
  473.   #   The Battle System uses several Command Windows.  This helps to identify
  474.   #   which of those Command Windows is being used for getting the Actors
  475.   #   Commands.
  476.   #
  477.   #   In the normal battle system and XRXS battle system, this is called before
  478.   #   the Actors Battle Command Window appears.  This allows the script to
  479.   #   know which window does what, as there are multiple Window_Selectable
  480.   #   windows in the Battle Scene.  Yeah, it does get called multiple times
  481.   #   but it isnt frequent enough to affect performance.
  482.   #
  483.   #--------------------------------------------------------------------------
  484.   alias disable_battle_menu_start_phase1 start_phase1
  485.   def start_phase1
  486.     # Call Original or other Aliases
  487.     disable_battle_menu_start_phase1
  488.     # Designates the Actor Command Window Variable for Updates
  489.     @actor_command_window.actor_window = true
  490.   end
  491.   #--------------------------------------------------------------------------
  492.   # * Check Actor Window Commands
  493.   #
  494.   #   - Draws the Commands available to that Actor.  Enabled Items use
  495.   #     the normal_color, typically white, and disabled Commands are
  496.   #     drawn using disabled_color, typically grey or subdued.
  497.   #
  498.   #     This method is called when an identified Actor Command Window is
  499.   #     set to become visible.  Thus, before it appears, it checks the
  500.   #     text of each command to to enable and disable appropriately.
  501.   #
  502.   #--------------------------------------------------------------------------
  503.   def check_actor_window_commands
  504.    
  505.     # Window Object for displaying Actor Battle Menu Items
  506.     # NOTE: Change this name for Incompatability issues
  507.     window = @actor_command_window
  508.    
  509.     # Get Actor for the Visible Menu
  510.     actor = $game_party.actors[@actor_index]
  511.     # Check if the Commands are Enabled or Disabled
  512.     for index in 0...@actor_command_window.commands.size
  513.       # The Command Text from the List of displayed Menu Items
  514.       cmd = window.commands[index]
  515.       # If that Command Text has been disabled for this Actor
  516.       if actor.disabled_menu_words.include?(cmd)
  517.         # Disable that Command with Disabled Text Color on the Menu
  518.         window.disable_item(index)
  519.       # Then this Command Text is Enabled for this Actor
  520.       else
  521.         # Draw that Command with Normal Text Color on the Menu
  522.         window.draw_item(index, window.normal_color)
  523.       end
  524.     end
  525.   end
  526.   #--------------------------------------------------------------------------
  527.   # * Frame Update (actor command phase)
  528.   #
  529.   #   This phase handles the Input for the Actor Command Window, normally.
  530.   #
  531.   #   This is also where incompatability problems will occur.  If another
  532.   #   battle system doesnt use this command to handle input, problems might
  533.   #   be easily fixed by changing the name of this method to whatever method
  534.   #   is used to handle inputs for Actor Commands.
  535.   #
  536.   #   Note:  Input.trigger? can not be checked multiple times, so checking
  537.   #   if a command is disabled needs to happen before checking input.
  538.   #
  539.   #--------------------------------------------------------------------------
  540.   alias disable_battle_menu_update_phase3 update_phase3
  541.   def update_phase3
  542.     # Get Actor for the Visible Menu
  543.     actor = $game_party.actors[@actor_index]
  544.     # Get the Command Word from the Window
  545.     command = @actor_command_window.commands[@actor_command_window.index]
  546.     # Check if that Actor has had that Menu Word disabled
  547.     disabled = actor.disabled_menu_words.include?(command)
  548.     # Check if that Actor is allowed to process Cancel Input Commands
  549.     cancel = actor.disabled_menu_words.include?("Cancel")
  550.     # If C button was pressed
  551.     if disabled and Input.trigger?(Input::C)
  552.       # Play buzzer SE
  553.       $game_system.se_play($data_system.buzzer_se)
  554.       # Prevent Input Processing
  555.       return
  556.     # If Cancelling the Actor Command Window is Disabled
  557.     elsif cancel and @actor_command_window.active and Input.trigger?(Input::B)
  558.       # Play buzzer SE
  559.       $game_system.se_play($data_system.buzzer_se)
  560.       # Prevent Input Processing
  561.       return
  562.     end
  563.     # Call Original or other Aliases
  564.     disable_battle_menu_update_phase3
  565.   end
  566. end
  567.  
  568. #==============================================================================
  569. # ** Game_Actor
  570. #==============================================================================
  571. class Game_Actor < Game_Battler
  572.   #--------------------------------------------------------------------------
  573.   # * Object Initialization
  574.   #     actor_id : actor ID
  575.   #--------------------------------------------------------------------------
  576.   alias disabled_battle_menu_item_initialize initialize
  577.   def initialize(actor_id)
  578.     # Call Original or other Aliases
  579.     disabled_battle_menu_item_initialize(actor_id)
  580.     # Disabled Words
  581.     @disabled_menu_words = []
  582.   end
  583.   #--------------------------------------------------------------------------
  584.   # * Disabled Menu Words
  585.   #     List of Battle Menu Words (Attack, Skill, etc) that are Disabled
  586.   #     for this Actor.  Does error checking also.
  587.   #--------------------------------------------------------------------------
  588.   def disabled_menu_words
  589.     # Check if Property not an Array for preventing crash
  590.     @disabled_menu_words = [] if @disabled_menu_words.nil?
  591.     # Return the Array of words
  592.     return @disabled_menu_words
  593.   end
  594. end
  595.  
  596. #==============================================================================
  597. # ** Game_Actors
  598. #==============================================================================
  599. class Game_Actors
  600.   #--------------------------------------------------------------------------
  601.   # * Size - Returns Size of All Actors in Game
  602.   #
  603.   #   This is needed because $data is a table, and to make a table fast, it
  604.   #   has less commands available than an array, so $data_actors.size is
  605.   #   something that will crash your game by default.  So I just check where
  606.   #   the modifiable data is stored in memory without affecting the templates
  607.   #   stored in $data_ for the total number of Characters in a game.
  608.   #--------------------------------------------------------------------------
  609.   def size
  610.     return @data.size
  611.   end
  612. end
  613.  
Expand to see the code.


Instructions

This script is pretty easy to use. Each Disable script call has an Enable script counterpart.

disable_command(actor_id, "Attack") # Disables "Attack" for that Actor
disable_cancel(actor_id) # Disables "Cancelling" or Previous Actor
disable_command_party("Attack") # Disables "Attack" for entire Party
disable_command_all("Attack") # Disables "Attack" for all Actors in game

To use the Enable Counterpart, just change disable_ to enable_.

enable_command(actor_id, "Item")

Compatibility

This script only aliases a few existing default methods, but adds several new methods for functionality.

It wont be compatible with BlizzABS because that Battle System takes place in the Map, not in a Battle Scene. It may not be compatible with some Menu or Battle Systems, but fixing this should not be too difficult. In the default Battle System, there is a line that says @actor_command_window = Window_Selectable.new". This will tell you what class this script needs. What will normally happen with an incompatible Battle or Menu System is that @actor_command_window may be a different class. Change the name of the class in this script if the class name is not Window_Selectable. If @actor_command_window is called something else, change those references accordingly in this script.

Battle Systems also need to handle inputs from Players for the "Attack", "Skill" window. The default method is called "update_phase3". If your Battle System is using another name for handling inputs from the Player for checking if "attack" or "skill" is selected, just change the name of this method to alias and reference that method instead.

I doubt it will be 100% compatible, but fixing these issues should not be too difficult.

Author's Notes

Compatability is one of my primary concerns with this script. Despite it looking like a lot to change, there really isnt that much as there are only about 3 things that can go critically wrong, but they are fairly easy to fix.

If you have compatability issues with a certain Menu System or Battle System, please create a new thread for those issues.

For enhancement requests to this script, please post in this thread.
This looks like it could be an awesome script. However, it would be even more awesome if the post wasn't a direct copy-paste and had at least had the bbcode converted to the format this forum uses.
Fixed formatting for this forum. Stupid bb vs vbulletin differences. And real life stuff taking me away of fixing formatting mid post.

Script is actually quite simple. Just a lot of comments to explain stuff if it doesnt work for some reason. Each actor gets a list of "Disabled Commands". When the Actor Command Window is changed from false to true, the script checks for each "Word" to see if it is disabled or not. Rest of the code is just for enabling and disabling with some overkill to make things faster for game creators.

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=78292