设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1696|回复: 2
打印 上一主题 下一主题

[已经解决] 关于群体嘲讽类保护类技能脚本

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
17 小时
注册时间
2013-9-22
帖子
15
跳转到指定楼层
1
发表于 2013-10-4 00:54:18 | 只看该作者 回帖奖励 |正序浏览 |阅读模式

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

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

x
本帖最后由 rpg916162895 于 2013-10-5 01:13 编辑

我这里有个保护类技能的脚本,就是将敌人对队友的攻击转移到自己身上,但局限是只能是单体指定。求突破,改进成可以单体指定,也可以同时保护自己方所有人。
  1. #===========================================================================
  2. #本脚本来自www.66rpg.com
  3. #===========================================================================
  4. #脚本制作by bluefool
  5. #介绍: 一个援护技能,能将敌人对指定同伴的普通攻击和单体技能\魔法攻击实行遮挡,
  6. #实施护卫的角色此回合不能进行其他活动
  7. #下面设置援护技能ID(要求是一个对己方单体有效的技能)
  8. BLUE_COVER = [57,58]
  9. #下面设置援护是否对魔法攻击有效(这里设定为技能攻击力(不是威力)为0的为魔法攻击)
  10. BLUE_ID = 1   #(等于1为有效,0为无效)
  11. class Scene_Battle
  12. #--------------------------------------------------------------------------
  13. # ● 生成行动循序
  14. #--------------------------------------------------------------------------
  15. def make_action_orders
  16.    # 初始化序列 @action_battlers
  17.    @action_battlers = []
  18.    # 添加敌人到 @action_battlers 序列
  19.    for enemy in $game_troop.enemies
  20.      @action_battlers.push(enemy)
  21.    end
  22.    # 添加角色到 @action_battlers 序列
  23.    for actor in $game_party.actors
  24.      unless BLUE_COVER.include?(actor.current_action.skill_id)
  25.         @action_battlers.push(actor)
  26.       else
  27.         actor.sp -= $data_skills[actor.current_action.skill_id].sp_cost
  28.      end   
  29.    end
  30.    # 确定全体的行动速度
  31.    for battler in @action_battlers
  32.      battler.make_action_speed
  33.    end
  34.    # 按照行动速度从大到小排列
  35.    @action_battlers.sort! {|a,b|
  36.      b.current_action.speed - a.current_action.speed }
  37. end
  38. #--------------------------------------------------------------------------
  39. # ● 生成基本行动结果
  40. #--------------------------------------------------------------------------
  41. def make_basic_action_result
  42.    # 攻击的情况下
  43.    if @active_battler.current_action.basic == 0
  44.      # 设置攻击 ID
  45.      @animation1_id = @active_battler.animation1_id
  46.      @animation2_id = @active_battler.animation2_id
  47.      # 行动方的战斗者是敌人的情况下
  48.      if @active_battler.is_a?(Game_Enemy)
  49.        if @active_battler.restriction == 3
  50.          target = $game_troop.random_target_enemy
  51.        elsif @active_battler.restriction == 2
  52.          target = $game_party.random_target_actor
  53.        else
  54.          index = @active_battler.current_action.target_index
  55.          target = $game_party.smooth_target_actor(index)
  56.        end
  57.        for actor in $game_party.actors
  58.          if BLUE_COVER.include?(actor.current_action.skill_id) and actor != target
  59.            if $game_party.actors[actor.current_action.target_index] == target
  60.               target.damage = "cover"
  61.               target.damage_pop = true
  62.               target = actor
  63.            end
  64.          end   
  65.        end
  66.      end
  67.      # 行动方的战斗者是角色的情况下
  68.      if @active_battler.is_a?(Game_Actor)
  69.        if @active_battler.restriction == 3
  70.          target = $game_party.random_target_actor
  71.        elsif @active_battler.restriction == 2
  72.          target = $game_troop.random_target_enemy
  73.        else
  74.          index = @active_battler.current_action.target_index
  75.          target = $game_troop.smooth_target_enemy(index)
  76.        end
  77.      end
  78.      # 设置对像方的战斗者序列
  79.      @target_battlers = [target]
  80.      # 应用通常攻击效果
  81.      for target in @target_battlers
  82.        target.attack_effect(@active_battler)
  83.      end
  84.      return
  85.    end
  86.    # 防御的情况下
  87.    if @active_battler.current_action.basic == 1
  88.      # 帮助窗口显示"防御"
  89.      @help_window.set_text($data_system.words.guard, 1)
  90.      return
  91.    end
  92.    # 逃跑的情况下
  93.    if @active_battler.is_a?(Game_Enemy) and
  94.       @active_battler.current_action.basic == 2
  95.      #  帮助窗口显示"逃跑"
  96.      @help_window.set_text("逃跑", 1)
  97.      # 逃跑
  98.      @active_battler.escape
  99.      return
  100.    end
  101.    # 什么也不做的情况下
  102.    if @active_battler.current_action.basic == 3
  103.      # 清除强制行动对像的战斗者
  104.      $game_temp.forcing_battler = nil
  105.      # 移至步骤 1
  106.      @phase4_step = 1
  107.      return
  108.    end
  109. end
  110. #--------------------------------------------------------------------------
  111. # ● 设置物品或特技对像方的战斗者
  112. #     scope : 特技或者是物品的范围
  113. #--------------------------------------------------------------------------
  114. def set_target_battlers(scope)
  115.    # 行动方的战斗者是敌人的情况下
  116.    if @active_battler.is_a?(Game_Enemy)
  117.      # 效果范围分支
  118.      case scope
  119.      when 1  # 敌单体
  120.        index = @active_battler.current_action.target_index
  121.        @target_battlers.push($game_party.smooth_target_actor(index))
  122.        if $data_skills[@active_battler.current_action.skill_id].atk_f > 0 or BLUE_ID == 1
  123.          for actor in $game_party.actors
  124.            if BLUE_COVER.include?(actor.current_action.skill_id) and not @target_battlers.include?(actor)
  125.              if @target_battlers.include?($game_party.actors[actor.current_action.target_index])
  126.               for i in @target_battlers
  127.               i.damage = "cover"
  128.               i.damage_pop = true
  129.               end
  130.             @target_battlers.clear
  131.             @target_battlers.push(actor)
  132.              end
  133.            end   
  134.          end
  135.        end
  136.      when 2  # 敌全体
  137.        for actor in $game_party.actors
  138.          if actor.exist?
  139.            @target_battlers.push(actor)
  140.          end
  141.        end
  142.      when 3  # 我方单体
  143.        index = @active_battler.current_action.target_index
  144.        @target_battlers.push($game_troop.smooth_target_enemy(index))
  145.      when 4  # 我方全体
  146.        for enemy in $game_troop.enemies
  147.          if enemy.exist?
  148.            @target_battlers.push(enemy)
  149.          end
  150.        end
  151.      when 5  # 我方单体 (HP 0)  
  152.        index = @active_battler.current_action.target_index
  153.        enemy = $game_troop.enemies[index]
  154.        if enemy != nil and enemy.hp0?
  155.          @target_battlers.push(enemy)
  156.        end
  157.      when 6  # 我方全体 (HP 0)  
  158.        for enemy in $game_troop.enemies
  159.          if enemy != nil and enemy.hp0?
  160.            @target_battlers.push(enemy)
  161.          end
  162.        end
  163.      when 7  # 使用者
  164.        @target_battlers.push(@active_battler)
  165.      end
  166.    end
  167.    # 行动方的战斗者是角色的情况下
  168.    if @active_battler.is_a?(Game_Actor)
  169.      # 效果范围分支
  170.      case scope
  171.      when 1  # 敌单体
  172.        index = @active_battler.current_action.target_index
  173.        @target_battlers.push($game_troop.smooth_target_enemy(index))
  174.      when 2  # 敌全体
  175.        for enemy in $game_troop.enemies
  176.          if enemy.exist?
  177.            @target_battlers.push(enemy)
  178.          end
  179.        end
  180.      when 3  # 我方单体
  181.        index = @active_battler.current_action.target_index
  182.        @target_battlers.push($game_party.smooth_target_actor(index))
  183.      when 4  # 我方全体
  184.        for actor in $game_party.actors
  185.          if actor.exist?
  186.            @target_battlers.push(actor)
  187.          end
  188.        end
  189.      when 5  # 我方单体 (HP 0)  
  190.        index = @active_battler.current_action.target_index
  191.        actor = $game_party.actors[index]
  192.        if actor != nil and actor.hp0?
  193.          @target_battlers.push(actor)
  194.        end
  195.      when 6  # 我方全体 (HP 0)  
  196.        for actor in $game_party.actors
  197.          if actor != nil and actor.hp0?
  198.            @target_battlers.push(actor)
  199.          end
  200.        end
  201.      when 7  # 使用者
  202.        @target_battlers.push(@active_battler)
  203.      end
  204.    end
  205. end
  206. end
  207. #============================================================================
  208. #本脚本来自www.66rpg.com
  209. #============================================================================
复制代码

点评

大量代码要用代码框  发表于 2013-10-4 10:30

Lv1.梦旅人

梦石
0
星屑
50
在线时间
17 小时
注册时间
2013-9-22
帖子
15
3
 楼主| 发表于 2013-10-4 12:11:00 | 只看该作者
chd114 发表于 2013-10-4 10:12
····你的这个是伤害转移···又不是真的嘲讽技能直接给角色附加嘲讽状态让怪物优先攻击不就 ...

那怎么设置怪物攻击优先级啊{:2_271:}不懂的太多了
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
9280
在线时间
2504 小时
注册时间
2011-5-20
帖子
15389

开拓者

2
发表于 2013-10-4 10:12:10 | 只看该作者
····你的这个是伤害转移···又不是真的嘲讽技能直接给角色附加嘲讽状态让怪物优先攻击不就好了···
[img]http://service.t.sina.com.cn/widget/qmd/5339802982/c02e16bd/7.png
回复 支持 反对

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-9-30 04:26

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表