I am trying to create a system in XP where actors can switch their equipment during battle, but that doing so takes up their turn. I have a script that allows for changing equipment during battle, except that it was originally in Japanese, so none of the comments make sense.
# Posted on HBGames.Org forum by Landarma waaay back in '06, but was
#written by an "anonymous Japanese scripter" and originally found on an RGSS
#wiki.
#==============================================================================
# - Scene_Battle (分割定義 3)
#------------------------------------------------------------------------------
#  ãƒãƒˆãƒ«ç"»é¢ã®å‡¦ç†ã,'行ã†ã,¯ãƒ©ã,¹ã§ã™ã€,
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# -- メã,¤ãƒ³å‡¦ç†
#--------------------------------------------------------------------------
def main
# 戦é--˜ç"¨ã®å,,種一æ™,デーã,¿ã,'åˆæœŸåŒ-
$game_temp.in_battle = true
$game_temp.battle_turn = 0
$game_temp.battle_event_flags.clear
$game_temp.battle_abort = false
$game_temp.battle_main_phase = false
$game_temp.battleback_name = $game_map.battleback_name
$game_temp.forcing_battler = nil
# ãƒãƒˆãƒ«ã,¤ãƒ™ãƒ³ãƒˆç"¨ã,¤ãƒ³ã,¿ãƒ--リã,¿ã,'åˆæœŸåŒ-
$game_system.battle_interpreter.setup(nil, 0)
# トルーãƒ--ã,'æº-å,™
@troop_id = $game_temp.battle_troop_id
$game_troop.setup(@troop_id)
# ã,¢ã,¯ã,¿ãƒ¼ã,³ãƒžãƒ³ãƒ‰ã,¦ã,£ãƒ³ãƒ‰ã,¦ã,'作æˆ
s1 = $data_system.words.attack
s2 = $data_system.words.skill
s3 = $data_system.words.item
s4 = $data_system.words.equip #ーーー -- --è£...å,™
@actor_command_window = Window_Command.new(128, [s1, s2, s3, s4,])
#@actor_command_window = Window_Command.new(160, [s1, s2, s3, s4])
@actor_command_window.y = 128 #160
@actor_command_window.back_opacity = 160
@actor_command_window.active = false
@actor_command_window.visible = false
# ãã®ä»-ã®ã,¦ã,£ãƒ³ãƒ‰ã,¦ã,'作æˆ
@party_command_window = Window_PartyCommand.new
@help_window = Window_Help.new
@help_window.back_opacity = 160
@help_window.visible = false
@status_window = Window_BattleStatus.new
@message_window = Window_Message.new
# ã,¹ãƒ--ラã,¤ãƒˆã,»ãƒƒãƒˆã,'作æˆ
@spriteset = Spriteset_Battle.new
# ã,¦ã,§ã,¤ãƒˆã,«ã,¦ãƒ³ãƒˆã,'åˆæœŸåŒ-
@wait_count = 0
# トランã,¸ã,·ãƒ§ãƒ³å®Ÿè¡Œ
if $data_system.battle_transition == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$data_system.battle_transition)
end
# ãƒ--レãƒãƒˆãƒ«ãƒ•ã,§ãƒ¼ã,ºé-‹å§‹
start_phase1
# メã,¤ãƒ³ãƒ«ãƒ¼ãƒ--
loop do
# ã,²ãƒ¼ãƒ ç"»é¢ã,'æ›´æ-°
Graphics.update
# å...¥åŠ›æƒ...å ±ã,'æ›´æ-°
Input.update
# フレーム更æ-°
update
# ç"»é¢ãŒåˆ‡ã,Šæ›¿ã,ã£ãŸã,‰ãƒ«ãƒ¼ãƒ--ã,'䏿-
if $scene != self
break
end
end
# マッãƒ--ã,'リフレッã,·ãƒ¥
$game_map.refresh
# トランã,¸ã,·ãƒ§ãƒ³æº-å,™
Graphics.freeze
# ã,¦ã,£ãƒ³ãƒ‰ã,¦ã,'è§£æ"¾
@actor_command_window.dispose
@party_command_window.dispose
@help_window.dispose
@status_window.dispose
@message_window.dispose
if @skill_window != nil
@skill_window.dispose
end
if @item_window != nil
@item_window.dispose
end
if @result_window != nil
@result_window.dispose
end
# ã,¹ãƒ--ラã,¤ãƒˆã,»ãƒƒãƒˆã,'è§£æ"¾
@spriteset.dispose
# ã,¿ã,¤ãƒˆãƒ«ç"»é¢ã«åˆ‡ã,Šæ›¿ãˆä¸ã®å ´åˆ
if $scene.is_a?(Scene_Title)
# ç"»é¢ã,'フã,§ãƒ¼ãƒ‰ã,¢ã,¦ãƒˆ
Graphics.transition
Graphics.freeze
end
# 戦é--˜ãƒ†ã,¹ãƒˆã‹ã,‰ã,²ãƒ¼ãƒ ã,ªãƒ¼ãƒãƒ¼ç"»é¢ä»¥å¤-ã«åˆ‡ã,Šæ›¿ãˆä¸ã®å ´åˆ
if $BTEST and not $scene.is_a?(Scene_Gameover)
$scene = nil
end
end
#--------------------------------------------------------------------------
# -- フレーム更æ-° (ã,¢ã,¯ã,¿ãƒ¼ã,³ãƒžãƒ³ãƒ‰ãƒ•ã,§ãƒ¼ã,º)
#--------------------------------------------------------------------------
def update_phase3
# ã,¨ãƒãƒŸãƒ¼ã,¢ãƒãƒ¼ãŒæœ‰åйã®å ´åˆ
if @enemy_arrow != nil
update_phase3_enemy_select
# ã,¢ã,¯ã,¿ãƒ¼ã,¢ãƒãƒ¼ãŒæœ‰åйã®å ´åˆ
elsif @actor_arrow != nil
update_phase3_actor_select
# ã,¹ã,ルã,¦ã,£ãƒ³ãƒ‰ã,¦ãŒæœ‰åйã®å ´åˆ
elsif @skill_window != nil
update_phase3_skill_select
# ã,¢ã,¤ãƒ†ãƒ ã,¦ã,£ãƒ³ãƒ‰ã,¦ãŒæœ‰åйã®å ´åˆ
elsif @item_window != nil
update_phase3_item_select
# ˜...è¿½åŠ ã€€è£...å,™å¤‰æ›´ã,¦ã,£ãƒ³ãƒ‰ã,¦ãŒæœ‰åйã®å ´åˆ
elsif @right_window != nil
update_phase3_equip_select
# ã,¢ã,¯ã,¿ãƒ¼ã,³ãƒžãƒ³ãƒ‰ã,¦ã,£ãƒ³ãƒ‰ã,¦ãŒæœ‰åйã®å ´åˆ
elsif @actor_command_window.active
update_phase3_basic_command
end
end
#--------------------------------------------------------------------------
# -- フレーム更æ-° (ã,¢ã,¯ã,¿ãƒ¼ã,³ãƒžãƒ³ãƒ‰ãƒ•ã,§ãƒ¼ã,º : 基本ã,³ãƒžãƒ³ãƒ‰)
#--------------------------------------------------------------------------
def update_phase3_basic_command
# B ボã,¿ãƒ³ãŒæŠ¼ã•ã,ŒãŸå ´åˆ
if Input.trigger?(Input::B)
# ã,ャンã,»ãƒ« SE ã,'æ¼"å¥
$game_system.se_play($data_system.cancel_se)
# å‰ã®ã,¢ã,¯ã,¿ãƒ¼ã®ã,³ãƒžãƒ³ãƒ‰å...¥åŠ›ã¸
phase3_prior_actor
return
end
# C ボã,¿ãƒ³ãŒæŠ¼ã•ã,ŒãŸå ´åˆ
if Input.trigger?(Input::C)
# ã,¢ã,¯ã,¿ãƒ¼ã,³ãƒžãƒ³ãƒ‰ã,¦ã,£ãƒ³ãƒ‰ã,¦ã®ã,«ãƒ¼ã,½ãƒ«ä½ç½®ã§åˆ†å²
case @actor_command_window.index
when 0 # æ"»æ'ƒ
# 決定 SE ã,'æ¼"å¥
$game_system.se_play($data_system.decision_se)
# ã,¢ã,¯ã,·ãƒ§ãƒ³ã,'è¨å®š
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 0
# ã,¨ãƒãƒŸãƒ¼ã®é¸æŠžã,'é-‹å§‹
start_enemy_select
when 1 # ã,¹ã,ル
# 決定 SE ã,'æ¼"å¥
$game_system.se_play($data_system.decision_se)
# ã,¢ã,¯ã,·ãƒ§ãƒ³ã,'è¨å®š
@active_battler.current_action.kind = 1
# ã,¹ã,ルã®é¸æŠžã,'é-‹å§‹
start_skill_select
# when 2 # 防御 # The defend function. Not cutting it out yet.
# # 決定 SE ã,'æ¼"å¥
# $game_system.se_play($data_system.decision_se)
# ã,¢ã,¯ã,·ãƒ§ãƒ³ã,'è¨å®š
# @active_battler.current_action.kind = 0
# @active_battler.current_action.basic = 1
# 次ã®ã,¢ã,¯ã,¿ãƒ¼ã®ã,³ãƒžãƒ³ãƒ‰å...¥åŠ›ã¸
# phase3_next_actor
when 2 # ã,¢ã,¤ãƒ†ãƒ
# 決定 SE ã,'æ¼"å¥
$game_system.se_play($data_system.decision_se)
# ã,¢ã,¯ã,·ãƒ§ãƒ³ã,'è¨å®š
@active_battler.current_action.kind = 2
# ã,¢ã,¤ãƒ†ãƒ ã®é¸æŠžã,'é-‹å§‹
start_item_select
when 3 # è£...å,™
# 決定 SE ã,'æ¼"å¥
$game_system.se_play($data_system.decision_se)
# ã,¢ã,¯ã,·ãƒ§ãƒ³ã,'è¨å®š
#@active_battler.current_action.kind = 0
# ã,¢ã,¤ãƒ†ãƒ ã®é¸æŠžã,'é-‹å§‹
start_equip_select
end
return
end
end
#--------------------------------------------------------------------------
# ˜... -- è¿½åŠ ã€€ãƒ•ãƒ¬ãƒ¼ãƒ æ›´æ-° (ã,¢ã,¯ã,¿ãƒ¼ã,³ãƒžãƒ³ãƒ‰ãƒ•ã,§ãƒ¼ã,º : 変更è£...å,™é¸æŠž)
#--------------------------------------------------------------------------
def update_phase3_equip_select
# ã,¹ã,ルã,¦ã,£ãƒ³ãƒ‰ã,¦ã,'å¯è¦-状æ...‹ã«ã™ã,‹
@right_window.visible = true
# ã,¦ã,£ãƒ³ãƒ‰ã,¦ã,'æ›´æ-°
@right_window.update
if @right_window.index != @now_right_window
@now_right_window =@right_window.index
if @equip_item_window.index == -1
@equip_item_window.index = 0
@equip_item_window.refresh
@equip_item_window.index = -1
end
end
# ã,¦ã,£ãƒ³ãƒ‰ã,¦ã,'æ›´æ-°
@equip_item_window.update
equip_item_window_select
# ã,¢ã,¤ãƒ†ãƒ ã,¦ã,£ãƒ³ãƒ‰ã,¦ãŒã,¢ã,¯ãƒ†ã,£ãƒ-ã®å ´åˆ
if @equip_item_window.active
update_phase3_equip_i_select
return
end
# B ボã,¿ãƒ³ãŒæŠ¼ã•ã,ŒãŸå ´åˆ
if Input.trigger?(Input::B)
# ã,ャンã,»ãƒ« SE ã,'æ¼"å¥
$game_system.se_play($data_system.cancel_se)
# è£...å,™é¸æŠžã,'çµ,了
end_equip_select
return
end
# C ボã,¿ãƒ³ãŒæŠ¼ã•ã,ŒãŸå ´åˆ
if Input.trigger?(Input::C)
# è£...å,™å›ºå®šã®å ´åˆ
if @active_battler.equip_fix?(@right_window.index)
# ãƒ-ã,¶ãƒ¼ SE ã,'æ¼"å¥
$game_system.se_play($data_system.buzzer_se)
return
end
# 決定 SE ã,'æ¼"å¥
$game_system.se_play($data_system.decision_se)
# ã,¢ã,¤ãƒ†ãƒ ã,¦ã,£ãƒ³ãƒ‰ã,¦ã,'ã,¢ã,¯ãƒ†ã,£ãƒ-åŒ-
@right_window.active = false
@equip_item_window.active = true
@equip_item_window.index = 0
@now_right_window = -1
return
end
end
#--------------------------------------------------------------------------
# ˜... -- è¿½åŠ ã€€ãƒ•ãƒ¬ãƒ¼ãƒ æ›´æ-° (ã,¢ã,¯ã,¿ãƒ¼ã,³ãƒžãƒ³ãƒ‰ãƒ•ã,§ãƒ¼ã,º : è£...å,™ã,¢ã,¤ãƒ†ãƒ é¸æŠž)
#--------------------------------------------------------------------------
def update_phase3_equip_i_select
# B ボã,¿ãƒ³ãŒæŠ¼ã•ã,ŒãŸå ´åˆ
if Input.trigger?(Input::B)
# ã,ャンã,»ãƒ« SE ã,'æ¼"å¥
$game_system.se_play($data_system.cancel_se)
# è£...å,™ã,¢ã,¤ãƒ†ãƒ é¸æŠžã,'çµ,了
@now_item_window = -1
@right_window.active = true
@equip_item_window.active = false
@equip_item_window.index = -1
return
end
# C ボã,¿ãƒ³ãŒæŠ¼ã•ã,ŒãŸå ´åˆ
if Input.trigger?(Input::C)
$game_system.se_play($data_system.equip_se)
# ã,¢ã,¤ãƒ†ãƒ ã,¦ã,£ãƒ³ãƒ‰ã,¦ã§ç¾åœ¨é¸æŠžã•ã,Œã¦ã,,ã,‹ãƒ‡ãƒ¼ã,¿ã,'å-å¾--
item = @equip_item_window.item
# è£...å,™ã,'変更
@active_battler.equip(@right_window.index, item == nil ? 0 : item.id)
# @equipnew = @right_window.index
# @active_battler.current_action.item_id = @right_window.index.id
# ラã,¤ãƒˆã,¦ã,£ãƒ³ãƒ‰ã,¦ã,'ã,¢ã,¯ãƒ†ã,£ãƒ-åŒ-
@right_window.active = true
@equip_item_window.active = false
@equip_item_window.index = -1
# ラã,¤ãƒˆã,¦ã,£ãƒ³ãƒ‰ã,¦ã€ã,¢ã,¤ãƒ†ãƒ ã,¦ã,£ãƒ³ãƒ‰ã,¦ã®å†...容ã,'å†ä½œæˆ
@right_window.refresh
@equip_item_window.refresh
end_equip_select
phase3_next_actor
end
end
#--------------------------------------------------------------------------
# Equip Result
#--------------------------------------------------------------------------
# def make_equip_action_result
#doequip = $data_items[@active_battler.current_action.item_id]
# @active_battler.equip(doequip, @new == nil ? 0 : @new.id)
# end
#--------------------------------------------------------------------------
# ˜... -- è¿½åŠ ã€€è£...å,™é¸æŠžé-‹å§‹
#--------------------------------------------------------------------------
def start_equip_select
# è£...å,™ã,¦ã,£ãƒ³ãƒ‰ã,¦ã,'作æˆ
#ãƒ'ラメーã,¿ã,'å'¼ã³å‡ºã--ãŸã,,æ™,ã¯æ³¨é‡ˆæ¶ˆã™
#@left_window = Window_EquipLeft.new(@active_battler)
@right_window = Window_EquipRight.new(@active_battler)
@item_window1 = Window_EquipItem.new(@active_battler, 0)
@item_window2 = Window_EquipItem.new(@active_battler, 1)
@item_window3 = Window_EquipItem.new(@active_battler, 2)
@item_window4 = Window_EquipItem.new(@active_battler, 3)
@item_window5 = Window_EquipItem.new(@active_battler, 4)
# ヘルãƒ--ã,¦ã,£ãƒ³ãƒ‰ã,¦ã,'é-¢é€£ä»˜ã'
@right_window.help_window = @help_window
@item_window1.help_window = @help_window
@item_window2.help_window = @help_window
@item_window3.help_window = @help_window
@item_window4.help_window = @help_window
@item_window5.help_window = @help_window
@now_right_window = -1
@right_window.index = 0
equip_item_window_select
# ã,¢ã,¯ã,¿ãƒ¼ã,³ãƒžãƒ³ãƒ‰ã,¦ã,£ãƒ³ãƒ‰ã,¦ã,'ç,,¡åйåŒ-
@actor_command_window.active = false
@actor_command_window.visible = false
end
#--------------------------------------------------------------------------
# ˜... -- è¿½åŠ ã€€è£...å,™é¸æŠžçµ,了
#--------------------------------------------------------------------------
def end_equip_select
# ã,¢ã,¤ãƒ†ãƒ ã,¦ã,£ãƒ³ãƒ‰ã,¦ã,'è§£æ"¾
#ãƒ'ラメーã,¿ã,'å'¼ã³å‡ºã--ãŸã,,æ™,ã¯æ³¨é‡ˆæ¶ˆã™
#@left_window.dispose
@right_window.dispose
@item_window1.dispose
@item_window2.dispose
@item_window3.dispose
@item_window4.dispose
@item_window5.dispose
@right_window= nil
@item_window1= nil
@item_window2= nil
@item_window3= nil
@item_window4= nil
@item_window5= nil
# ヘルãƒ--ã,¦ã,£ãƒ³ãƒ‰ã,¦ã,'éš ã™
@help_window.visible = false
# ã,¢ã,¯ã,¿ãƒ¼ã,³ãƒžãƒ³ãƒ‰ã,¦ã,£ãƒ³ãƒ‰ã,¦ã,'有効åŒ-
@actor_command_window.active = true
@actor_command_window.visible = true
end
#--------------------------------------------------------------------------
# ˜... -- è¿½åŠ ã€€è£...å,™ã,¢ã,¤ãƒ†ãƒ ã,¦ã,¤ãƒ³ãƒ‰ã,¦ã®ãƒã,§ãƒƒã,¯
#--------------------------------------------------------------------------
def equip_item_window_select
# ã,¢ã,¤ãƒ†ãƒ ã,¦ã,£ãƒ³ãƒ‰ã,¦ã®å¯è¦-状æ...‹è¨å®š
@item_window1.visible = (@right_window.index == 0)
@item_window2.visible = (@right_window.index == 1)
@item_window3.visible = (@right_window.index == 2)
@item_window4.visible = (@right_window.index == 3)
@item_window5.visible = (@right_window.index == 4)
# ーーー ˜...è¿½åŠ (注釈消ã™ã¨ã,¢ã,¯ã,»ã,µãƒª1ã¤å¢--åŠ )
#@item_window5.visible = (@right_window.index == 4) || (@right_window.index == 5)
# ーーーçµ,ã,ã,Š
# ç¾åœ¨ã®ã,¢ã,¤ãƒ†ãƒ ã,¦ã,£ãƒ³ãƒ‰ã,¦ã,' @item_window ã«è¨å®š
case @right_window.index
when 0
@equip_item_window = @item_window1
when 1
@equip_item_window = @item_window2
when 2
@equip_item_window = @item_window3
when 3
@equip_item_window = @item_window4
when 4
@equip_item_window = @item_window5
# ーーー ˜...è¿½åŠ (注釈消ã™ã¨ã,¢ã,¯ã,»ã,µãƒª1ã¤å¢--åŠ )
#when 5
# @equip_item_window = @item_window5
end
end
end
Some of the commented script lines are my own mistakes, but then others were already commented out, so I'm not sure if they're modifiers or something. Anyway, I added a bit to the code to force out of the equip menu and go to the next actor's turn after one actor has changed their equipment. The problem is that the change happens in the actor command phase, phase 3, and not during the actual turn. This means that one could just keep on exiting out of the next actor's turn to go back to the first one and equip as many times as they would like, and then go back and make another action, which kind of defeats the point of my system. I tried to change this by putting the old equipment and new equipment in variables and having them switch during the main phase, but this didn't work - in fact, it made the actor default to a basic attack without changing equips at all. Is there a way to modify this script to what I want?