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

Project1

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

[已经过期] 求大神添加一个 特技,关于普通攻击,

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
15 小时
注册时间
2015-7-7
帖子
23
跳转到指定楼层
1
发表于 2015-7-8 11:10:18 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x

求大神  帮忙 改个脚本   普通攻击效果——指定一个目标,攻击一次后,接着攻击下一个目标  攻击2次。

Lv1.梦旅人

梦石
0
星屑
211
在线时间
845 小时
注册时间
2014-5-5
帖子
944
2
发表于 2015-7-8 12:38:35 | 只看该作者
  1. #==============================================================================
  2. # ★ 二次行动 ★       -> by   芯☆淡茹水
  3. #==============================================================================
  4. # ● 使用方法:复制脚本,插入到 main 前。
  5. #==============================================================================
  6. # ● 说明:
  7. #           二次行动相关的因素有:角色ID;职业ID;武器ID;防具ID;技能ID;
  8. #                                 敌人ID;状态ID。
  9. #
  10. #           在下面的设置项里,设置好对应项目的ID和二次行动的几率即可。
  11. #           格式为:项目ID => 几率
  12. #     
  13. #==============================================================================
  14. # ● 设置:
  15. module X☆R
  16.   #--------------------------------------------------------------------------
  17.   # 禁止二次行动的开关ID(打开禁止,关闭取消禁止)。
  18.   MOVE_AGAIN_SWITCH = 10
  19.   
  20.   #--------------------------------------------------------------------------
  21.   # 二次行动的角色ID和几率。
  22.   MOVE_AGAIN_ACTOR = {1=>15,8=>10}
  23.   
  24.   #--------------------------------------------------------------------------
  25.   # 二次行动的职业ID和几率。
  26.   MOVE_AGAIN_CLASS = {2=>100}
  27.   
  28.   #--------------------------------------------------------------------------
  29.   # 二次行动的武器ID和几率。
  30.   MOVE_AGAIN_WEAPON = {2=>18}
  31.   
  32.   #--------------------------------------------------------------------------
  33.   # 二次行动的防具ID和几率。
  34.   MOVE_AGAIN_ARMOR = {27=>22}
  35.   
  36.   #--------------------------------------------------------------------------
  37.   # 二次行动的角技能ID和几率。
  38.   MOVE_AGAIN_SKILL = {57=>45}
  39.   
  40.   #--------------------------------------------------------------------------
  41.   # 二次行动的敌人ID和几率。
  42.   MOVE_AGAIN_ENEMY = {1=>1}
  43.   
  44.   #--------------------------------------------------------------------------
  45.   # 二次行动的状态ID和几率。
  46.   MOVE_AGAIN_STATE = {3=>30,4=>50,5=>70,6=>100}
  47. end
  48. #==============================================================================
  49. class Game_Battler
  50.   attr_accessor :move_again
  51.   #--------------------------------------------------------------------------
  52.   alias old_initialize_xr initialize
  53.   def initialize
  54.     @move_again = false
  55.     old_initialize_xr
  56.   end
  57.   #--------------------------------------------------------------------------
  58.   def set_move_again
  59.     return unless exist?
  60.     return  if $game_switches[X☆R::MOVE_AGAIN_SWITCH]
  61.     if self.is_a?(Game_Actor)
  62.       if X☆R::MOVE_AGAIN_ACTOR.keys.include?(self.id)
  63.         if rand(100) < X☆R::MOVE_AGAIN_ACTOR[self.id]
  64.           @move_again = true
  65.           return
  66.         end
  67.       end
  68.       if X☆R::MOVE_AGAIN_CLASS.keys.include?(@class_id)
  69.         if rand(100) < X☆R::MOVE_AGAIN_CLASS[@class_id]
  70.           @move_again = true
  71.           return
  72.         end
  73.       end
  74.       if X☆R::MOVE_AGAIN_WEAPON.keys.include?(@weapon_id)
  75.         if rand(100) < X☆R::MOVE_AGAIN_WEAPON[@weapon_id]
  76.           @move_again = true
  77.           return
  78.         end
  79.       end
  80.       for a_id in [@armor1_id,@armor2_id,@armor3_id,@armor4_id]
  81.         if X☆R::MOVE_AGAIN_ARMOR.keys.include?(a_id)
  82.           if rand(100) < X☆R::MOVE_AGAIN_ARMOR[a_id]
  83.             @move_again = true
  84.             return
  85.           end
  86.         end
  87.       end
  88.       for s_id in X☆R::MOVE_AGAIN_SKILL.keys
  89.         if skill_learn?(s_id)
  90.           if rand(100) < X☆R::MOVE_AGAIN_SKILL[s_id]
  91.             @move_again = true
  92.             return
  93.           end
  94.         end
  95.       end
  96.     else
  97.       if X☆R::MOVE_AGAIN_ENEMY.keys.include?(self.id)
  98.         if rand(100) < X☆R::MOVE_AGAIN_ENEMY[self.id]
  99.           @move_again = true
  100.           return
  101.         end
  102.       end
  103.     end
  104.     for st_id in X☆R::MOVE_AGAIN_STATE.keys
  105.       if state?(st_id)
  106.         if rand(100) < X☆R::MOVE_AGAIN_STATE[st_id]
  107.           @move_again = true
  108.           return
  109.         end
  110.       end
  111.     end
  112.   end
  113.   #--------------------------------------------------------------------------
  114.   alias old_make_action_speed_xr make_action_speed
  115.   def make_action_speed
  116.     set_move_again
  117.     old_make_action_speed_xr
  118.   end
  119. end
  120. #==============================================================================
  121. class Scene_Battle
  122.   #--------------------------------------------------------------------------
  123.   # ● 刷新画面 (主回合步骤 1 : 准备行动)
  124.   #--------------------------------------------------------------------------
  125.   def update_phase4_step1
  126.     # 隐藏帮助窗口
  127.     @help_window.visible = false
  128.     # 判定胜败
  129.     if judge
  130.       # 胜利或者失败的情况下 : 过程结束
  131.       return
  132.     end
  133.     # 强制行动的战斗者不存在的情况下
  134.     if $game_temp.forcing_battler == nil
  135.       # 设置战斗事件
  136.       setup_battle_event
  137.       # 执行战斗事件中的情况下
  138.       if $game_system.battle_interpreter.running?
  139.         return
  140.       end
  141.     end
  142.     # 强制行动的战斗者存在的情况下
  143.     if $game_temp.forcing_battler != nil
  144.       # 在头部添加后移动
  145.       @action_battlers.delete($game_temp.forcing_battler)
  146.       @action_battlers.unshift($game_temp.forcing_battler)
  147.     end
  148.     # 未行动的战斗者不存在的情况下 (全员已经行动)
  149.     if @action_battlers.size == 0
  150.       # 开始同伴命令回合
  151.       start_phase2
  152.       return
  153.     end
  154.     # 初始化动画 ID 和公共事件 ID
  155.     @animation1_id = 0
  156.     @animation2_id = 0
  157.     @common_event_id = 0
  158.     ######################################################################
  159.     if @action_battlers[0].move_again
  160.       again_battler = @action_battlers[0]
  161.       if again_battler != $game_temp.forcing_battler
  162.         @action_battlers.unshift(again_battler)
  163.       end
  164.       again_battler.move_again = false
  165.     end
  166.     ######################################################################
  167.     # 未行动的战斗者移动到序列的头部
  168.     @active_battler = @action_battlers.shift
  169.     # 如果已经在战斗之外的情况下
  170.     if @active_battler.index == nil
  171.       return
  172.     end
  173.     # 连续伤害
  174.     if @active_battler.hp > 0 and @active_battler.slip_damage?
  175.       @active_battler.slip_damage_effect
  176.       @active_battler.damage_pop = true
  177.     end
  178.     # 自然解除状态
  179.     @active_battler.remove_states_auto
  180.     # 刷新状态窗口
  181.     @status_window.refresh
  182.     # 移至步骤 2
  183.     @phase4_step = 2
  184.   end
  185. end
  186. #==============================================================================
