查看: 2803|回复: 3

[已经过期] RTAB战斗系统如何做一个技能3体或者4体的效果

[复制链接]
梦石
0
星屑
606
在线时间
797 小时
注册时间
2014-7-1
回帖
501

开拓者

发表于 2017-2-27 18:37:45 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 jiushiainilip19 于 2017-2-28 12:02 编辑

发了2个帖子 不好意思,下面那个帖子代码忘记分开了 导致4千多行在一起 帖子都爆了
还请版本删除一下,sorry!!!!!!!!!!!!!!!!!

如题所示的功能,下面是RTAB初版[XP图书馆中那个RTAB]中对技能的描述代码 。 就想用这个版本 豪华版太晕了 看不懂

[pre lang="ruby"]  
def set_target_battlers(scope, battler)
    # 行動側バトラーがエネミーの場合
    if battler.is_a?(Game_Enemy)
      # 効果範囲で分岐
      case scope
      when 1  # 敵単体
        index =battler.current_action.target_index
        battler.target.push($game_party.smooth_target_actor(index))
      when 2  # 敵全体
        for actor in $game_party.actors
          if actor.exist?
            battler.target.push(actor)
          end
        end
      when 3  # 味方単体
        index = battler.current_action.target_index
        battler.target.push($game_troop.smooth_target_enemy(index))
      when 4  # 味方全体
        for enemy in $game_troop.enemies
          if enemy.exist?
            battler.target.push(enemy)
          end
        end
      when 5  # 味方単体 (HP 0)
        index = battler.current_action.target_index
        enemy = $game_troop.enemies[index]
        if enemy != nil and enemy.hp0?
          battler.target.push(enemy)
        end
      when 6  # 味方全体 (HP 0)
        for enemy in $game_troop.enemies
          if enemy != nil and enemy.hp0?
            battler.target.push(enemy)
          end
        end
      when 7  # 使用者
        battler.target.push(battler)
        
      end
    end
    # 行動側バトラーがアクターの場合
    if battler.is_a?(Game_Actor)
      # 効果範囲で分岐
      case scope
      when 1  # 敵単体
        index = battler.current_action.target_index
        battler.target.push($game_troop.smooth_target_enemy(index))
      when 2  # 敵全体
        for enemy in $game_troop.enemies
          if enemy.exist?
            battler.target.push(enemy)
          end
        end
      when 3  # 味方単体
        index = battler.current_action.target_index
        battler.target.push($game_party.smooth_target_actor(index))
      when 4  # 味方全体
        for actor in $game_party.actors
          if actor.exist?
            battler.target.push(actor)
          end
        end
      when 5  # 味方単体 (HP 0)
        index = battler.current_action.target_index
        actor = $game_party.actors[index]
        if actor != nil and actor.hp0?
          battler.target.push(actor)
        end
      when 6  # 味方全体 (HP 0)
        for actor in $game_party.actors
          if actor != nil and actor.hp0?
            battler.target.push(actor)
          end
        end
      when 7  # 使用者
        battler.target.push(battler)
#=========================
          #2体攻击 如果换成3 或4体 可以把下面带#号的地方改成3和4
      when 10
        date = []
        if R_TWO_SKILL_ID.include?(skill.id)   #随机4体
          for enemy in $game_troop.enemies
            if enemy.exist?
              date.push(enemy)
            end
          end
          if date.size >= 2# 手动更改
           loop do
             break if battler.target.size >= 2# 手动更改
             target = date[rand (date.size)]
             if not battler.target.include?(target)
               battler.target.push(target)
             end
           end
          else
            for target in date
              battler.target.push(target)
            end
          end
        end
#=========================
        
        
      end
    end
  end
#=====================
#然后在下面在添加技能的@skill.scope范围
def make_skill_action_result(battler)
    # スキルを取得
    @skill = $data_skills[battler.current_action.skill_id]
    # 連携スキルであるかどうか確認
    speller = synthe?(battler)
    # 強制アクションでなければ
    unless battler.current_action.forcing
      # SP 切れなどで使用できなくなった場合
      if speller == nil
        unless battler.skill_can_use?(@skill.id)
          # ステップ 6 に移行
          battler.phase = 6
         return
        end
      end
    end
    # SP 消費
    temp = false
    if speller != nil
      for spell in speller
        if spell.current_action.spell_id == 0
          spell.sp -= @skill.sp_cost
        else
          spell.sp -= $data_skills[spell.current_action.spell_id].sp_cost
        end
        # ステータスウィンドウをリフレッシュ
        status_refresh(spell)
      end
    else
      battler.sp -= @skill.sp_cost
      # ステータスウィンドウをリフレッシュ
      status_refresh(battler)
    end
    # アニメーション ID を設定
    battler.anime1 = @skill.animation1_id
    battler.anime2 = @skill.animation2_id
    # コモンイベント ID を設定
    battler.event = @skill.common_event_id
    #===========================
    #技能多体
    #令狐冲+九剑归一
    if @skill.id == 603
      @skill.scope = 10
    end
   
    # 対象側バトラーを設定
    set_target_battlers(@skill.scope, battler)
#====================================
#下面省略 都是原脚本
#====================
[/pre]

点评

解决方案是利用芯大的多体效果进行对应的更改的,喜欢的拿去用吧!  发表于 2017-2-28 12:03
已经解决了!劳烦版本大大结下帖子!  发表于 2017-2-28 11:57
学习使我疲劳,打工使我疲惫,恋爱使我伤身,吸烟伤我肺腑,饮酒损我形象,旅游使我破费,月底不见铜板,只有在论坛里面看看各种大佬才能使我进去
梦石
0
星屑
668
在线时间
93 小时
注册时间
2025-5-5
回帖
10
发表于 2025-6-9 18:54:42 | 显示全部楼层
麻烦问一下,这个多体效果要怎么修改才能达到攻击多体的效果?
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部