じ☆ve冰风 发表于 2026-7-25 15:49:29

MenuDisabler XP

MenuDisabler XP

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!


Just configure the game switch ID's accordingly.


I do think it is some sort of a hack, but that seemed to be the only way to make it work without rewriting large portions of the Scene_Menu script.


                Ruby:       
# * 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   = (anybody and !$game_switches)
    @states    = (anybody and !$game_switches)
    @states    = (anybody and !$game_switches)
    @states   = anybody
    @states   = !$game_system.save_disabled
    @states = true
    self.contents.clear
    @item_max.times {|n| change_command(n) }
end

def command(n)
    @commands
end

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

def option_disabled?
    !@states
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


Terms & Conditions

Free for use in ANY game.
Due credit is mandatory.
That's it!



本贴来自国际rpgmaker官方论坛作者:kyonides处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/menudisabler-xp.166892/
页: [1]
查看完整版本: MenuDisabler XP