查看: 1612|回复: 2

[已经解决] 物品特效效果脚本出一点问题,求修正。

[复制链接]
梦石
20
星屑
1840
在线时间
6925 小时
注册时间
2012-12-14
回帖
10960

短篇十战斗者组别冠军开拓者贵宾短篇九勇士组亚军

发表于 2013-8-19 21:29:53 | 显示全部楼层 |阅读模式

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

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

×
[pre lang="ruby" line="1"]#==============================================================================
# ■ Scene_Battle (分割定义 4)
#------------------------------------------------------------------------------
#  处理战斗画面的类。
#==============================================================================

class Scene_Battle

  #--------------------------------------------------------------------------
  # ● 开始主回合
  #--------------------------------------------------------------------------
  def start_phase4
    # 转移到回合 4
    @phase = 4
    # 回合数计数
    $game_temp.battle_turn += 1
    # 搜索全页的战斗事件
    for index in 0...$data_troops[@troop_id].pages.size
      # 获取事件页
      page = $data_troops[@troop_id].pages[index]
      # 本页的范围是 [回合] 的情况下
      if page.span == 1
        # 设置已经执行标志
        $game_temp.battle_event_flags[index] = false
      end
    end
    # 设置角色为非选择状态
    @actor_index = -1
    @active_battler = nil
    # 有效化同伴指令窗口
    @party_command_window.active = false
    @party_command_window.visible = false
    # 无效化角色指令窗口
    @actor_command_window.active = false
    @actor_command_window.visible = false
    # 设置主回合标志
    $game_temp.battle_main_phase = true
    # 生成敌人行动
    for enemy in $game_troop.enemies
      enemy.make_action
    end
    # 生成行动顺序
    make_action_orders
    # 移动到步骤 1
    @phase4_step = 1
  end
  #--------------------------------------------------------------------------
  # ● 生成行动循序
  #--------------------------------------------------------------------------
  def make_action_orders
    # 初始化序列 @action_battlers
    @action_battlers = []
    # 添加敌人到 @action_battlers 序列
    for enemy in $game_troop.enemies
      @action_battlers.push(enemy)
    end
    # 添加角色到 @action_battlers 序列
    for actor in $game_party.actors
      @action_battlers.push(actor)
    end
    # 确定全体的行动速度
    for battler in @action_battlers
      battler.make_action_speed
    end
    # 按照行动速度从大到小排列
    @action_battlers.sort! {|a,b|
      b.current_action.speed - a.current_action.speed }
  end
  #--------------------------------------------------------------------------
  # ● 刷新画面 (主回合)
  #--------------------------------------------------------------------------
  def update_phase4
    case @phase4_step
    when 1
      update_phase4_step1
    when 2
      update_phase4_step2
    when 3
      update_phase4_step3
    when 4
      update_phase4_step4
    when 5
      update_phase4_step5
    when 6
      update_phase4_step6
    end
  end
  #--------------------------------------------------------------------------
  # ● 刷新画面 (主回合步骤 1 : 准备行动)
  #--------------------------------------------------------------------------
  def update_phase4_step1
    # 隐藏帮助窗口
    @help_window.visible = false
    # 判定胜败
    if judge
      # 胜利或者失败的情况下 : 过程结束
      return
    end
    # 强制行动的战斗者不存在的情况下
    if $game_temp.forcing_battler == nil
      # 设置战斗事件
      setup_battle_event
      # 执行战斗事件中的情况下
      if $game_system.battle_interpreter.running?
        return
      end
    end
    # 强制行动的战斗者存在的情况下
    if $game_temp.forcing_battler != nil
      # 在头部添加后移动
      @action_battlers.delete($game_temp.forcing_battler)
      @action_battlers.unshift($game_temp.forcing_battler)
    end
    # 未行动的战斗者不存在的情况下 (全员已经行动)
    if @action_battlers.size == 0
      # 开始同伴命令回合
      start_phase2
      return
    end
    # 初始化动画 ID 和公共事件 ID
    @animation1_id = 0
    @animation2_id = 0
    @common_event_id = 0
    # 未行动的战斗者移动到序列的头部
    @active_battler = @action_battlers.shift
    # 如果已经在战斗之外的情况下
    if @active_battler.index == nil
      return
    end
    # 连续伤害
    if @active_battler.hp > 0 and @active_battler.slip_damage?
      @active_battler.slip_damage_effect
      @active_battler.damage_pop = true
    end
     ########################################万兽熊最高###########################
    #####################################行动方是否为角色
     if @active_battler.is_a?(Game_Actor)
       if $game_party.item_number(20) > 0 #拥有20号物品时
      @help_window.set_text("物品发挥特效", 1)
        ####获取HP回复数值##########################
       @active_battler.damage = -($game_party.item_number(20)*3*@active_battler.maxhp/100).to_i
       ####获取SP回复数值##########################
       resp = -($game_party.item_number(20)*3*@active_battler.maxsp/100).to_i
       @active_battler.hp -= @active_battler.damage
       @active_battler.sp -= resp
       #显示SP数值需要其它脚本支持
       @active_battler.animation_id = 15 #显示15号动画
       @active_battler.damage_pop = true
       end
      end
    end
    ##########################################################################################
    # 自然解除状态
    @active_battler.remove_states_auto
    # 刷新状态窗口
    @status_window.refresh
    # 移至步骤 2
    @phase4_step = 2
  end[/pre]

以上是物品特效脚本。
但是当某个角色死亡时,这个物品还是会发挥效果。
求助怎么样修改才能让某个角色死亡,不发动效果?
大家好,这里是晨露的说。请多多指教。
刚入门RM软件制作,请大家多多帮助我哦。
落雪君的欢乐像素教程,欢迎查阅。

梦石
0
星屑
52
在线时间
586 小时
注册时间
2012-5-31
回帖
711
发表于 2013-8-19 21:38:05 | 显示全部楼层
if self.dead?
xxxxx
end

点评

谢谢,BUG修复了。  发表于 2013-8-19 21:56

评分

参与人数 1星屑 +70 收起 理由
弗雷德 + 70 认可答案

查看全部评分

回复

使用道具 举报

梦石
20
星屑
1840
在线时间
6925 小时
注册时间
2012-12-14
回帖
10960

短篇十战斗者组别冠军开拓者贵宾短篇九勇士组亚军

 楼主| 发表于 2013-8-19 21:46:20 | 显示全部楼层
wwwcctvty 发表于 2013-8-19 21:38
if self.dead?
xxxxx
end

将这句插入到if $game_party.item_number(20) > 0
之下后会报错······

点评

把self改成 @active_battler  发表于 2013-8-19 21:50
大家好,这里是晨露的说。请多多指教。
刚入门RM软件制作,请大家多多帮助我哦。
落雪君的欢乐像素教程,欢迎查阅。

回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部