复制代码

评分

参与人数 1星屑 +100 收起 理由
hys111111 + 100 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
165
在线时间
809 小时
注册时间
2013-8-23
帖子
804

开拓者

3
发表于 2015-7-8 12:42:48 | 只看该作者
RUBY 代码复制
  1. #复制脚本,插入到 main 前。
  2. class Scene_Battle
  3.   #--------------------------------------------------------------------------
  4.   # ● 生成基本行动结果
  5.   #--------------------------------------------------------------------------
  6.   def make_basic_action_result
  7.     # 攻击的情况下
  8.     if @active_battler.current_action.basic == 0
  9.       # 设置攻击 ID
  10.       @animation1_id = @active_battler.animation1_id
  11.       @animation2_id = @active_battler.animation2_id
  12.       # 行动方的战斗者是敌人的情况下
  13.       if @active_battler.is_a?(Game_Enemy)
  14.         if @active_battler.restriction == 3
  15.           target = $game_troop.random_target_enemy
  16.         elsif @active_battler.restriction == 2
  17.           target = $game_party.random_target_actor
  18.         else
  19.           index = @active_battler.current_action.target_index
  20.           target = $game_party.smooth_target_actor(index)
  21.         end
  22.       end
  23.       # 行动方的战斗者是角色的情况下
  24.       if @active_battler.is_a?(Game_Actor)
  25.         if @active_battler.restriction == 3
  26.           target = $game_party.random_target_actor
  27.         elsif @active_battler.restriction == 2
  28.           target = $game_troop.random_target_enemy
  29.         else
  30.           index = @active_battler.current_action.target_index
  31.           target = $game_troop.smooth_target_enemy(index)
  32.           target2 = $game_troop.random_target_enemy2(index)
  33.         end
  34.       end
  35.       # 设置对像方的战斗者序列
  36.       @target_battlers = [target,target2]
  37.       # 应用通常攻击效果
  38.       a = 1
  39.       for target in @target_battlers
  40.         if a == 2
  41.           break
  42.         end
  43.         a += 1
  44.         if target2 == nil
  45.           if target != nil
  46.             target.attack_effect(@active_battler)
  47.           end
  48.         else
  49.           if target != nil
  50.             target.attack_effect(@active_battler)
  51.           end
  52.           target2.attack_effect(@active_battler)
  53.         end
  54.       end
  55.       return
  56.     end
  57.     # 防御的情况下
  58.     if @active_battler.current_action.basic == 1
  59.       # 帮助窗口显示"防御"
  60.       @help_window.set_text($data_system.words.guard, 1)
  61.       return
  62.     end
  63.     # 逃跑的情况下
  64.     if @active_battler.is_a?(Game_Enemy) and
  65.        @active_battler.current_action.basic == 2
  66.       #  帮助窗口显示"逃跑"
  67.       @help_window.set_text("逃跑", 1)
  68.       # 逃跑
  69.       @active_battler.escape
  70.       return
  71.     end
  72.     # 什么也不做的情况下
  73.     if @active_battler.current_action.basic == 3
  74.       # 清除强制行动对像的战斗者
  75.       $game_temp.forcing_battler = nil
  76.       # 移至步骤 1
  77.       @phase4_step = 1
  78.       return
  79.     end
  80.   end
  81.   #--------------------------------------------------------------------------
  82.   # ● 刷新画面 (主回合步骤 4 : 对像方动画)
  83.   #--------------------------------------------------------------------------
  84.   def update_phase4_step4
  85.     # 对像方动画
  86.     for target in @target_battlers
  87.       if target != nil
  88.         target.animation_id = @animation2_id
  89.         target.animation_hit = (target.damage != "Miss")
  90.       end
  91.     end
  92.     # 限制动画长度、最低 8 帧
  93.     @wait_count = 8
  94.     # 移至步骤 5
  95.     @phase4_step = 5
  96.   end
  97.   def update_phase4_step5
  98.     # 隐藏帮助窗口
  99.     @help_window.visible = false
  100.     # 刷新状态窗口
  101.     @status_window.refresh
  102.     # 显示伤害
  103.     for target in @target_battlers
  104.       if target != nil
  105.         if target.damage != nil
  106.           target.damage_pop = true
  107.         end
  108.       end
  109.     end
  110.     # 移至步骤 6
  111.     @phase4_step = 6
  112.   end
  113. end
  114. class Game_Troop
  115.   #--------------------------------------------------------------------------
  116.   # ● 对像敌人的除本次随机确定
  117.   #     hp0 : 限制 HP 0 的敌人
  118.   #--------------------------------------------------------------------------
  119.   def random_target_enemy2(index2,hp0 = false)
  120.     # 初始化轮流
  121.     roulette = []
  122.     # 循环
  123.     for enemy in @enemies
  124.       # 条件符合的情况下
  125.       if (not hp0 and enemy.exist?) or (hp0 and enemy.hp0?)
  126.         if enemy != @enemies[index2]
  127.           # 添加敌人到轮流
  128.           roulette.push(enemy)
  129.         end
  130.       end
  131.     end
  132.     # 轮流尺寸为 0 的情况下
  133.     if roulette.size == 0
  134.       return nil
  135.     end
  136.     # 转轮盘赌,决定敌人
  137.     return roulette[rand(roulette.size)]
  138.   end
  139. end

