Disable and Enable commands from the character menu from the game

A_noob_coder

Warper
Member
Joined
Oct 7, 2020
Messages
3
Reaction score
1
First Language
Spanish
Primarily Uses
RMVX
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?
 

zeroscares

Veteran
Veteran
Joined
Oct 17, 2020
Messages
56
Reaction score
10
First Language
português
Primarily Uses
RMVXA
Window_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
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,647
Reaction score
562
First Language
English
Primarily Uses
RMVXA
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.
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
 

A_noob_coder

Warper
Member
Joined
Oct 7, 2020
Messages
3
Reaction score
1
First Language
Spanish
Primarily Uses
RMVX
Thank you both zeroscares and Roninator2 I will try this scripts and see how it goes. I will notify you of any problem
 

A_noob_coder

Warper
Member
Joined
Oct 7, 2020
Messages
3
Reaction score
1
First Language
Spanish
Primarily Uses
RMVX
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.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts


Particle waterfall is best waterfall. :LZSexcite:
Yosh! Senkara made a fourth video on my game.
This time, finding all the false endings. :LZScheeze:


P.S, his thumbnails are absolutely epic!
GOBBLE GOBBLE! Happy thanksgiving.
Oh no. That moment when you try to fix something you modified in your game, like, a year ago but didn't want to fix then, and you now have no idea what you even did. Me right now, trying to figure out why my gold window is over stretched?
LittlePIGGY wrote on atreyoray's profile.
Where are you TT^TT
We need ARP_InGameManual for MZ

Forum statistics

Threads
105,553
Messages
1,014,590
Members
137,228
Latest member
Ziphon
Top