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

Project1

 找回密码
 注册会员
搜索
楼主: dp1989
打印 上一主题 下一主题

[有事请教] 请教一下关于普通攻击二次连击目标的问题

[复制链接]

Lv5.捕梦者

梦石
0
星屑
33324
在线时间
10515 小时
注册时间
2009-3-15
帖子
4762
1
发表于 2023-11-19 00:40:12 | 显示全部楼层
本帖最后由 soulsaga 于 2023-11-19 16:44 编辑

RUBY 代码复制
  1. @连攻=0;@连打=0
  2.     # 添加角色到 @action_battlers 序列
  3.     for actor in $game_party.actors
  4.       @action_battlers.push(actor)
  5.     if actor.name =="阿尔西斯"
  6.      @action_battlers.push(actor)
  7.      @连攻=2;@连打=2
  8.      end
  9.     end



RUBY 代码复制
  1. #--------------------------------------------------------------------------
  2.   # ● 生成基本行动结果
  3.   #--------------------------------------------------------------------------
  4.   def make_basic_action_result
  5.     # 攻击的情况下
  6.     if @active_battler.current_action.basic == 0
  7.       # 设置攻击 ID
  8.       @animation1_id = @active_battler.animation1_id
  9.       @animation2_id = @active_battler.animation2_id
  10.       # 行动方的战斗者是敌人的情况下
  11.       if @active_battler.is_a?(Game_Enemy)
  12.         if @active_battler.restriction == 3
  13.           target = $game_troop.random_target_enemy
  14.         elsif @active_battler.restriction == 2
  15.           target = $game_party.random_target_actor
  16.         else
  17.           index = @active_battler.current_action.target_index
  18.           target = $game_party.smooth_target_actor(index)
  19.         end
  20.       end
  21.       # 行动方的战斗者是角色的情况下
  22.       if @active_battler.is_a?(Game_Actor)
  23.         if @active_battler.restriction == 3
  24.           target = $game_party.random_target_actor
  25.         elsif @active_battler.restriction == 2
  26.           target = $game_troop.random_target_enemy
  27.         else
  28.           index = @active_battler.current_action.target_index
  29.          #以下是添加的脚本
  30.           x=(0...$game_troop.enemies.size).to_a
  31.           x.delete_at(@active_battler.current_action.target_index)
  32.           if @连攻>0 and @连攻<@连打 and @active_battler.name=="阿尔西斯"
  33.           index=@active_battler.current_action.target_index=x[rand(x.size)]
  34.           end
  35.           target = $game_troop.smooth_target_enemy(index)
  36.           @连攻-=1 if @连攻>0
  37.         end
  38.       end
  39.       # 设置对像方的战斗者序列
  40.       @target_battlers = [target]
  41.       # 应用通常攻击效果
  42.       for target in @target_battlers
  43.         target.attack_effect(@active_battler)
  44.       end
  45.       return
  46.     end
  47.     # 防御的情况下
  48.     if @active_battler.current_action.basic == 1
  49.       # 帮助窗口显示"防御"
  50.       @help_window.set_text($data_system.words.guard, 1)
  51.       return
  52.     end
  53.     # 逃跑的情况下
  54.     if @active_battler.is_a?(Game_Enemy) and
  55.        @active_battler.current_action.basic == 2
  56.       #  帮助窗口显示"逃跑"
  57.       @help_window.set_text("逃跑", 1)
  58.       # 逃跑
  59.       @active_battler.escape
  60.       return
  61.     end
  62.     # 什么也不做的情况下
  63.     if @active_battler.current_action.basic == 3
  64.       # 清除强制行动对像的战斗者
  65.       $game_temp.forcing_battler = nil
  66.       # 移至步骤 1
  67.       @phase4_step = 1
  68.       return
  69.     end
  70.   end


技能需要也照抄一次
回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
33324
在线时间
10515 小时
注册时间
2009-3-15
帖子
4762
2
发表于 2023-11-19 13:41:06 | 显示全部楼层
本帖最后由 soulsaga 于 2023-11-19 14:02 编辑
dp1989 发表于 2023-11-19 13:07
#####################   
# 添加角色到 @action_battlers 序列
    for actor in $game_party.actors


这方法行不通呢..一般只能打同一目标
回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
33324
在线时间
10515 小时
注册时间
2009-3-15
帖子
4762
3
发表于 2023-11-19 16:17:00 | 显示全部楼层
dp1989 发表于 2023-11-19 16:01
确实可以 厉害
感谢soulsaga大大 大佬的思路清晰,学习了。

好像不行,有些问题,再研究一下
回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
33324
在线时间
10515 小时
注册时间
2009-3-15
帖子
4762
4
发表于 2023-11-19 18:34:03 | 显示全部楼层
dp1989 发表于 2023-11-19 18:28
嗯,刚刚测试了下,在数据库中用队伍测试是正常,但是正常进入游戏就又是攻击同一个人,但是如果其他人防 ...

刚才更新过的脚本试了吗?
我测试过没有问题
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-21 10:51

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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