MenuDisabler
#1
MenuDisabler
XP + VX + ACE

by Kyonides

Introduction

Do you need to block the player's ability to consume items?
Or do you hate the team and wish to make it suffer by blocking all skills just because?
Or perhaps you should prevent the player from equiping new gear at any specific moment...

If any of those things is true, then this scriptlet is for you! Grinning

Just configure the game switch ID's accordingly. Winking

For XP

Code:
# * MenuDisabler XP * #
#   Scripter : Kyonides Arkanthes
#   2024-03-17

# It uses 3 game switches to block items, skills or equipment.

module MenuDisabler
  BLOCK_ITEM_SWITCH  = 100
  BLOCK_SKILL_SWITCH = 150
  BLOCK_EQUIP_SWITCH = 200

  extend self
  attr_accessor :used
end

module Vocab
  STATUS   = "Status"
  SAVE     = "Save"
  END_GAME = "End Game"
end

class Window_Command
  include MenuDisabler
  alias :kyon_menu_disabler_win_cmd_ref :refresh
  def refresh
    if MenuDisabler.used
      refresh_commands
    else
      kyon_menu_disabler_win_cmd_ref
    end
  end

  def refresh_commands
    MenuDisabler.used = nil
    terms = $data_system.words
    item  = terms.item
    skill = terms.skill
    equip = terms.equip
    anybody = $game_party.actors.size > 0
    @states = {}
    @states[item]     = (anybody and !$game_switches[BLOCK_ITEM_SWITCH])
    @states[skill]    = (anybody and !$game_switches[BLOCK_SKILL_SWITCH])
    @states[equip]    = (anybody and !$game_switches[BLOCK_EQUIP_SWITCH])
    @states[Vocab::STATUS]   = anybody
    @states[Vocab::SAVE]     = !$game_system.save_disabled
    @states[Vocab::END_GAME] = true
    self.contents.clear
    @item_max.times {|n| change_command(n) }
  end

  def command(n)
    @commands[n]
  end

  def change_command(n)
    cmd = command(n)
    color = @states[cmd] ? normal_color : disabled_color
    draw_item(n, color)
  end

  def option_disabled?
    !@states[command(@index)]
  end
end

class Scene_Menu
  alias :kyon_menu_disabler_scn_mn_main :main
  alias :kyon_menu_disabler_scn_mn_up_cmd :update_command
  def main
    MenuDisabler.used = true
    kyon_menu_disabler_scn_mn_main
  end

  def update_command
    if Input.trigger?(Input::C)
      if @command_window.option_disabled?
        $game_system.se_play($data_system.cancel_se)
        return
      end
    end
    kyon_menu_disabler_scn_mn_up_cmd
  end
end

For VX

Code:
# * MenuDisabler VX * #
#   Scripter : Kyonides Arkanthes
#   2023-11-17

# It uses 3 game switches to block items, skills or equipment.

module MenuDisabler
  BLOCK_ITEM_SWITCH  = 100
  BLOCK_SKILL_SWITCH = 150
  BLOCK_EQUIP_SWITCH = 200
end

class Window_Command
  def change_command(name, enabled)
    cmd = @commands.find {|v| v == name }
    n = @commands.index(cmd)
    draw_item(n, enabled) if n
  end

  def make_command_indexes
    @names = {}
    @commands.each_with_index {|c, n| @names[n] = c }
  end

  def current_name
    @names[@index]
  end
end

class Scene_Menu
  include MenuDisabler
  alias :kyon_disable_equip_scn_mn_crt_cmd_win :create_command_window
  alias :kyon_disable_equip_scn_mn_cmd_sel :update_command_selection
  def create_command_window
    kyon_disable_equip_scn_mn_crt_cmd_win
    @command_window.make_command_indexes
    anybody = $game_party.members.size > 0
    @states = {}
    @states[Vocab.item]     = (anybody and !$game_switches[BLOCK_ITEM_SWITCH])
    @states[Vocab.skill]    = (anybody and !$game_switches[BLOCK_SKILL_SWITCH])
    @states[Vocab.equip]    = (anybody and !$game_switches[BLOCK_EQUIP_SWITCH])
    @states[Vocab.status]   = anybody
    @states[Vocab.save]     = !$game_system.save_disabled
    @states[Vocab.game_end] = true
    @command_window.change_command(Vocab.item, @states[Vocab.item])
    @command_window.change_command(Vocab.skill, @states[Vocab.skill])
    @command_window.change_command(Vocab.equip, @states[Vocab.equip])
  end

  def update_command_selection
    if Input.trigger?(Input::C)
      name = @command_window.current_name
      return Sound.play_cancel unless @states[name]
    end
    kyon_disable_equip_scn_mn_cmd_sel
  end
end

For VX ACE

Code:
# * MenuDisabler ACE * #
#   Scripter : Kyonides Arkanthes
#   2024-03-17

# It uses 3 game switches to block items, skills or equipment.

module MenuDisabler
  BLOCK_ITEM_SWITCH  = 100
  BLOCK_SKILL_SWITCH = 150
  BLOCK_EQUIP_SWITCH = 200
end

class Window_Command
  def change_command(name, symbol, enabled, ext=nil)
    hash = @list.find {|v| v[:name] == name }
    if hash
      hash[:enabled] = enabled
    else
      hash = { name: name, symbol: symbol, enabled: enabled, ext: ext }
      @list << hash
    end
    n = @list.index(hash)
    clear_item(n)
    draw_item(n)
  end
end

class Scene_Menu
  alias :kyon_disable_equip_scn_mn_crt_cmd_win :create_command_window
  alias :kyon_disable_equip_scn_mn_cmd_personal :command_personal
  def create_command_window
    kyon_disable_equip_scn_mn_crt_cmd_win
    anybody = $game_party.members.size > 0
    state = !$game_switches[MenuDisabler::BLOCK_ITEM_SWITCH]
    @command_window.change_command(Vocab.item, :item, anybody && state)
    state = !$game_switches[MenuDisabler::BLOCK_SKILL_SWITCH]
    @command_window.change_command(Vocab.skill, :skill, anybody && state)
    state = !$game_switches[MenuDisabler::BLOCK_EQUIP_SWITCH]
    @command_window.change_command(Vocab.equip, :equip, anybody && state)
  end
end

Terms & Conditions

Free for use in ANY game. Gamer
Due credit is mandatory. Serious
That's it! Tongue sticking out
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9

Maranatha!

The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.

[Image: SP1-Scripter.png]
[Image: SP1-Writer.png]
[Image: SP1-Poet.png]
[Image: SP1-PixelArtist.png]
[Image: SP1-Reporter.png]

My Original Stories (available in English and Spanish)

List of Compiled Binary Executables I have published...
HiddenChest & Roole

Give me a free copy of your completed game if you include at least 3 of my scripts! Laughing + Tongue sticking out

Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE
Reply }


Messages In This Thread
MenuDisabler - by kyonides - 11-17-2023, 11:16 PM
RE: MenuDisabler - by kyonides - 03-17-2024, 08:08 AM



Users browsing this thread: 1 Guest(s)