#==============================================================================
# 「選択肢キャンセラー」(ACE) Ver.1.0
# 製作者:奈々(なな)
# へぷたなすくろーる http://heptanas.mamagoto.com/
#
# ◇使用規約
# 使用される場合はスクリプト作成者として「奈々」を明記して下さい。
# スクリプトの改変は自由に行って頂いて構いませんが
# その場合も元のスクリプトの作成者として名前を載せて下さい。
# また配布前に必ず、ブログにある利用規約を確認して下さい。
#
#------------------------------------------------------------------------------
#
# 選択肢を表示した際に、指定した選択肢を選べないようにします。
# 条件を満たしていないと選べない選択肢や、メニューの作成にどうぞ。
#
# ※前提スクリプトとして「半透明文字(ver1.1以降)」が必要です。
# 使い方は、イベントコマンドのスクリプトで以下を入力します。
#
# n7_choice_canseler(n, true / false)
#
# 1〜5番目の選択肢を有効(true)または無効(false)にします。
# 一度選択肢を表示すると、全てtrueに戻ります。
#
#==============================================================================
#==============================================================================
# ■ Game_Interpreter
#------------------------------------------------------------------------------
# イベントコマンドを実行するインタプリタです。このクラスは Game_Map クラス、
# Game_Troop クラス、Game_Event クラスの内部で使用されます。
#==============================================================================
class Game_Interpreter
#--------------------------------------------------------------------------
# ● 選択肢の無効化・有効化
#--------------------------------------------------------------------------
def n7_choice_canseler(no, flag = true)
$game_system.choice_canseler[no-1] = flag
end
end
#==============================================================================
# ■ Game_System
#------------------------------------------------------------------------------
# システム周りのデータを扱うクラスです。セーブやメニューの禁止状態などを保存
# します。このクラスのインスタンスは $game_system で参照されます。
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :choice_canseler # 選択肢の無効化フラグ(配列)
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias n7_choice_canseler_initialize initialize
def initialize
n7_choice_canseler_initialize
@choice_canseler = [true, true, true, true, true]
end
end
#==============================================================================
# ■ Window_ChoiceList
#------------------------------------------------------------------------------
# イベントコマンド[選択肢の表示]に使用するウィンドウです。
#==============================================================================
class Window_ChoiceList < Window_Command
#--------------------------------------------------------------------------
# ● 項目の描画
#--------------------------------------------------------------------------
#選択肢が無効なら、指定した文字色にする。
def draw_item(index)
text = command_name(index).to_s.clone
unless $game_system.choice_canseler[index]
text.gsub!(/\\C\[(\d+)\]/i){"\\CC[#{$1},-1]"}
text.gsub!(/\\I\[(\d+)\]/i){"\\II[#{$1}]"}
text.insert(0, "\\CC[0,-1]")
end
rect = item_rect_for_text(index)
draw_text_ex(rect.x, rect.y, text)
end
#--------------------------------------------------------------------------
# ● 決定ボタンが押されたときの処理
#--------------------------------------------------------------------------
alias n7_choice_canseler_process_ok process_ok
def process_ok
unless $game_system.choice_canseler[@index]
Sound.play_buzzer
else
n7_choice_canseler_process_ok
$game_system.choice_canseler = [true, true, true, true, true]
end
end
#--------------------------------------------------------------------------
# ● キャンセルボタンが押されたときの処理
#--------------------------------------------------------------------------
alias n7_choice_canseler_process_cancel process_cancel
def process_cancel
unless $game_system.choice_canseler[$game_message.choice_cancel_type - 1]
Sound.play_buzzer
else
n7_choice_canseler_process_cancel
$game_system.choice_canseler = [true, true, true, true, true]
end
end
end