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):
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.