這是在幫別人解答時,
終於開啟了腳本庫改了一個我也覺得不錯的簡單腳本。
( 根本只有增加判斷式而已 ( 艸 ) )
要設定第一位主角不能更改位置,並且選擇替換無效。
在Scene_Menu > on_formation_ok 那段功能的判斷式,
開頭增加更改成 if...elsif...end 判斷式。
增加判斷
「如果(if) 當選擇第一位角色時。」
「例外,且如果(elsif) 選擇第一位角色以外時,
『如果(if) 被替換掉的是第一位時及例外的情況』。」
完整程式碼如下
def on_formation_ok
if @status_window.pending_index == 0 #如果 當被選擇的角色為等於0
@status_window.pending_index = -1 #重置指令
@status_window.redraw_item(@status_window.index) #重置指令
elsif @status_window.pending_index >= 1 #例外,且 當被選擇的角色1以上
if @status_window.index != 0 #當選擇替換的角色不等於1
#腳本原始行 執行替換指令
$game_party.swap_order(@status_window.index,
@status_window.pending_index)
@status_window.pending_index = -1
@status_window.redraw_item(@status_window.index)
#--------------
else #例外
@status_window.pending_index = -1
@status_window.redraw_item(@status_window.index)
end
#腳本原始行
else
@status_window.pending_index = @status_window.index
end
@status_window.activate
end
#--------------
P.S.
隊伍更換功能英文關鍵字是Formation,
關聯性腳本是
Scene_Menu、Scene_MenuBase、Game_Party、Window_MenuCommand