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

Project1

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

[有事请教] 关于连击脚本,如何触发连击时随机选择目标?

[复制链接]

Lv5.捕梦者

梦石
0
星屑
33253
在线时间
10503 小时
注册时间
2009-3-15
帖子
4757
1
发表于 2023-12-21 00:07:54 | 显示全部楼层
本帖最后由 soulsaga 于 2023-12-24 14:44 编辑

RUBY 代码复制
  1. #--------------------------------------------------------------------------
  2.   # ● 设置物品或特技对像方的战斗者
  3.   #     scope : 特技或者是物品的范围
  4.   #--------------------------------------------------------------------------
  5.   def set_target_battlers(scope)
  6.     # 行动方的战斗者是敌人的情况下
  7.     if @active_battler.is_a?(Game_Enemy)
  8.       # 效果范围分支
  9.       case scope
  10.       when 1  # 敌单体
  11.         index = @active_battler.current_action.target_index
  12.         @target_battlers.push($game_party.smooth_target_actor(index))
  13.       when 2  # 敌全体
  14.         for actor in $game_party.actors
  15.           if actor.exist?
  16.             @target_battlers.push(actor)
  17.           end
  18.         end
  19.       when 3  # 我方单体
  20.         index = @active_battler.current_action.target_index
  21.         @target_battlers.push($game_troop.smooth_target_enemy(index))
  22.       when 4  # 我方全体
  23.         for enemy in $game_troop.enemies
  24.           if enemy.exist?
  25.             @target_battlers.push(enemy)
  26.           end
  27.         end
  28.       when 5  # 我方单体 (HP 0)
  29.         index = @active_battler.current_action.target_index
  30.         enemy = $game_troop.enemies[index]
  31.         if enemy != nil and enemy.hp0?
  32.           @target_battlers.push(enemy)
  33.         end
  34.       when 6  # 我方全体 (HP 0)
  35.         for enemy in $game_troop.enemies
  36.           if enemy != nil and enemy.hp0?
  37.             @target_battlers.push(enemy)
  38.           end
  39.         end
  40.       when 7  # 使用者
  41.         @target_battlers.push(@active_battler)
  42.       end
  43.     end
  44.     # 行动方的战斗者是角色的情况下
  45.     if @active_battler.is_a?(Game_Actor)
  46.       # 效果范围分支
  47.       case scope
  48.       when 1  # 敌单体
  49.         index = @active_battler.current_action.target_index
  50.         if $game_temp.连击FLAG
  51.         @target_battlers.push($game_troop.random_target_enemy)
  52.         return
  53.         end
  54.         @target_battlers.push($game_troop.smooth_target_enemy(index))
  55.       when 2  # 敌全体
  56.         for enemy in $game_troop.enemies
  57.           if enemy.exist?
  58.             @target_battlers.push(enemy)
  59.           end
  60.         end
  61.       when 3  # 我方单体
  62.         index = @active_battler.current_action.target_index
  63.         @target_battlers.push($game_party.smooth_target_actor(index))
  64.       when 4  # 我方全体
  65.         for actor in $game_party.actors
  66.           if actor.exist?
  67.             @target_battlers.push(actor)
  68.           end
  69.         end
  70.       when 5  # 我方单体 (HP 0)
  71.         index = @active_battler.current_action.target_index
  72.         actor = $game_party.actors[index]
  73.         if actor != nil and actor.hp0?
  74.           @target_battlers.push(actor)
  75.         end
  76.       when 6  # 我方全体 (HP 0)
  77.         for actor in $game_party.actors
  78.           if actor != nil and actor.hp0?
  79.             @target_battlers.push(actor)
  80.           end
  81.         end
  82.       when 7  # 使用者
  83.         @target_battlers.push(@active_battler)
  84.       end
  85.     end
  86.   end


未测,

点评

你不会以为我给的脚本是直接插入的吧?那是要你改的  发表于 2024-1-4 15:49
改了,51行报错  发表于 2023-12-30 23:00
改成 if @连击 !=nil 就可以了,顺便不要像我一样忘了放在 class Scene_Battle T 口 T  发表于 2023-12-30 11:29
仍然没变化…  发表于 2023-12-25 23:50
还是不行吗?那试试这个  发表于 2023-12-24 14:45
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-10 06:55

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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