搞错了,是要点评才对…… |
悄悄给你个N年前的链接…… https://rpg.blue/thread-163143-1-1.html 如果懂得关键字搜索的话相信你会发现一片新大陆。 |
虽然还没有看那个动漫幻想曲的工程怎么做的战斗换人,不过看到换人已经知道怎么做了,就像菜单中换人那样 选中的角色 与 替换的角色 相互调换位置。再刷新各个方面 #============================================================================== # ■ 在战斗中实现战斗换人的功能{第一次写外挂脚本} by:轩辕合流 #------------------------------------------------------------------------------ class Game_Party #-------------------------------------------------------------------------- # ● 加入同伴 #-------------------------------------------------------------------------- def add_actor(actor_id) # 获取角色 actor = $game_actors[actor_id] # 同伴人数未满 10 人、本角色不在队伍中的情况下 if @actors.size < 10 and not @actors.include?(actor) # 添加角色 @actors.push(actor) # 还原主角 $game_player.refresh end end end class Window_MenuStatus < Window_Selectable alias :new_initialize :initialize def initialize new_initialize @column_max = 2 end def refresh self.contents.clear self.contents.font.size = 18 self.contents.draw_text(4, 0, 160, 32, "战斗人员") self.contents.draw_text(4, 78*2+26, 160, 32, "待机人员") @item_max = $game_party.actors.size for i in 0...$game_party.actors.size actor = $game_party.actors[i] x = i % 2 * 240 y = i / 2 * 78 + 26 if i > 3 y += 26 end draw_actor_graphic(actor, x + 16, y + 64) draw_actor_name(actor, x + 48, y) draw_actor_level(actor, x + 128, y) draw_actor_hp(actor, x + 48, y + 26) draw_actor_sp(actor, x + 48, y + 52) end end def update_cursor_rect if @index < 0 self.cursor_rect.empty else index_y = @index / 2 * 78 + 26 if @index > 3 index_y += 26 end self.cursor_rect.set(@index % 2 * 240, index_y, 200, 78) end end end class Window_Substitution < Window_Selectable def initialize super(0,0,640,320) @item_max = $game_party.actors.size self.contents = Bitmap.new(width - 32, @item_max * 32 + 32) refresh self.index = 0 end def refresh self.contents.clear self.contents.font.size = 18 for i in 0...$game_party.actors.size actor = $game_party.actors[i] y = i * 32 draw_actor_name(actor, 4, y) draw_actor_state(actor, 140, y) draw_actor_hp(actor, 284, y) draw_actor_sp(actor, 460, y) end end end class Scene_Battle alias :new_update_phase3 :update_phase3 #-------------------------------------------------------------------------- # ● 主处理 #-------------------------------------------------------------------------- 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.guard s4 = $data_system.words.item @actor_command_window = Window_Command.new(160, [s1, s2, s3, s4, "换人"]) @actor_command_window.y = 128 @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 phase3_next_actor # 循环 begin # 角色的明灭效果 OFF if @active_battler != nil @active_battler.blink = false end # 最后的角色的情况 if @actor_index == [$game_party.actors.size-1, 3].min # 开始主回合 start_phase4 return end # 推进角色索引 @actor_index += 1 @active_battler = $game_party.actors[@actor_index] @active_battler.blink = true # 如果角色是在无法接受指令的状态就再试 end until @active_battler.inputable? # 设置角色的命令窗口 phase3_setup_command_window end #-------------------------------------------------------------------------- # ● 刷新画面 (角色命令回合) #-------------------------------------------------------------------------- def update_phase3 if @substiution_window != nil update_phase3_substiution end new_update_phase3 end def update_phase3_substiution @substiution_window.update if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) @substiution_window.dispose @substiution_window = nil @actor_command_window.active = true @actor_command_window.visible = true return end if Input.trigger?(Input::C) if @substiution_window.index > 3 if $game_party.actors[@substiution_window.index].hp != 0 $game_system.se_play($data_system.decision_se) @sub = $game_party.actors[@substiution_window.index] $game_party.actors[@substiution_window.index] = $game_party.actors[@actor_index] $game_party.actors[@actor_index] = @sub else $game_system.se_play($data_system.buzzer_se) end else $game_system.se_play($data_system.buzzer_se) end @status_window.refresh @substiution_window.refresh return 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 # 防御 # 演奏确定 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 3 # 物品 # 演奏确定 SE $game_system.se_play($data_system.decision_se) # 设置行动 @active_battler.current_action.kind = 2 # 开始选择物品 start_item_select when 4 # 换人 # 演奏确定 SE $game_system.se_play($data_system.decision_se) @substiution_window = Window_Substitution.new @actor_command_window.active = false @actor_command_window.visible = false end return end end end |
轩辕合流 发表于 2020-2-18 12:43 找到了,3q |
soulsaga 发表于 2020-2-17 17:32 搜索 幻想曲 吗?我好像搜不到 |
请去下载寻佳大大的作品动漫幻想曲1OR2OR3..应该会找到相关脚本..开源的 |
站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作
GMT+8, 2024-11-26 22:13
Powered by Discuz! X3.1
© 2001-2013 Comsenz Inc.