评分

参与人数 1星屑 +100 梦石 +1 收起 理由
hys111111 + 100 + 1 认可答案

查看全部评分

遗失的签名。。。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
15 小时
注册时间
2015-7-7
帖子
23
4
 楼主| 发表于 2015-7-8 14:15:39 | 只看该作者
邪月长啸 发表于 2015-7-8 12:38

谢谢(σ゚∀゚)σ
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
15 小时
注册时间
2015-7-7
帖子
23
5
 楼主| 发表于 2015-7-8 14:16:19 | 只看该作者
冰水金刚 发表于 2015-7-8 12:42
#复制脚本,插入到 main 前。
class Scene_Battle
  #-------------------------------------------------- ...

(σ゚д゚)σ感谢啊
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
15 小时
注册时间
2015-7-7
帖子
23
6
 楼主| 发表于 2015-7-8 14:23:38 | 只看该作者
冰水金刚 发表于 2015-7-8 12:42
#复制脚本,插入到 main 前。
class Scene_Battle
  #-------------------------------------------------- ...

有个地方不懂啊, 就是我想把这个效果赋予一个 特技上  不是全部人都拥有这个效果,该怎么去弄啊。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
165
在线时间
809 小时
注册时间
2013-8-23
帖子
804

开拓者

7
发表于 2015-7-8 17:02:59 | 只看该作者
本帖最后由 冰水金刚 于 2015-7-8 17:08 编辑

