じ☆ve冰风 发表于 2026-8-2 13:10:27

Hidden Skill/ Item Switch

Hidden Skill Switch 2019/12/15

Creator name: Ru/むっくRu (Rutan)

Introduction
Possible to create hidden skill/items with a switch through note tag.

Feature
If specified switch is ON, certain skill/ item won't show in the list (unusable)

<Usage>
Put the following tag in the Note box for skill or item:

<hidskill: 1>
<hiditem: 1>

By using this tag,
When switch ID: 1 is ON, the item won't show in the list. (If you want to change the switch ID, change 1)

How to Use
Paste this script above Main.

Script link
https://raw.githubusercontent.com/ovate/torigoya-rgss3/main/torigoya_HiddenSkill.rb

                Code:       
# encoding: utf-8
#===============================================================================
# ■ Hidden Skill Switch
#-------------------------------------------------------------------------------
# 2019/12/15 Ruたん
# License - Public Domain, allows commercial use and credit is not necessary
#-------------------------------------------------------------------------------
# If specified switch is ON, certain skill/ item won't show in the list (unusable)
# Possible to create hidden skill/items with a switch through note tag
#
# <Usage>
# Put the following tag in the Note box for skill or item
#
# <hidskill: 1>
#
#  Or
#
# <hiditem: 1>
#
# By using this tag,
# When switch ID: 1 is ON, the item won't show in the list.
# (If you want to change the switch ID, change 1)
#-------------------------------------------------------------------------------
# 【Changelog】
# 2019/12/15 Released
#-------------------------------------------------------------------------------

module Torigoya
module HiddenSkillSwitch
    module Config
      # Regular expression in Note box
      # Play here if you want to change the setting method
      NOTE_REGEXP = /<(?:HiddenSkillSwitch|HiddenItemSwitch|hidskill|hiditem):\s*(?<switch_id>\d+)\s*>/
    end
end
end

class RPG::BaseItem
#--------------------------------------------------------------------------
# ● Are item switchable in the list?
#--------------------------------------------------------------------------
def torigoya_visible_in_list?
    unless instance_variable_defined?(:@torigoya_visible_in_list_switch)
      match = note.match(Torigoya::HiddenSkillSwitch::Config::NOTE_REGEXP)
      @torigoya_visible_in_list_switch = match ? match[:switch_id].to_i : 0
    end
    @torigoya_visible_in_list_switch ? !$game_switches[@torigoya_visible_in_list_switch] : true
end
end

class Game_BattlerBase
#--------------------------------------------------------------------------
# ● Skill/Item availability (alias)
#--------------------------------------------------------------------------
alias torigoya_hidden_skill_switch_usable? usable?
def usable?(item)
    return false unless torigoya_hidden_skill_switch_usable?(item)
    item.torigoya_visible_in_list?
end
end

class Window_ItemList < Window_Selectable
#--------------------------------------------------------------------------
# ● Whether to include items in the list (alias)
#--------------------------------------------------------------------------
alias torigoya_hidden_skill_switch_include? include?
def include?(item)
    return false unless torigoya_hidden_skill_switch_include?(item)
    item && item.torigoya_visible_in_list?
end
end

class Window_SkillList < Window_Selectable
#--------------------------------------------------------------------------
# ● Whether to include items in the list (alias)
#--------------------------------------------------------------------------
alias torigoya_hidden_skill_switch_include? include?
def include?(item)
    return false unless torigoya_hidden_skill_switch_include?(item)
    item && item.torigoya_visible_in_list?
end
end


Credit and Thanks
- Original Author: Rutan

License - Public Domain, this means commercial use is allow and credit is not necessary

Source
https://github.com/rutan/torigoya_rpg_maker_vxace_rgss3


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