I want to disable some commands from the character's menu (one with the options save, end game, items, etc.) but I want it so that at some point in the game you can enable them again, by some variable, switch, etc. any script or idea of how to do it?
Disable and Enable commands from the character menu from the game
RGSS3 Script RequestsWindow_MenuCommand:
Code:
#--------------------------------------------------------------------------
# * Add Main Commands to List [Example conditions]
#--------------------------------------------------------------------------
def add_main_commands
add_command(Vocab::item, :item, main_commands_enabled && onswitch)
add_command(Vocab::skill, :skill, onswitch)
add_command(Vocab::equip, :equip, main_commands_enabled || onswitch)
add_command(Vocab::status, :status, main_commands_enabled)
end
#--------------------------------------------------------------------------
# * Get switch that enables commands
#--------------------------------------------------------------------------
def enableswitch
$game_switches[1] == true
end
What Zeroscares provided is an example, but also a confusing one.
The || (or) statement would only work if the main_commands_enabled was false otherwise the || onswitch condition will always be true.
Use this and change it as you need.
The || (or) statement would only work if the main_commands_enabled was false otherwise the || onswitch condition will always be true.
Use this and change it as you need.
Ruby:
# specify what switch controls which command.
# can use same switch to turn multiple commands on or off
# You can remove parts of this script or set 1 switch to true and
# make every command that will not be disabled, set to that switch
# you can also change it to fit your needs
module R2_Main_commands_by_switch
Formation = 10 # switch 10
Save = 11 # switch 11
Gameend = 12
Item = 13
Skill = 14
Equip = 15
Status = 16
end
class Window_MenuCommand < Window_Command
#--------------------------------------------------------------------------
# * Create Command List
#--------------------------------------------------------------------------
def make_command_list
add_main_commands
add_formation_command if $game_switches[R2_Main_commands_by_switch::Formation] == true
add_original_commands
add_save_command if $game_switches[R2_Main_commands_by_switch::Save] == true
add_game_end_command if $game_switches[R2_Main_commands_by_switch::Gameend] == true
end
#--------------------------------------------------------------------------
# * Add Main Commands to List
#--------------------------------------------------------------------------
def add_main_commands
add_command(Vocab::item, :item, main_commands_enabled) if $game_switches[R2_Main_commands_by_switch::Item] == true
add_command(Vocab::skill, :skill, main_commands_enabled) if $game_switches[R2_Main_commands_by_switch::Skill] == true
add_command(Vocab::equip, :equip, main_commands_enabled) if $game_switches[R2_Main_commands_by_switch::Equip] == true
add_command(Vocab::status, :status, main_commands_enabled) if $game_switches[R2_Main_commands_by_switch::Status] == true
end
end
Thank you both zeroscares and Roninator2 I will try this scripts and see how it goes. I will notify you of any problem
Update: the example from zeroscares helped me do a script that works, thank you both for the support, specially zeroscares. I promise that if this project that I am doing gets realeased you both get in the credits.
Original thread: https://forums.rpgmakerweb.com/threads/disable-and-enable-commands-from-the-character-menu-from-the-game.128867/