king-exit/Scripts/_.56.rb
2024-08-31 14:17:23 -05:00

168 lines
No EOL
5.2 KiB
Ruby
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#==============================================================================
# ■ RGSS3 アクター個別並び替え禁止スイッチ Ver1.00 by 星潟
#------------------------------------------------------------------------------
# 特定のスイッチがONでなければ
# メニュー画面での並び替えが行えないアクターを作成できます。
# また、並び替え時に並び替え禁止アクターの顔グラフィックを半透明にしたり
# 特定のテキストを表示したりすることができます。
#------------------------------------------------------------------------------
# ★設定方法
#
# アクターのメモ欄に下記のように記入します。
#
# <並び替え禁止:50>
#
# 【スイッチID50】が
# 【ON】だと【入れ替え】が【できる】 
# 【OFF】だと【入れ替え】が【できない】
#==============================================================================
module SW_O_SEAL
#並び替え禁止スイッチ設定用キーワードを設定。
WORD = "並び替え禁止"
#顔グラフィックを半透明にするか?
FACE = true
#顔グラフィックにテキストを被せるか?
T_OK = true
#テキスト表示位置を指定。
LINE = 3
#テキスト内容を指定。(不要の場合""として下さい)
TEXT = "並び替え不可"
end
class Game_Temp
attr_accessor :sw_o_seal
end
class Window_Base < Window
#--------------------------------------------------------------------------
# 顔グラフィック描写
#--------------------------------------------------------------------------
alias draw_actor_face_unuse_sw_o_seal draw_actor_face
def draw_actor_face(actor, x, y, enabled = true)
#フラグを初期化する。
flag = false
#並び替え中であり、なおかつアクターの並び替え有効スイッチが0でなく
#該当スイッチがOFFの時は半透明表示にする。
if $game_temp.sw_o_seal != nil &&
actor.actor.swap_order_seal != 0 &&
!$game_switches[actor.actor.swap_order_seal]
enabled = false if SW_O_SEAL::FACE
flag = true
end
#本来の処理を実行する。
draw_actor_face_unuse_sw_o_seal(actor, x, y, enabled)
#並び替え不可メッセージを描写。
draw_text(x, y + line_height * SW_O_SEAL::LINE, 96, line_height, SW_O_SEAL::TEXT, 1) if SW_O_SEAL::T_OK && flag
end
end
class Window_MenuStatus < Window_Selectable
#--------------------------------------------------------------------------
# 決定ボタンが押されたときの処理
#--------------------------------------------------------------------------
alias process_ok_s_o_s_a process_ok
def process_ok
#並び替え処理であれば分岐。
if $game_temp.sw_o_seal != nil
#アクター個別の並び替え封印スイッチを取得。
number_data = $game_party.members[self.index].actor.swap_order_seal
#スイッチIDが0でなく、またそのスイッチがONになっていない場合はブザーを鳴らす。
return Sound.play_buzzer if number_data != 0 && !$game_switches[number_data]
end
#本来の処理を実行。
process_ok_s_o_s_a
end
end
class Scene_Menu < Scene_MenuBase
#--------------------------------------------------------------------------
# コマンド[並び替え]
#--------------------------------------------------------------------------
alias command_formation_s_o_s_a command_formation
def command_formation
#入れ替え制限用の処理を行う。
$game_temp.sw_o_seal = true
#ステータスウィンドウをリフレッシュする。
@status_window.refresh if SW_O_SEAL::FACE or SW_O_SEAL::T_OK
#本来の処理を行う。
command_formation_s_o_s_a
end
#--------------------------------------------------------------------------
# 並び替え[キャンセル]
#--------------------------------------------------------------------------
alias on_formation_cancel_s_o_s_a on_formation_cancel
def on_formation_cancel
#本来の処理を行う。
on_formation_cancel_s_o_s_a
return if @status_window.active
#入れ替え制限解除用の処理を行う。
$game_temp.sw_o_seal = nil
#ステータスウィンドウをリフレッシュする。
@status_window.refresh if SW_O_SEAL::FACE or SW_O_SEAL::T_OK
end
end
class RPG::Actor < RPG::BaseItem
#--------------------------------------------------------------------------
# 並び替え封印
#--------------------------------------------------------------------------
def swap_order_seal
#キャッシュを返す。
return @swap_order_seal if @swap_order_seal != nil
#メモ欄からデータを取得。
data = self.note.scan(/<#{SW_O_SEAL::WORD}[:](\S+)>/).flatten
#スキル変更データを取得。
@swap_order_seal = (data != nil && !data.empty?) ? data[0].to_i : 0
#データを返す。
@swap_order_seal
end
end