脚本修改后重发
RUBY 代码复制
  1. #==============================================================================
  2. #                              说明
  3.  
  4. #复制脚本,插入到 main 前。
  5. #特技效果范围改为敌单体,动画为普通攻击动画,可能使用时为战斗中
  6. #第17行输入特技id
  7.  
  8.  
  9. #==============================================================================
  10. # 特技版普通攻击2敌人    -> by   冰水金刚
  11. #==============================================================================
  12. class Scene_Battle
  13.   #--------------------------------------------------------------------------
  14.   # ● 生成特技行动结果
  15.   #--------------------------------------------------------------------------
  16.   def make_skill_action_result
  17.     a = 81 # 此处输入特技id
  18.     # 获取特技
  19.     @skill = $data_skills[@active_battler.current_action.skill_id]
  20.     # 如果不是强制行动
  21.     unless @active_battler.current_action.forcing
  22.       # 因为 SP 耗尽而无法使用的情况下
  23.       unless @active_battler.skill_can_use?(@skill.id)
  24.         # 清除强制行动对像的战斗者
  25.         $game_temp.forcing_battler = nil
  26.         # 移至步骤 1
  27.         @phase4_step = 1
  28.         return
  29.       end
  30.     end
  31.     # 消耗 SP
  32.     @active_battler.sp -= @skill.sp_cost
  33.     # 刷新状态窗口
  34.     @status_window.refresh
  35.     # 在帮助窗口显示特技名
  36.     @help_window.set_text(@skill.name, 1)
  37.     # 设置动画 ID
  38.     @animation1_id = @skill.animation1_id
  39.     @animation2_id = @skill.animation2_id
  40.     # 设置公共事件 ID
  41.     @common_event_id = @skill.common_event_id
  42.     # 设置对像侧战斗者
  43.     set_target_battlers(@skill.scope)
  44.     # 应用特技效果
  45.     if @skill.id == a
  46.       # 设置对像方的战斗者序列
  47.       target2 = $game_troop.random_target_enemy2(@target_battlers[0])
  48.       @target_battlers.push(target2)
  49.       # 应用通常攻击效果
  50.       b = 1
  51.       for target in @target_battlers
  52.         if b == 2
  53.           break
  54.         end
  55.         b += 1
  56.         if target2 == nil
  57.           if target != nil
  58.             target.attack_effect(@active_battler)
  59.           end
  60.         else
  61.           if target != nil
  62.             target.attack_effect(@active_battler)
  63.           end
  64.           target2.attack_effect(@active_battler)
  65.         end
  66.       end
  67.       return
  68.     end
  69.     for target in @target_battlers
  70.       target.skill_effect(@active_battler, @skill)
  71.     end
  72.   end
  73.   #--------------------------------------------------------------------------
  74.   # ● 刷新画面 (主回合步骤 4 : 对像方动画)
  75.   #--------------------------------------------------------------------------
  76.   def update_phase4_step4
  77.     # 对像方动画
  78.     for target in @target_battlers
  79.       if target != nil
  80.         target.animation_id = @animation2_id
  81.         target.animation_hit = (target.damage != "Miss")
  82.       end
  83.     end
  84.     # 限制动画长度、最低 8 帧
  85.     @wait_count = 8
  86.     # 移至步骤 5
  87.     @phase4_step = 5
  88.   end
  89.   def update_phase4_step5
  90.     # 隐藏帮助窗口
  91.     @help_window.visible = false
  92.     # 刷新状态窗口
  93.     @status_window.refresh
  94.     # 显示伤害
  95.     for target in @target_battlers
  96.       if target != nil
  97.         if target.damage != nil
  98.           target.damage_pop = true
  99.         end
  100.       end
  101.     end
  102.     # 移至步骤 6
  103.     @phase4_step = 6
  104.   end
  105. end
  106. class Game_Troop
  107.   #--------------------------------------------------------------------------
  108.   # ● 对像敌人的除本次随机确定
  109.   #     hp0 : 限制 HP 0 的敌人
  110.   #--------------------------------------------------------------------------
  111.   def random_target_enemy2(target1,hp0 = false)
  112.     # 初始化轮流
  113.     roulette = []
  114.     # 循环
  115.     for enemy in @enemies
  116.       # 条件符合的情况下
  117.       if (not hp0 and enemy.exist?) or (hp0 and enemy.hp0?)
  118.         if enemy != target1
  119.           # 添加敌人到轮流
  120.           roulette.push(enemy)
  121.         end
  122.       end
  123.     end
  124.     # 轮流尺寸为 0 的情况下
  125.     if roulette.size == 0
  126.       return nil
  127.     end
  128.     # 转轮盘赌,决定敌人
  129.     return roulette[rand(roulette.size)]
  130.   end
  131. end
遗失的签名。。。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
235
在线时间
425 小时
注册时间
2013-6-28
帖子
173
8
发表于 2015-7-12 01:05:21 | 只看该作者
是不是攻击2次
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
15 小时
注册时间
2015-7-7
帖子
23
9
 楼主| 发表于 2015-7-13 10:04:56 | 只看该作者
j1747532399l 发表于 2015-7-12 01:05
是不是攻击2次

攻击2次,但是不是攻击同一个人。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
15 小时
注册时间
2015-7-7
帖子
23
10
 楼主| 发表于 2015-7-13 10:20:54 | 只看该作者
冰水金刚 发表于 2015-7-8 17:02
脚本修改后重发
#==============================================================================
#     ...

可以同时攻击2个人了,不过敌人伤害能显示多少伤害,但是还是显示总血量比如总血300 伤害显示100 敌人还是显示300,  但敌人是会死亡
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-20 17:59

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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