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

Project1

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

[原创发布] 传统连击小脚本

[复制链接]

Lv1.梦旅人

薄凉看客

梦石
0
星屑
50
在线时间
1269 小时
注册时间
2010-6-20
帖子
1316
跳转到指定楼层
1
发表于 2014-2-11 14:11:26 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 恐惧剑刃 于 2014-7-25 12:00 编辑

更新下。。。
@atk_chain_states 是 攻击状态id  的数组
举个例子,比如有一个id为20的状态——狂怒
而附加这个状态的角色或者敌人都会进行三连击
那么
这样设置:
@atk_chain_states.push(20)
设置多次攻击的次数
@atk_chain_num[20] = 2#多攻击2下即攻击三次

特技连击 直接在 @skill_chain_num 处设置
比如 @skill_chain_num[57] = 1  # 就是说 57号特技会多攻击一次即攻击两次,57号特技默认十字斩
  1. class Game_Temp
  2.   attr_accessor :atk_chain_num, :skill_chain_num,
  3.   :atk_chain_states,
  4.   :battler_ok
  5.   alias initialize_old_dl initialize
  6.   def initialize
  7.     initialize_old_dl
  8.     @battler_ok = []
  9.     @atk_chain_num = {}
  10.     @skill_chain_num = {}
  11.     #===============  连击  ===============#
  12.     @atk_chain_states = [20, 21, 22]
  13.     @atk_chain_num[20] = 1
  14.     @atk_chain_num[21] = 2
  15.     @atk_chain_num[22] = 3
  16.     @skill_chain_num[57] = 1
  17.   end
  18. end
  19. class Scene_Battle
  20.   alias update_chain_atk_skill_old update
  21.   def update
  22.     if $game_temp.battle_turn != @old_battle_turn_dl
  23.       @old_battle_turn_dl = $game_temp.battle_turn
  24.       $game_temp.battler_ok = [] if $game_temp.battler_ok != []
  25.     end
  26.     update_chain_atk_skill_old
  27.   end
  28.   #--------------------------------------------------------------------------
  29.   # ● 生成行动循序
  30.   #--------------------------------------------------------------------------
  31.   def make_action_orders
  32.     # 初始化序列 @action_battlers
  33.     @action_battlers = []
  34.     # 添加敌人到 @action_battlers 序列
  35.     for enemy in $game_troop.enemies
  36.       @action_battlers.push(enemy)
  37.       #===============  连击  ===============#
  38.       if enemy.current_action.basic == 0
  39.         atk_states = []
  40.         for i in $game_temp.atk_chain_states
  41.           atk_states << i if enemy.state? i
  42.         end
  43.         chain_num = 0
  44.         for i in atk_states
  45.           chain_num += $game_temp.atk_chain_num[i]
  46.         end
  47.         for i in 1..chain_num
  48.           @action_battlers.push(enemy)
  49.         end
  50.       end
  51.       if enemy.current_action.kind == 1
  52.         skill_id = enemy.current_action.skill_id
  53.         return if $game_temp.skill_chain_num[skill_id].nil?
  54.         for i in 1..$game_temp.skill_chain_num[skill_id]
  55.           @action_battlers.push(enemy)
  56.         end
  57.       end
  58.     end
  59.     # 添加角色到 @action_battlers 序列
  60.     for actor in $game_party.actors
  61.       @action_battlers.push(actor)
  62.       #===============  连击  ===============#
  63.       if actor.current_action.basic == 0
  64.         atk_states = []
  65.         for i in $game_temp.atk_chain_states
  66.           atk_states << i if actor.state? i
  67.         end
  68.         chain_num = 0
  69.         for i in atk_states
  70.           chain_num += $game_temp.atk_chain_num[i]
  71.         end
  72.         for i in 1..chain_num
  73.           @action_battlers.push(actor)
  74.         end
  75.       end
  76.       if actor.current_action.kind == 1
  77.         skill_id = actor.current_action.skill_id
  78.         return if $game_temp.skill_chain_num[skill_id].nil?
  79.         for i in 1..$game_temp.skill_chain_num[skill_id]
  80.           @action_battlers.push(actor)
  81.         end
  82.       end
  83.     end
  84.     # 确定全体的行动速度
  85.     for battler in @action_battlers
  86.       battler.make_action_speed
  87.     end
  88.     # 按照行动速度从大到小排列
  89.     @action_battlers.sort! {|a,b|
  90.       b.current_action.speed - a.current_action.speed }
  91.   end
  92.   #--------------------------------------------------------------------------
  93.   # ● 生成基本行动结果
  94.   #--------------------------------------------------------------------------
  95.   def make_basic_action_result
  96.     # 攻击的情况下
  97.     if @active_battler.current_action.basic == 0
  98.       if !$game_temp.battler_ok.include? @active_battler
  99.         # 设置攻击 ID
  100.         @animation1_id = @active_battler.animation1_id
  101.       end
  102.       @animation2_id = @active_battler.animation2_id
  103.       # 行动方的战斗者是敌人的情况下
  104.       if @active_battler.is_a?(Game_Enemy)
  105.         if @active_battler.restriction == 3
  106.           target = $game_troop.random_target_enemy
  107.         elsif @active_battler.restriction == 2
  108.           target = $game_party.random_target_actor
  109.         else
  110.           index = @active_battler.current_action.target_index
  111.           target = $game_party.smooth_target_actor(index)
  112.         end
  113.       end
  114.       # 行动方的战斗者是角色的情况下
  115.       if @active_battler.is_a?(Game_Actor)
  116.         if @active_battler.restriction == 3
  117.           target = $game_party.random_target_actor
  118.         elsif @active_battler.restriction == 2
  119.           target = $game_troop.random_target_enemy
  120.         else
  121.           index = @active_battler.current_action.target_index
  122.           target = $game_troop.smooth_target_enemy(index)
  123.         end
  124.       end
  125.       # 设置对像方的战斗者序列
  126.       @target_battlers = [target]
  127.       # 应用通常攻击效果
  128.       for target in @target_battlers
  129.         target.attack_effect(@active_battler)
  130.       end
  131.       $game_temp.battler_ok << @active_battler
  132.       return
  133.     end
  134.     # 防御的情况下
  135.     if @active_battler.current_action.basic == 1
  136.       # 帮助窗口显示"防御"
  137.       @help_window.set_text($data_system.words.guard, 1)
  138.       return
  139.     end
  140.     # 逃跑的情况下
  141.     if @active_battler.is_a?(Game_Enemy) and
  142.        @active_battler.current_action.basic == 2
  143.       #  帮助窗口显示"逃跑"
  144.       @help_window.set_text("逃跑", 1)
  145.       # 逃跑
  146.       @active_battler.escape
  147.       return
  148.     end
  149.     # 什么也不做的情况下
  150.     if @active_battler.current_action.basic == 3
  151.       # 清除强制行动对像的战斗者
  152.       $game_temp.forcing_battler = nil
  153.       # 移至步骤 1
  154.       @phase4_step = 1
  155.       return
  156.     end
  157.   end
  158.   #--------------------------------------------------------------------------
  159.   # ● 生成特技行动结果
  160.   #--------------------------------------------------------------------------
  161.   def make_skill_action_result
  162.     # 获取特技
  163.     @skill_dl = $data_skills[@active_battler.current_action.skill_id]
  164.     # 如果不是强制行动
  165.     unless @active_battler.current_action.forcing
  166.       # 因为 SP 耗尽而无法使用的情况下
  167.       unless @active_battler.skill_can_use?(@skill_dl.id)
  168.         # 清除强制行动对像的战斗者
  169.         $game_temp.forcing_battler = nil
  170.         # 移至步骤 1
  171.         @phase4_step = 1
  172.         return
  173.       end
  174.     end
  175.     # 消耗 SP
  176.     @active_battler.sp -= @skill_dl.sp_cost
  177.     # 刷新状态窗口
  178.     @status_window.refresh
  179.     # 在帮助窗口显示特技名
  180.     @help_window.set_text(@skill_dl.name, 1)
  181.     if !$game_temp.battler_ok.include? @active_battler
  182.       # 设置动画 ID
  183.       @animation1_id = @skill_dl.animation1_id
  184.     end
  185.     @animation2_id = @skill_dl.animation2_id
  186.     # 设置公共事件 ID
  187.     @common_event_id = @skill_dl.common_event_id
  188.     # 设置对像侧战斗者
  189.     set_target_battlers(@skill_dl.scope)
  190.     # 应用特技效果
  191.     for target in @target_battlers
  192.       target.skill_effect(@active_battler, @skill_dl)
  193.     end
  194.     $game_temp.battler_ok << @active_battler
  195.   end
  196. end
复制代码

Lv2.观梦者

梦石
0
星屑
458
在线时间
182 小时
注册时间
2009-7-12
帖子
155
2
发表于 2014-2-11 22:40:26 | 只看该作者
现在正在用p叔的二连击脚本。看来可以换一个更高级的了
回复 支持 反对

使用道具 举报

Lv4.逐梦者

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

开拓者

3
发表于 2014-2-15 01:23:22 | 只看该作者
如果用agi/100来决定呢···我修改的那个连击敌人如果放魔法就会出问题···
[img]http://service.t.sina.com.cn/widget/qmd/5339802982/c02e16bd/7.png
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-13 14:23

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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