查看: 2994|回复: 2

[已经过期] 关于复活技能的问题

[复制链接]
梦石
0
星屑
3031
在线时间
945 小时
注册时间
2009-1-4
回帖
139
发表于 2017-5-18 23:18:14 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
本帖最后由 MLRPG 于 2017-5-19 01:05 编辑

我根据这个帖子的内容设置了复活技能 效果的确实现了没有毛病
但是 全体复活技能的动画播放出现了问题:使用时播放一次 复活后又会播放一次 也就是说动画播放了2次(仅仅是播放动画 其他的没有问题)
那么请问可能是哪里出了问题 我的脚本有改动
  1. # ■ Scene_Battle (分割定义 4)
  2. #------------------------------------------------------------------------------
  3. #  处理战斗画面的类。
  4. #==============================================================================

  5. class Scene_Battle
  6.   #--------------------------------------------------------------------------
  7.   # ● 开始主回合
  8.   #--------------------------------------------------------------------------
  9.   def start_phase4
  10.     # 转移到回合 4
  11.     @phase = 4
  12.     # 回合数计数
  13.     $game_temp.battle_turn += 1
  14.     # 搜索全页的战斗事件
  15.     for index in 0...$data_troops[@troop_id].pages.size
  16.       # 获取事件页
  17.       page = $data_troops[@troop_id].pages[index]
  18.       # 本页的范围是 [回合] 的情况下
  19.       if page.span == 1
  20.         # 设置已经执行标志
  21.         $game_temp.battle_event_flags[index] = false
  22.       end
  23.     end
  24.     # 设置角色为非选择状态
  25.     @actor_index = -1
  26.     @active_battler = nil
  27.     # 有效化同伴指令窗口
  28.     @party_command_window.active = false
  29.     @party_command_window.visible = false
  30.     # 无效化角色指令窗口
  31.     @actor_command_window.active = false
  32.     @actor_command_window.visible = false
  33.     # 设置主回合标志
  34.     $game_temp.battle_main_phase = true
  35.     # 生成敌人行动
  36.     for enemy in $game_troop.enemies
  37.       enemy.make_action
  38.     end
  39.     # 生成行动顺序
  40.     make_action_orders
  41.     # 移动到步骤 1
  42.     @phase4_step = 1
  43.   end
  44.   #--------------------------------------------------------------------------
  45.   # ● 生成行动循序
  46.   #--------------------------------------------------------------------------
  47.   def make_action_orders
  48.     # 初始化序列 @action_battlers
  49.     @action_battlers = []
  50.     # 添加敌人到 @action_battlers 序列
  51.     for enemy in $game_troop.enemies
  52.       @action_battlers.push(enemy)
  53.     end
  54.     # 添加角色到 @action_battlers 序列
  55.     for actor in $game_party.actors
  56.       @action_battlers.push(actor)
  57.     end
  58.     # 确定全体的行动速度
  59.     for battler in @action_battlers
  60.       battler.make_action_speed
  61.     end
  62.     # 按照行动速度从大到小排列
  63.     @action_battlers.sort! {|a,b|
  64.       b.current_action.speed - a.current_action.speed }
  65.   end
  66.   #--------------------------------------------------------------------------
  67.   # ● 刷新画面 (主回合)
  68.   #--------------------------------------------------------------------------
  69.   def update_phase4
  70.     case @phase4_step
  71.     when 1
  72.       update_phase4_step1
  73.     when 2
  74.       update_phase4_step2
  75.     when 3
  76.       update_phase4_step3
  77.     when 4
  78.       update_phase4_step4
  79.     when 5
  80.       update_phase4_step5
  81.     when 6
  82.       update_phase4_step6
  83.     end
  84.   end
  85.   #--------------------------------------------------------------------------
  86.   # ● 刷新画面 (主回合步骤 1 : 准备行动)
  87.   #--------------------------------------------------------------------------
  88.   def update_phase4_step1
  89.     # 隐藏帮助窗口
  90.     @help_window.visible = false
  91.     # 判定胜败
  92.     if judge
  93.       # 胜利或者失败的情况下 : 过程结束
  94.       return
  95.     end
  96.     # 强制行动的战斗者不存在的情况下
  97.     if $game_temp.forcing_battler == nil
  98.       # 设置战斗事件
  99.       setup_battle_event
  100.       # 执行战斗事件中的情况下
  101.       if $game_system.battle_interpreter.running?
  102.         return
  103.       end
  104.     end
  105.     # 强制行动的战斗者存在的情况下
  106.     if $game_temp.forcing_battler != nil
  107.       # 在头部添加后移动
  108.       @action_battlers.delete($game_temp.forcing_battler)
  109.       @action_battlers.unshift($game_temp.forcing_battler)
  110.     end
  111.     # 未行动的战斗者不存在的情况下 (全员已经行动)
  112.     if @action_battlers.size == 0
  113.       # 开始同伴命令回合
  114.       start_phase2
  115.       return
  116.     end
  117.     # 初始化动画 ID 和公共事件 ID
  118.     @animation1_id = 0
  119.     @animation2_id = 0
  120.     @common_event_id = 0
  121.     # 未行动的战斗者移动到序列的头部
  122.     @active_battler = @action_battlers.shift
  123.     # 如果已经在战斗之外的情况下
  124.     if @active_battler.index == nil
  125.       return
  126.     end
  127.     # 连续伤害
  128.     if @active_battler.hp > 0 and @active_battler.slip_damage?
  129.       @active_battler.slip_damage_effect
  130.       @active_battler.damage_pop = true
  131.     end
  132.     # 自然解除状态
  133.     @active_battler.remove_states_auto
  134.     # 刷新状态窗口
  135.     @status_window.refresh
  136.     # 移至步骤 2
  137.     @phase4_step = 2
  138.   end
  139.   #--------------------------------------------------------------------------
  140.   # ● 刷新画面 (主回合步骤 2 : 开始行动)
  141.   #--------------------------------------------------------------------------
  142.   def update_phase4_step2
  143.     # 如果不是强制行动
  144.     unless @active_battler.current_action.forcing
  145.       # 限制为 [敌人为普通攻击] 或 [我方为普通攻击] 的情况下
  146.       if @active_battler.restriction == 2 or @active_battler.restriction == 3
  147.         # 设置行动为攻击
  148.         @active_battler.current_action.kind = 0
  149.         @active_battler.current_action.basic = 0
  150.       end
  151.       # 限制为 [不能行动] 的情况下
  152.       if @active_battler.restriction == 4
  153.         # 清除行动强制对像的战斗者
  154.         $game_temp.forcing_battler = nil
  155.         # 移至步骤 1
  156.         @phase4_step = 1
  157.         return
  158.       end
  159.     end
  160.     # 清除对像战斗者
  161.     @target_battlers = []
  162.     # 行动种类分支
  163.     case @active_battler.current_action.kind
  164.     when 0  # 基本
  165.       make_basic_action_result
  166.     when 1  # 特技
  167.       make_skill_action_result
  168.     when 2  # 物品
  169.       make_item_action_result
  170.     end
  171.     # 移至步骤 3
  172.     if @phase4_step == 2
  173.       @phase4_step = 3
  174.     end
  175.   end
  176.   #--------------------------------------------------------------------------
  177.   # ● 生成基本行动结果
  178.   #--------------------------------------------------------------------------
  179.   def make_basic_action_result
  180.     # 攻击的情况下
  181.     if @active_battler.current_action.basic == 0
  182.       # 设置攻击 ID
  183.       @animation1_id = @active_battler.animation1_id
  184.       @animation2_id = @active_battler.animation2_id
  185.       # 行动方的战斗者是敌人的情况下
  186.       if @active_battler.is_a?(Game_Enemy)
  187.         if @active_battler.restriction == 3
  188.           target = $game_troop.random_target_enemy
  189.         elsif @active_battler.restriction == 2
  190.           target = $game_party.random_target_actor
  191.         else
  192.            #=====以下更改内容=========
  193.          target_got = false
  194.          for a in $game_party.actors
  195.            if (@active_battler.state?(50) and a.state?(50)) \
  196.              or (@active_battler.state?(51) and a.state?(51)) \
  197.              or (@active_battler.state?(52) and a.state?(52)) \
  198.              or (@active_battler.state?(53) and a.state?(53))
  199.                target = a
  200.                target_got = true  if a.hp>0
  201.            end
  202.          end
  203.          unless target_got
  204.              index = @active_battler.current_action.target_index
  205.              target = $game_party.smooth_target_actor(index) #原有内容
  206.          end
  207.         #=====以上更改内容=========
  208.         end
  209.       end
  210.       # 行动方的战斗者是角色的情况下
  211.       if @active_battler.is_a?(Game_Actor)
  212.         if @active_battler.restriction == 3
  213.           target = $game_party.random_target_actor
  214.         elsif @active_battler.restriction == 2
  215.           target = $game_troop.random_target_enemy
  216.         else
  217.           index = @active_battler.current_action.target_index
  218.           target = $game_troop.smooth_target_enemy(index)
  219.         end
  220.       end
  221.       # 设置对像方的战斗者序列
  222.       @target_battlers = [target]
  223.       # 应用通常攻击效果
  224.       for target in @target_battlers
  225.         target.attack_effect(@active_battler)
  226.       end
  227.       return
  228.     end
  229.     # 防御的情况下
  230.     if @active_battler.current_action.basic == 1
  231.       # 帮助窗口显示"防御"
  232.       @help_window.set_text($data_system.words.guard, 1)
  233.       return
  234.     end
  235.     # 逃跑的情况下
  236.     if @active_battler.is_a?(Game_Enemy) and
  237.        @active_battler.current_action.basic == 2
  238.       #  帮助窗口显示"逃跑"
  239.       @help_window.set_text("逃跑", 1)
  240.       # 逃跑
  241.       @active_battler.escape
  242.       return
  243.     end
  244.     # 什么也不做的情况下
  245.     if @active_battler.current_action.basic == 3
  246.       # 清除强制行动对像的战斗者
  247.       $game_temp.forcing_battler = nil
  248.       # 移至步骤 1
  249.       @phase4_step = 1
  250.       return
  251.     end
  252.   end
  253.   #--------------------------------------------------------------------------
  254.   # ● 设置物品或特技对像方的战斗者
  255.   #     scope : 特技或者是物品的范围
  256.   #--------------------------------------------------------------------------
  257.   def set_target_battlers(scope)
  258.     # 行动方的战斗者是敌人的情况下
  259.     if @active_battler.is_a?(Game_Enemy)
  260.       # 效果范围分支
  261.       case scope
  262.       when 1  # 敌单体
  263.         index = @active_battler.current_action.target_index
  264.         @target_battlers.push($game_party.smooth_target_actor(index))
  265.       when 2  # 敌全体
  266.         for actor in $game_party.actors
  267.           if actor.exist?
  268.             @target_battlers.push(actor)
  269.           end
  270.         end
  271.       when 3  # 我方单体
  272.         index = @active_battler.current_action.target_index
  273.         @target_battlers.push($game_troop.smooth_target_enemy(index))
  274.       when 4  # 我方全体
  275.         for enemy in $game_troop.enemies
  276.           if enemy.exist?
  277.             @target_battlers.push(enemy)
  278.           end
  279.         end
  280.       when 5  # 我方单体 (HP 0)
  281.         index = @active_battler.current_action.target_index
  282.         enemy = $game_troop.enemies[index]
  283.         if enemy != nil
  284.           @target_battlers.push(enemy)
  285.         end
  286.       when 6  # 我方全体 (HP 0)
  287.         for enemy in $game_troop.enemies
  288.           if enemy != nil
  289.             @target_battlers.push(enemy)
  290.           end
  291.         end
  292.       when 7  # 使用者
  293.         @target_battlers.push(@active_battler)
  294.       end
  295.     end
  296.     # 行动方的战斗者是角色的情况下
  297.     if @active_battler.is_a?(Game_Actor)
  298.       # 效果范围分支
  299.       case scope
  300.       when 1  # 敌单体
  301.         index = @active_battler.current_action.target_index
  302.         @target_battlers.push($game_troop.smooth_target_enemy(index))
  303.       when 2  # 敌全体
  304.         for enemy in $game_troop.enemies
  305.           if enemy.exist?
  306.             @target_battlers.push(enemy)
  307.           end
  308.         end
  309.       when 3  # 我方单体
  310.         index = @active_battler.current_action.target_index
  311.         @target_battlers.push($game_party.smooth_target_actor(index))
  312.       when 4  # 我方全体
  313.         for actor in $game_party.actors
  314.           if actor.exist?
  315.             @target_battlers.push(actor)
  316.           end
  317.         end
  318.       when 5  # 我方单体 (HP 0)
  319.         index = @active_battler.current_action.target_index
  320.         actor = $game_party.actors[index]
  321.         if actor != nil
  322.           @target_battlers.push(actor)
  323.         end
  324.       when 6  # 我方全体 (HP 0)
  325.         for actor in $game_party.actors
  326.           if actor != nil
  327.             @target_battlers.push(actor)
  328.           end
  329.         end
  330.       when 7  # 使用者
  331.         @target_battlers.push(@active_battler)
  332.       end
  333.     end
  334.   end
  335.   #--------------------------------------------------------------------------
  336.   # ● 生成特技行动结果
  337.   #--------------------------------------------------------------------------
  338.   def make_skill_action_result
  339.     # 获取特技
  340.     @skill = $data_skills[@active_battler.current_action.skill_id]
  341.     # 如果不是强制行动
  342.     unless @active_battler.current_action.forcing
  343.       # 因为 SP 耗尽而无法使用的情况下
  344.       unless @active_battler.skill_can_use?(@skill.id)
  345.         # 清除强制行动对像的战斗者
  346.         $game_temp.forcing_battler = nil
  347.         # 移至步骤 1
  348.         @phase4_step = 1
  349.         return
  350.       end
  351.     end
  352.     # 消耗 SP
  353.     @active_battler.sp -= @skill.sp_cost
  354.     # 刷新状态窗口
  355.     @status_window.refresh
  356.     # 在帮助窗口显示特技名
  357.     @help_window.set_text(@skill.name, 1)
  358.     # 设置动画 ID
  359.     @animation1_id = @skill.animation1_id
  360.     @animation2_id = @skill.animation2_id
  361.     # 设置公共事件 ID
  362.     @common_event_id = @skill.common_event_id
  363.     # 设置对像侧战斗者
  364.     set_target_battlers(@skill.scope)
  365.     # 应用特技效果
  366.     for target in @target_battlers
  367.       target.skill_effect(@active_battler, @skill)
  368.     end
  369.   end
  370.   #--------------------------------------------------------------------------
  371.   # ● 生成物品行动结果
  372.   #--------------------------------------------------------------------------
  373.   def make_item_action_result
  374.     # 获取物品
  375.     @item = $data_items[@active_battler.current_action.item_id]
  376.     # 因为物品耗尽而无法使用的情况下
  377.     unless $game_party.item_can_use?(@item.id)
  378.       # 移至步骤 1
  379.       @phase4_step = 1
  380.       return
  381.     end
  382.     # 消耗品的情况下
  383.     if @item.consumable
  384.       # 使用的物品减 1
  385.       $game_party.lose_item(@item.id, 1)
  386.     end
  387.     # 在帮助窗口显示物品名
  388.     @help_window.set_text(@item.name, 1)
  389.     # 设置动画 ID
  390.     @animation1_id = @item.animation1_id
  391.     @animation2_id = @item.animation2_id
  392.     # 设置公共事件 ID
  393.     @common_event_id = @item.common_event_id
  394.     # 确定对像
  395.     index = @active_battler.current_action.target_index
  396.     target = $game_party.smooth_target_actor(index)
  397.     # 设置对像侧战斗者
  398.     set_target_battlers(@item.scope)
  399.     # 应用物品效果
  400.     for target in @target_battlers
  401.       target.item_effect(@item)
  402.     end
  403.   end
  404.   #--------------------------------------------------------------------------
  405.   # ● 刷新画面 (主回合步骤 3 : 行动方动画)
  406.   #--------------------------------------------------------------------------
  407.   def update_phase4_step3
  408.     # 行动方动画 (ID 为 0 的情况下是白色闪烁)
  409.     if @animation1_id == 0
  410.       @active_battler.white_flash = true
  411.     else
  412.       @active_battler.animation_id = @animation1_id
  413.       @active_battler.animation_hit = true
  414.     end
  415.     # 移至步骤 4
  416.     @phase4_step = 4
  417.   end
  418.   #--------------------------------------------------------------------------
  419.   # ● 刷新画面 (主回合步骤 4 : 对像方动画)
  420.   #--------------------------------------------------------------------------
  421.   def update_phase4_step4
  422.     # 对像方动画
  423.     for target in @target_battlers
  424.       target.animation_id = @animation2_id
  425.       target.animation_hit = (target.damage != "Miss")
  426.     end
  427.     # 限制动画长度、最低 8 帧
  428.     @wait_count = 8
  429.     # 移至步骤 5
  430.     @phase4_step = 5
  431.   end
  432.   #--------------------------------------------------------------------------
  433.   # ● 刷新画面 (主回合步骤 5 : 显示伤害)
  434.   #--------------------------------------------------------------------------
  435.   def update_phase4_step5
  436.     # 隐藏帮助窗口
  437.     @help_window.visible = false
  438.     # 刷新状态窗口
  439.     @status_window.refresh
  440.     # 显示伤害
  441.     for target in @target_battlers
  442.       if target.damage != nil
  443.         target.damage_pop = true
  444.       end
  445.     end
  446.     # 移至步骤 6
  447.     @phase4_step = 6
  448.   end
  449.   #--------------------------------------------------------------------------
  450.   # ● 刷新画面 (主回合步骤 6 : 刷新)
  451.   #--------------------------------------------------------------------------
  452.   def update_phase4_step6
  453.     # 清除强制行动对像的战斗者
  454.     $game_temp.forcing_battler = nil
  455.     # 公共事件 ID 有效的情况下
  456.     if @common_event_id > 0
  457.       # 设置事件
  458.       common_event = $data_common_events[@common_event_id]
  459.       $game_system.battle_interpreter.setup(common_event.list, 0)
  460.     end
  461.     # 移至步骤 1
  462.     @phase4_step = 1
  463.   end
  464. end
复制代码
梦石
1
星屑
24088
在线时间
3339 小时
注册时间
2011-7-8
回帖
3862

开拓者

发表于 2017-5-19 02:21:43 | 显示全部楼层
可能是你设置了2个动画?去掉对象方的动画试试?

点评

并不是这个问题  发表于 2017-5-19 17:05
熟悉rgss和ruby,xp区版主~
正在填坑:《膜拜组传奇》讲述膜拜组和学霸们的故事。
已上steam:与TXBD合作的Reformers《变革者》
* 战斗调用公共事件 *
* RGSOS 网络脚本 *
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部