Temporarily Seal 'Item' Command based on state/switch

Guys, I'd like to make a state where the one who is inflicted by it can't use items... Just like Embargo in Pokemon.


So the Item command should be  grayed or disappeared temporarily, then it can reappear later when the state wore off or when a switch is activated.


I prefer using state, but if it's too difficult then using switch is okay.


Please help.. Thanks in advance.
In Window_ActorCommand, here's the method responsible for adding the 'Item' command to the list:


  #--------------------------------------------------------------------------
  # * Add Item Command to List
  #--------------------------------------------------------------------------
  def add_item_command
    add_command(Vocab::item, :item)
  end


The add_command method can be given a third parameter (normally defaults to "true" when there is no third parameter) which specifies the condition for enabling the command.


So you could do something like add_command(Vocab::item, :item, !$game_switches[12]) to say that the Item command should only be enabled when Switch #12 is OFF (remove the exclamation point if you want it to only be enabled when Switch #12 is ON instead).  Replace the original add_command line with that.


I think that @actor is also defined within this class, so you can probably handle it with a State with something like add_command(Vocab::item, :item, !(@actor.state?(15))) to disable the command when the actor trying to use it is affected with State #15.
Thanks! I'll try it!

Original thread: https://forums.rpgmakerweb.com/threads/temporarily-seal-item-command-based-on-state-switch.67458/