Locked Commands Fix

Discussion in 'RGSS3 Scripts (RMVX Ace)' started by Faherya, Feb 2, 2018.

  1. Faherya

    Faherya The Knight of the Sad Figure Veteran

    Messages:
    206
    Likes Received:
    498
    Location:
    Brazil
    First Language:
    Português
    Primarily Uses:
    RMVXA
    Locked Commands Fix

    Introduction
    Ignore misspellings, I do not speak english.
    When certain functions of some menus are blocked, the command continues to appear, but darkened. I find it interesting to show these options only when they are useful so this code prevents them from appearing. It is a small explanation, but a small function as well.

    Features
    - Hides locked options.

    Screenshots
    As an example, look at the store options window (I'm sorry, the images are in Portuguese):
    [​IMG]
    With the code:
    [​IMG]

    How to Use
    Just paste the code into the additional code area (below the other codes and above the main).

    Script
    Code:
    #===============================================================================
    #                        Locked Commands Fix
    #===============================================================================
    # This code removes locked options from several scenes, showing them normally
    # when they are released.
    #-------------------------------------------------------------------------------
    # Continue, on Title.
    class Window_TitleCommand
      alias :add_command_Continue :add_command
      def add_command(*args)
        name, symbol = *args
        return if symbol === :continue && !continue_enabled
        add_command_Continue(*args)
      end
    end
    #-------------------------------------------------------------------------------
    # Sell, on Shop.
    class Window_ShopCommand
      alias :add_command_Sell :add_command
      def add_command(*args)
        name, symbol = *args
        return if symbol === :sell && @purchase_only
        add_command_Sell(*args)
      end
    end
    #-------------------------------------------------------------------------------
    # Save and Formation, on Menu.
    class Window_MenuCommand
      alias :add_command_Save :add_command
      def add_command (*args)
        name, symbol = *args
        return if symbol === :save && !save_enabled
        add_command_Save(*args)
      end
      alias :add_command_Formation :add_command
      def add_command (*args)
        name, symbol = *args
        return if symbol === :formation && !formation_enabled
        add_command_Formation(*args)
      end
    end
    #-------------------------------------------------------------------------------
    # Escape, on Battle.
    class Window_PartyCommand
      alias :add_command_Escape :add_command
      def add_command (*args)
        name, symbol = *args
        return if symbol === :escape && !BattleManager.can_escape?
        add_command_Escape(*args)
      end
    end
    #-------------------------------------------------------------------------------
    

    FAQ
    Q: What are the terms of use?
    A: Free for commercial and non-commercial projects.

    Credit and Thanks
    - Faherya
    - Special thanks to Alisson, Kyo Panda and MayLeone.

    Author's Notes
    The changes are ridiculously simple, solves only one detail that bothers me. You do not even have to credit me if you use it. Notice that the only thing I did was to insert the lines of the respective commands into a condition. Therefore, if there are any compatibility problems with codes that change these functions try to do the same. Anyway, that's it.
     
    Last edited: Feb 3, 2018
    #1
    Canini and fizzly like this.
  2. Canini

    Canini Veteran Veteran

    Messages:
    987
    Likes Received:
    658
    First Language:
    Swedish
    Primarily Uses:
    RMVXA
    I too, find it more aesthetically pleasing when non-selectable options are not there at all rather than darkened. Also, you could use it to make it appear to the player as if more options become available as the game progresses. Thanks for sharing!
     
    #2
    Faherya likes this.

Share This Page