查看: 4319|回复: 81

[已经解决] 最后一击者播放胜利动画脚本,如果敌人最后一人逃跑则.....

[复制链接]
梦石
0
星屑
35258
在线时间
4171 小时
注册时间
2007-12-15
回帖
9490
发表于 2017-8-12 19:02:23 | 显示全部楼层 |阅读模式

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

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

×
当敌人逃跑时候游戏跳出,因为我没设置会逃跑的速度型敌人,这个bug一直没测试出来。

328 行是   @actor_sprites.find{|ac| ac.battler==winner}.win
全部脚本如下,
请帮忙修正 谢谢

  1. #脚本作者 66RPG ID fux2 ,QQ 缄口不言 在下表示非常感谢。
  2. #脚本由66RPG ID 89444640 提出并与大家分享~
  3. #胜利动画增加随机播放 在胜利动画文件名下加新的编号 第6第7个星星处
  4. #!为叹号 中文全角
  5. #例 角色名★9★10★11★12★13★123!124!125★621!622!623★最后一个星可以不加
  6. class Game_Battler

  7.   def setup_battler_ani(battler_ani, once = 0,exflag = 0)
  8.     case exflag
  9.     when 1
  10.       arr = battler_ani.split(/!/)
  11.       if arr.size > 1
  12.         @win_rnd_flag = rand(arr.size)
  13.         battler_ani = arr[@win_rnd_flag]
  14.       end
  15.     when 2
  16.       arr = battler_ani.split(/!/)
  17.       if arr.size > 1
  18.         @win_rnd_flag ||= 0
  19.         battler_ani = arr[@win_rnd_flag]
  20.       end
  21.     end
  22.     @battler_ani = battler_ani
  23.     [url=home.php?mod=space&uid=2659152]@oNCE[/url] = once
  24.   end
  25.   
  26.   alias _ini_fux initialize unless $@
  27.   def initialize
  28.     @states_source = {}
  29.     _ini_fux
  30.   end
  31.   
  32.   alias _ad_state_fux add_state unless $@
  33.   def add_state(state_id, force = false)
  34.     _ad_state_fux(state_id, force)
  35.     if $game_temp.in_battle && $scene.active_battler
  36.       user = $scene.active_battler
  37.       if self.is_a?(Game_Enemy) && user.is_a?(Game_Actor)
  38.         @states_source[state_id] = user if user
  39.       end
  40.     end
  41.   end

  42.   alias _rm_state_fux remove_state unless $@
  43.   def remove_state(state_id, force = false)
  44.     _rm_state_fux(state_id, force)
  45.     if state?(state_id) == false
  46.       @states_source.delete(state_id)
  47.     end
  48.   end
  49.   
  50.   alias _sde_fux slip_damage_effect unless $@
  51.   def slip_damage_effect
  52.     spk = nil
  53.     if @states_source.size > 0
  54.       spk = @states_source.values[0]
  55.     end
  56.     ret = _sde_fux
  57.     if self.dead?
  58.       if $game_temp.in_battle
  59.         $scene.spec_killer = spk
  60.       end
  61.     end
  62.     return ret
  63.   end
  64.   
  65.   alias _hpp_fux hp= unless $@
  66.   def hp=(hp)
  67.     _hpp_fux(hp)
  68.     if self.dead?
  69.       if $game_temp.in_battle
  70.         $scene.spec_killer = nil
  71.       end
  72.     end
  73.     self.hp
  74.   end
  75. end

  76. class Sprite_Battler < RPG::Sprite
  77.   
  78.   def update
  79.     super
  80.     if [url=home.php?mod=space&uid=133701]@battler[/url] == nil
  81.       self.bitmap = nil
  82.       loop_animation(nil)
  83.       loop_animation1(nil)
  84.       return
  85.     end
  86.     if @battler.battler_name != @battler_name or
  87.       @battler.battler_hue != @battler_hue
  88.       @battler_name = @battler.battler_name
  89.       @battler_hue = @battler.battler_hue
  90.       self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
  91.       if not @battler.hidden and not @battler.dead?
  92.         @battler.setup_battler_ani(@battler.battler_name.split(/★/)[1])
  93.       end
  94.       @width = bitmap.width
  95.       [url=home.php?mod=space&uid=291977]@height[/url] = bitmap.height
  96.       self.ox = @width / 2
  97.       self.oy = @height
  98.     end
  99.     update_actor_animation
  100.     update_enemy_animation
  101.     if @battler.is_a?(Game_Enemy)
  102.       if @once == 1 and @loop_animation_once == 1 and
  103.         @battler.battler_dead_ani == 1
  104.         @battler.setup_battler_ani(@battler.battler_name.split(/★/)[5])
  105.       elsif @once == 1 and @loop_animation_once == 1 and $scene.phase != 5
  106.         @battler.setup_battler_ani(@battler.battler_name.split(/★/)[1])
  107.       end
  108.     end
  109.     if @battler.is_a?(Game_Actor)
  110.       if @once == 1 and @loop_animation_once == 1 and $scene.phase != 5 and
  111.         @battler.battler_dead_ani == 1 and @battler.dead?
  112.         @battler.setup_battler_ani(@battler.battler_name.split(/★/)[5])
  113.       elsif @once == 1 and @loop_animation_once == 1 and $scene.phase != 5
  114.         @battler.setup_battler_ani(@battler.battler_name.split(/★/)[1])
  115.         $fangyu = 0
  116.         @battler.setup_battler_dead_ani(0)
  117.       elsif @once == 1 and @loop_animation_once == 1 and $scene.phase == 5 and
  118.         not @battler.dead?
  119.         @battler.setup_battler_ani(@battler.battler_name.split(/★/)[7],0,2)
  120.         $fangyu = 0
  121.         @battler.setup_battler_dead_ani(0)
  122.       end
  123.     end
  124.     if @battler.damage == nil and
  125.       @battler.state_animation_id != @state_animation_id
  126.       @state_animation_id = @battler.state_animation_id
  127.       loop_animation1($data_animations[@state_animation_id])
  128.     end
  129.     if @battler.battler_ani != @battler_ani
  130.       @battler_ani = @battler.battler_ani
  131.       @once = @battler.battler_ani_once
  132.       loop_animation($data_animations[@battler_ani.to_i])
  133.     end
  134.     if @battler.blink
  135.       blink_on
  136.     else
  137.       blink_off
  138.     end
  139.     unless @battler_visible
  140.       if not @battler.hidden and not @battler.dead? and
  141.         (@battler.damage == nil or @battler.damage_pop)
  142.         if @battler.is_a?(Game_Enemy)
  143.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[1])
  144.         else
  145.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[1])
  146.         end
  147.         @battler_visible = true
  148.       end
  149.     end
  150.     if @battler_visible
  151.       if @battler.hidden
  152.         $game_system.se_play($data_system.escape_se)
  153.         escape
  154.         @battler_visible = false
  155.       end
  156.       if @battler.white_flash
  157.         whiten
  158.         @battler.white_flash = false
  159.       end
  160.       if @battler.animation_id != 0
  161.         animation = $data_animations[@battler.animation_id]
  162.         animation(animation, @battler.animation_hit,@battler.damage, @battler.critical)
  163.         @battler.animation_id = 0
  164.       end
  165.       if @battler.damage_pop
  166.         @battler.damage = nil
  167.         @battler.critical = false
  168.         @battler.damage_pop = false
  169.       end
  170.       if @battler.damage == nil and @battler.dead?
  171.         if @battler.is_a?(Game_Enemy)
  172.           if @battler.battler_dead_ani != 1
  173.             $game_system.se_play($data_system.enemy_collapse_se)
  174.             @battler.setup_battler_ani(@battler.battler_name.split(/★/)[4], 1)
  175.             @battler.setup_battler_dead_ani(1)
  176.           end
  177.           collapse
  178.         else
  179.           if @battler.battler_dead_ani != 1
  180.             $game_system.se_play($data_system.enemy_collapse_se)
  181.             @battler.setup_battler_ani(@battler.battler_name.split(/★/)[4], 1)
  182.             @battler.setup_battler_dead_ani(1)
  183.           end
  184.         end
  185.         @battler_visible = false
  186.       end
  187.     end
  188.     if @flash_shake_switch == true
  189.       self.x = @battler.screen_x
  190.       self.y = @battler.screen_y
  191.       self.z = @battler.screen_z
  192.       @flash_shake_switch = false
  193.     end
  194.     if @flash_shake != 0 and @battler.damage != nil and RPG::BATTLER_JUMP
  195.       if @battler.is_a?(Game_Enemy)
  196.         case @flash_shake
  197.         when 9..10
  198.           self.x -=4
  199.           self.y -=4
  200.           self.z = @battler.screen_z
  201.         when 6..8
  202.           self.x -=2
  203.           self.y -=2
  204.           self.z = @battler.screen_z
  205.         when 3..5
  206.           self.x +=2
  207.           self.y +=2
  208.           self.z = @battler.screen_z
  209.         when 1..2
  210.           self.x +=4
  211.           self.y +=4
  212.           self.z = @battler.screen_z
  213.         end
  214.       end
  215.       if @battler.is_a?(Game_Actor)
  216.         case @flash_shake
  217.         when 9..10
  218.           self.x +=4
  219.           self.y +=4
  220.           self.z = @battler.screen_z
  221.         when 6..8
  222.           self.x +=2
  223.           self.y +=2
  224.           self.z = @battler.screen_z
  225.         when 3..5
  226.           self.x -=2
  227.           self.y -=2
  228.           self.z = @battler.screen_z
  229.         when 1..2
  230.           self.x -=4
  231.           self.y -=4
  232.           self.z = @battler.screen_z
  233.         end
  234.       end
  235.       @flash_shake -= 1
  236.     end
  237.   end
  238.   
  239.   def win
  240.     if @battler_name != nil and not @battler.hidden and not @battler.dead?
  241.       @battler.setup_battler_ani(@battler_name.split(/★/)[6], 1, 1)
  242.     end
  243.   end
  244.   
  245.   def update_actor_animation
  246.     if @battler.is_a?(Game_Actor)
  247.       if @battler.show_damage_value != nil
  248.         self.damage(@battler.show_damage_value, false)
  249.         @battler.show_damage(nil)
  250.         @battler.setup_battler_ani(@battler.battler_name.split(/★/)[3], 1)
  251.         @battler.setup_battler_hurt_ani(1)
  252.       end
  253.       if @battler.current_action.kind == 0 and @battler.current_action.basic == 1 and @battler.show_damage_value != nil
  254.         if @hits > @temp_hits and not @battler.dead?
  255.           @temp_hits+=1
  256.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[2], 1)
  257.           @battler.setup_battler_hurt_ani(1)
  258.         elsif @last_hits == 1 and not @battler.dead?
  259.           @last_hits = 0
  260.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[2], 1)
  261.           @battler.setup_battler_hurt_ani(1)
  262.         elsif @frame_index != -1 and @frame_index != @last_frame and not @battler.dead? and !@battler.damage.is_a?(Numeric)
  263.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[2], 1)
  264.           @battler.setup_battler_hurt_ani(1)
  265.         elsif @last_hits == 1 and not @battler.dead? and !@battler.damage.is_a?(Numeric)
  266.           @last_hits = 0
  267.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[2], 1)
  268.           @battler.setup_battler_hurt_ani(1)
  269.         end
  270.       else
  271.         if @last_hits == 1 and not @battler.dead? and @battler.damage.is_a?(Numeric) and @battler.damage > 0 and $fangyu != 1
  272.           @last_hits = 0
  273.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[3], 1)
  274.           @battler.setup_battler_hurt_ani(1)
  275.         elsif @hits > @temp_hits and @frame_index != @last_frame and not @battler.dead? and @battler.damage.is_a?(Numeric) and @battler.damage > 0 and  
  276.           $fangyu != 1
  277.           @temp_hits+=1
  278.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[3], 1)
  279.           @battler.setup_battler_hurt_ani(1)
  280.         elsif @hits > @temp_hits and @frame_index != @last_frame and @battler.damage.is_a?(Numeric) and @battler.damage > 0 and $fangyu != 1 and  
  281.           @battler.dead? and @battler.battler_dead_ani != 1
  282.           @temp_hits+=1
  283.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[3], 1)
  284.           @battler.setup_battler_hurt_ani(1)
  285.         elsif !@battler_damage.is_a?(Numeric) and @last_hits == 1 and @frame_index == @last_frame
  286.           @last_hits = 0
  287.         elsif @battler_damage.is_a?(Numeric) and @battler.damage == 0 and @last_hits == 1 and @frame_index == @last_frame
  288.           @last_hits = 0
  289.         elsif @last_hits == 1 and @frame_index == @last_frame and @battler.dead? and @battler.battler_dead_ani != 1
  290.           @last_hits = 0
  291.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[4], 1)
  292.           @battler.setup_battler_dead_ani(1)
  293.         elsif $scene.phase == 5 and @once == 0 and @battler_name != nil and not @battler.hidden and not @battler.dead? and $game_temp.battle_proc == nil
  294.           @once = 1
  295.           @battler.setup_battler_ani(@battler_name.split(/★/)[6], 1,1)
  296.         end
  297.       end
  298.     end
  299.   end
  300. end

  301. class Scene_Battle
  302.   attr_reader   :active_battler
  303.   attr_accessor :spec_killer
  304.   def initialize
  305.     @spec_killer = nil
  306.   end
  307.   
  308.   def get_real_killer
  309.     if @spec_killer
  310.       return @spec_killer
  311.     end
  312.     return @active_battler
  313.   end
  314.   
  315.   def start_phase5
  316.     @spriteset.win(get_real_killer)
  317.     start_phase5101
  318.   end
  319. end

  320. class Spriteset_Battle
  321.   def win(winner)
  322.     if winner
  323.       @actor_sprites.find{|ac| ac.battler==winner}.win
  324.     else
  325.       for sprite in @actor_sprites
  326.         sprite.win
  327.       end
  328.     end
  329.   end
  330. end

  331. class Game_Actor < Game_Battler
  332.   def screen_z
  333.     case self.index
  334.     when 0
  335.       return 70
  336.     when 1
  337.       return 90
  338.     when 2
  339.       return 80
  340.     when 3
  341.       return 100
  342.     else
  343.       return 0
  344.     end
  345.   end
  346. end

  347. module RPG
  348.   class Sprite < ::Sprite
  349.     def animation_set_sprites(sprites, cell_data, position)
  350.       for i in 0..15
  351.         sprite = sprites[i]
  352.         pattern = cell_data[i, 0]
  353.         if sprite == nil or pattern == nil or pattern == -1
  354.           sprite.visible = false if sprite != nil
  355.           next
  356.         end
  357.         sprite.visible = true
  358.         sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
  359.         if position == 3
  360.           if self.viewport != nil
  361.             sprite.x = self.viewport.rect.width / 2
  362.             sprite.y = self.viewport.rect.height - 160
  363.           else
  364.             sprite.x = 320
  365.             sprite.y = 240
  366.           end
  367.         else
  368.           sprite.x = self.x - self.ox + self.src_rect.width / 2
  369.           sprite.y = self.y - self.oy + self.src_rect.height / 2
  370.           sprite.y -= self.src_rect.height / 4 if position == 0
  371.           sprite.y += self.src_rect.height / 4 if position == 2
  372.         end
  373.         sprite.x += cell_data[i, 1]
  374.         sprite.y += cell_data[i, 2]
  375.         sprite.z = 2000+self.z
  376.         sprite.ox = 96
  377.         sprite.oy = 96
  378.         sprite.zoom_x = cell_data[i, 3] / 100.0
  379.         sprite.zoom_y = cell_data[i, 3] / 100.0
  380.         sprite.angle = cell_data[i, 4]
  381.         sprite.mirror = (cell_data[i, 5] == 1)
  382.         sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
  383.         sprite.blend_type = cell_data[i, 7]
  384.       end
  385.     end
  386.   end
  387. end
复制代码
梦石
0
星屑
39336
在线时间
11161 小时
注册时间
2009-3-15
回帖
4768
发表于 2017-8-14 12:09:40 | 显示全部楼层
本帖最后由 soulsaga 于 2017-8-14 14:23 编辑

有问题的话还原脚本..

  1. def get_real_killer
  2.     if @spec_killer
  3.       return @spec_killer
  4.     end
  5.     return $activebattler
  6.   end
复制代码

反击死的问题可能要改成这样..
然后MAIN上面插入以下脚本
  1. class Game_Battler
  2.     #--------------------------------------------------------------------------
  3.   # ● 应用通常攻击效果
  4.   #     attacker : 攻击者 (battler)
  5.   #--------------------------------------------------------------------------

  6. alias attack_effect20170814 attack_effect
  7.   def attack_effect(attacker)
  8.     $activebattler = attacker if attacker.is_a?(Game_Actor)#如果攻击者是角色就代入到变量里
  9.    
  10.     return attack_effect20170814(attacker)
  11.   end
  12.     #--------------------------------------------------------------------------
  13.   # ● 应用特技效果
  14.   #     user  : 特技的使用者 (battler)
  15.   #     skill : 特技
  16.   #--------------------------------------------------------------------------
  17. alias skill_effect20170814 skill_effect
  18.   def skill_effect(user, skill)
  19.     $activebattler = user if user.is_a?(Game_Actor)#如果攻击者是角色就代入到变量里
  20.     return skill_effect20170814(user, skill)
  21.   end
  22. end
复制代码


就既可解決敌人逃走弹出问题..又能改成最后攻击的角色播放动画了..

点评

有return @spec_killer那些的话..反击死也可以正常了..  发表于 2017-8-14 15:01
上来跑倒是没事,反击还没测试到,上面那个我改的不一样,就加一句313 return $activebattler end没加目前正常  发表于 2017-8-14 14:34
再修正脚本..果然杀死敌人播放胜利动画要留下呢..  发表于 2017-8-14 14:24
话说反击死正常吗..  发表于 2017-8-14 14:16
我想应该没有问题.不过没有清空全局变量..所以这次胜利后下次战斗敌人一开始就逃走的话就应该会是播放和上一次战斗最后同一人胜利动画吧..  发表于 2017-8-14 14:13
回复

使用道具 举报

梦石
0
星屑
39336
在线时间
11161 小时
注册时间
2009-3-15
回帖
4768
发表于 2017-8-12 23:00:20 | 显示全部楼层
怎么不@版主过来?
回复

使用道具 举报

梦石
0
星屑
35258
在线时间
4171 小时
注册时间
2007-12-15
回帖
9490
 楼主| 发表于 2017-8-12 23:04:52 | 显示全部楼层
本帖最后由 89444640 于 2017-8-13 09:39 编辑

@fux2这样用?@fux2
没用过不清楚。
01.png

点评

水区那个接龙,别人设置了一个会逃跑的速度型敌人,每次最后一名敌人逃跑就跳出,我才发现这个bug  发表于 2017-8-14 08:43
没用你怎么测出BUG?  发表于 2017-8-14 08:38
现实的动画得用全动画脚本里面那个方法,星号后的数字什么的,敌人逃跑--b从来没用过不清楚  发表于 2017-8-14 08:14
可以教一下怎么显示胜利动画和设置敌人逃走吗?  发表于 2017-8-13 11:18
回复

使用道具 举报

梦石
0
星屑
35258
在线时间
4171 小时
注册时间
2007-12-15
回帖
9490
 楼主| 发表于 2017-8-14 09:05:54 | 显示全部楼层
本帖最后由 89444640 于 2017-8-15 14:38 编辑

这样吧,我清理出来一个测试工程过来容易修改。
敌人设置100%逃跑,都调好了,请测试。
回复

使用道具 举报

梦石
0
星屑
39336
在线时间
11161 小时
注册时间
2009-3-15
回帖
4768
发表于 2017-8-14 09:59:48 | 显示全部楼层
本帖最后由 soulsaga 于 2017-8-14 10:09 编辑
89444640 发表于 2017-8-14 09:05
这样吧,我清理出来一个测试工程过来容易修改。
敌人设置100%逃跑,都调好了,请测试。


  1.     @spriteset.win(get_real_killer) if @battler.is_a?(Game_Actor)
复制代码


最后一击者播放胜利动画脚本改成这样就可以了..

点评

你给我的工程可以正常播放胜利动画啊..虽然有点怪..两个灵梦都一起播放..  发表于 2017-8-14 12:23
那啥 不行……两个工程这么改完都不播放胜利动画了。ORZ  发表于 2017-8-14 11:20
没事我再试试,毕竟主程序里面好多杂七杂八的,没准别的脚本也有修改,现在只要不跳出就好。  发表于 2017-8-14 11:10
你得找大神帮你再改改脚本了..现在这个只是杀死敌人的角色播放胜利动画..  发表于 2017-8-14 10:48
不对..再研究一下..杀死敌人就返回杀死的角色..否则就是当前行动者  发表于 2017-8-14 10:42

评分

参与人数 2星屑 +140 梦石 +2 收起 理由
RyanBern + 2 认可答案
89444640 + 140

查看全部评分

回复

使用道具 举报

梦石
0
星屑
35258
在线时间
4171 小时
注册时间
2007-12-15
回帖
9490
 楼主| 发表于 2017-8-14 16:43:56 | 显示全部楼层
本帖最后由 89444640 于 2017-8-14 16:46 编辑
soulsaga 发表于 2017-8-14 12:09
有问题的话还原脚本..

def get_real_killer


单人测试没问题了,特意去试了下两人的情况。
两人的情况第一名角色胜利动画依然随机播放,
第二人有三个随机胜利动作,但是每次该角色胜利必定只播放第一个,其他的都不播放,
试了十次都是播放第一个,不可能是我运气太差了。
不知道是这个脚本原先的问题我没试出来还是新出现的。
可能主角灭人的次数太多了,没注意到同伴有这个问题。
不知道第三人第四人是否也是如此。

点评

不过你给我的工程就已经是胜利全员都会播放胜利动画..为何?  发表于 2017-8-14 17:12
我测试没问题..4人都随机播放..不过似乎有时会几种胜利动作混合播放?  发表于 2017-8-14 17:11
回复

使用道具 举报

梦石
0
星屑
39336
在线时间
11161 小时
注册时间
2009-3-15
回帖
4768
发表于 2017-8-14 16:46:29 | 显示全部楼层
本帖最后由 soulsaga 于 2017-8-15 20:50 编辑


https://rpg.blue/forum.php?mod=v ... &extra=page%3D1
位移写好了..要配合上面地址的工具使用..
  1. #位移BY:SOULSAGA
  2. #使用方法:打开RMXP备注编辑器RXDataEditor.exe
  3. #在技能备注写
  4. #X移动:+:位移植
  5. #X移动:-:位移植
  6. #向左移是+向右移是-敌人打我方则相反
  7. #Y移动:+:位移植
  8. #Y移动:-:位移植
  9. #等待:帧数值   最大是动画总帧数+14 超过不会有效
  10. #受伤动作:战斗图用星号隔开的编号..



  11. class Game_Battler
  12.   alias item_effectsoulsaga item_effect
  13.   def item_effect(item)
  14.     $skill_id = 1
  15.     $skillmoveflag = "OFF"
  16.     $wait_count = 0
  17.     @wait_skill = false
  18.     $i = 0
  19.     $battler_damage = 3
  20.     return item_effectsoulsaga(item)
  21.   end
  22.    
  23.     #--------------------------------------------------------------------------
  24.   # ● 应用通常攻击效果
  25.   #     attacker : 攻击者 (battler)
  26.   #--------------------------------------------------------------------------

  27.   
  28. alias attack_effect20170814 attack_effect
  29.   def attack_effect(attacker)
  30.     $activebattler = attacker if attacker.is_a?(Game_Actor)#如果攻击者是角色就代入到变量里
  31.     $skill_id = 1
  32.     $skillmoveflag = "OFF"
  33.     $wait_count = 0
  34.     @wait_skill = false
  35.     $i = 0
  36.     $battler_damage = 3
  37.     return attack_effect20170814(attacker)
  38.   end
  39.     #--------------------------------------------------------------------------
  40.   # ● 应用特技效果
  41.   #     user  : 特技的使用者 (battler)
  42.   #     skill : 特技
  43.   #--------------------------------------------------------------------------
  44. alias skill_effect20170814 skill_effect
  45.   def skill_effect(user, skill)
  46.     $skill_id = skill.id
  47.     $skillmoveflag = "OFF"
  48.     $wait_count = 0
  49.     @wait_skill = false
  50.     $i = 0
  51.     $battler_damage = 3
  52.     $activebattler = user if user.is_a?(Game_Actor)#如果攻击者是角色就代入到变量里
  53.     return skill_effect20170814(user, skill)
  54.   end
  55. end
  56. module RPG
  57. class Sprite < ::Sprite
  58. #位移BY:SOULSAGA
  59.    #..........................................................................
  60.    def update_animation
  61.      if @_animation_duration > 0
  62.        frame_index = @_animation.frame_max - @_animation_duration
  63.        @frame_index = frame_index
  64.        cell_data = @_animation.frames[frame_index].cell_data
  65.        position = @_animation.position
  66.        animation_set_sprites(@_animation_sprites, cell_data, position)
  67.       
  68.        $wait_count -= 1 if $wait_count >= 1
  69.        if $skillmoveflag == "OFF"
  70.        @skill_xmove = []
  71. skill = $data_skills[$skill_id]
  72. skill_xymove = skill.note.split(/\r\n/)
  73. if $wait_count <= 0 and @battler.damage != "Miss" and @battler.damage != nil
  74.       while $i < skill_xymove.length
  75.         if $wait_count <= 0 and @battler.damage != "Miss" and @battler.damage != nil
  76.         @skill_xmove = skill_xymove[$i].split(/:/)
  77.       if skill_xymove[$i].include?("X移动")
  78.        case @skill_xmove[1]
  79.     when "+"
  80.        self.ox += @skill_xmove[2].to_i if @battler.is_a?(Game_Enemy)
  81.        self.ox -= @skill_xmove[2].to_i if @battler.is_a?(Game_Actor)
  82.        when "-"
  83.        self.ox -= @skill_xmove[2].to_i if @battler.is_a?(Game_Enemy)
  84.        self.ox += @skill_xmove[2].to_i if @battler.is_a?(Game_Actor)
  85.        end
  86.      end
  87.      if skill_xymove[$i].include?("Y移动")
  88.        case @skill_xmove[1]
  89.     when "+"
  90.        self.oy += @skill_xmove[2].to_i if @battler.is_a?(Game_Enemy)
  91.        self.oy += @skill_xmove[2].to_i if @battler.is_a?(Game_Actor)
  92.        when "-"
  93.        self.oy -= @skill_xmove[2].to_i if @battler.is_a?(Game_Enemy)
  94.        self.oy -= @skill_xmove[2].to_i if @battler.is_a?(Game_Actor)
  95.      end
  96.      end
  97.    end
  98.    if skill_xymove[$i].include?("受伤动作")
  99.      $battler_damage = @skill_xmove[1].to_i
  100.      end
  101.    if skill_xymove[$i].include?("等待")
  102.      $wait_count = @skill_xmove[1].to_i
  103.      $skillmoveflag = "OFF"
  104.       end
  105.       $i += 1
  106.       break if $wait_count > 0
  107.       $skillmoveflag = "ON"
  108.       end
  109.   end
  110.   end
  111.   #=======================================
  112.        # 修改:弹出伤害,权重计算
  113.        #=======================================
  114.        for timing in @_animation.timings
  115.          if timing.frame == frame_index
  116.            t = 1.0 * animation_process_timing(timing, @_animation_hit)            
  117.            #p t,"当前权重", @all_quanzhong,"总权重"
  118.            if @battler_damage.is_a?(Numeric) and t != 0
  119.              t *= @battler_damage
  120.              t /= @all_quanzhong
  121.              t = t.to_i
  122.              #在闪光不是最后一次的情况下,把这次伤害加入到已经发生的伤害中★★★★★★★★★★★★★★★★★★★★★★★★★★
  123.              if frame_index != @_last_frame
  124.              @p_dam+= t
  125.              end
  126.              #p @p_dam,"已发生伤害",@battler_damage,"总伤害"(调试用)★★★★★★★★★★★★★★★★★★★★★★★★★★
  127.              #闪光为最后一次的情况下,改变这次伤害的计算方法(总伤害-已经发生伤害)★★★★★★★★★★★★★★★★★★★★★★★★★★
  128.              if frame_index == @_last_frame
  129.                t= @battler_damage-@p_dam
  130.              end
  131.              #p t,"当前伤害",@battler_damage,"总伤害"
  132.              # 最后一次闪光的话,伤害修正
  133.              if frame_index == @_last_frame
  134.                @_total_damage = @battler_damage - t
  135.                @p_dam=0      #已经发生的伤害归0★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  136.             end
  137.              #p t,@battler_damage,@all_quanzhong
  138.              damage(t,@battler_critical) if timing.flash_scope != 3
  139.             #连击次数归0★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  140.             if frame_index == @_last_frame
  141.                       ############ #小改动
  142.                       @last_hits=1
  143.                       @temp_hits=0
  144.                       ############
  145.                       @hits=0
  146.             end
  147.            # 防止重复播放miss
  148.            elsif !@battler_damage.is_a?(Numeric) and timing.flash_scope != 0
  149.              damage(@battler_damage,@battler_critical)
  150.            end
  151.          end
  152.        end
  153.      else
  154.        dispose_animation
  155.        end
  156. end
  157. end
  158. end


  159. class Sprite_Battler < RPG::Sprite
  160.   #--------------------------------------------------------------------------
  161.   # ● 处理角色动作
  162.   #--------------------------------------------------------------------------
  163.   def update_actor_animation
  164.     if @battler.is_a?(Game_Actor)
  165.       if @battler.show_damage_value != nil
  166.         self.damage(@battler.show_damage_value, false)
  167.         @battler.show_damage(nil)
  168.         @battler.setup_battler_ani(@battler.battler_name.split(/★/)[$battler_damage], 1)
  169.         @battler.setup_battler_hurt_ani(1)
  170.       end
  171.       @last_frame = $fanime_frame_max if $fanime_frame_max > @last_frame
  172.       if @battler.current_action.kind == 0 and @battler.current_action.basic == 1 and @battler.show_damage_value != nil
  173.         # 防御的时候
  174.         if @hits > @temp_hits and not @battler.dead?
  175.           ############ #小改动
  176.           @temp_hits+=1
  177.           ############
  178.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[2], 1)
  179.           @battler.setup_battler_hurt_ani(1)
  180.           #################################################################
  181.         elsif @last_hits == 1 and not @battler.dead?
  182.           ############ #小改动
  183.           @last_hits = 0
  184.           ############
  185.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[2], 1)
  186.           @battler.setup_battler_hurt_ani(1)
  187.           #################################################################
  188.         elsif @frame_index != -1 and @frame_index != @last_frame and not @battler.dead? and !@battler.damage.is_a?(Numeric)
  189.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[2], 1)
  190.           @battler.setup_battler_hurt_ani(1)
  191.           #################################################################
  192.         elsif @last_hits == 1 and not @battler.dead? and !@battler.damage.is_a?(Numeric)
  193.           ############ #小改动
  194.           @last_hits = 0
  195.           ############
  196.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[2], 1)
  197.           @battler.setup_battler_hurt_ani(1)
  198.           #################################################################
  199.         end
  200.       else
  201.         # 单回合只有一次攻击
  202.        if @last_hits == 1 and not @battler.dead? and @battler.damage.is_a?(Numeric) and @battler.damage > 0 and $fangyu != 1
  203.           ############ #小改动
  204.           @last_hits = 0
  205.           ############
  206.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[$battler_damage], 1)
  207.           @battler.setup_battler_hurt_ani(1)
  208.           #################################################################
  209.         # 单回合多次攻击
  210.        elsif @hits > @temp_hits and @frame_index != @last_frame and not @battler.dead? and @battler.damage.is_a?(Numeric) and @battler.damage > 0 and  
  211. $fangyu != 1
  212.           ############ #小改动
  213.           @temp_hits+=1
  214.           ############
  215.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[$battler_damage], 1)
  216.           @battler.setup_battler_hurt_ani(1)
  217.         ########################################################################
  218.         # 死亡之前攻击
  219.        elsif @hits > @temp_hits and @frame_index != @last_frame and @battler.damage.is_a?(Numeric) and @battler.damage > 0 and $fangyu != 1 and  
  220. @battler.dead? and @battler.battler_dead_ani != 1
  221.           ############ #小改动
  222.           @temp_hits+=1
  223.           ############
  224.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[$battler_damage], 1)
  225.           @battler.setup_battler_hurt_ani(1)
  226.           #################################################################
  227.         # 闪避的回合
  228.        elsif !@battler_damage.is_a?(Numeric) and @last_hits == 1 and @frame_index == @last_frame
  229.           @last_hits = 0
  230.           #################################################################
  231.         # 无伤害的攻击
  232.         elsif @battler_damage.is_a?(Numeric) and @battler.damage == 0 and @last_hits == 1 and @frame_index == @last_frame
  233.           @last_hits = 0
  234.           #################################################################
  235.         # 死亡判定
  236.         elsif @frame_index == @last_frame and @battler.dead? and @battler.battler_dead_ani != 1
  237.           #p 111
  238.        #elsif @last_hits == 1 and @frame_index == @last_frame and @battler.dead? and @battler.battler_dead_ani != 1
  239.           @last_hits = 0
  240.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[4], 1)
  241.           #@battler.setup_battler_dead_ani(1)
  242.           #################################################################
  243.         # 胜利判定
  244.        elsif $scene.phase == 5 and @once == 0 and @battler_name != nil and not @battler.hidden and not @battler.dead? and $game_temp.battle_proc == nil
  245.              @once = 1
  246.              @battler.setup_battler_ani(@battler_name.split(/★/)[6], 1)
  247.         end
  248.       end
  249.       @battler.setup_battler_ani(@battler.battler_name.split(/★/)[$battler_damage], 1) if @frame_index < @last_frame and @frame_index > 0 and @battler.battler_dead_ani != 1 and $battler_damage != 3 and @battler.damage.is_a?(Numeric)
  250.     end
  251.   end
  252.   #--------------------------------------------------------------------------
  253.   # ● 处理敌人动作
  254.   #--------------------------------------------------------------------------
  255.   def update_enemy_animation
  256.     if @battler.is_a?(Game_Enemy)
  257.       if @battler.show_damage_value != nil
  258.         self.damage(@battler.show_damage_value, false)
  259.         @battler.show_damage(nil)
  260.         @battler.setup_battler_ani(@battler.battler_name.split(/★/)[$battler_damage], 1)
  261.         @battler.setup_battler_hurt_ani(1)
  262.       end
  263.       @last_frame = $fanime_frame_max if $fanime_frame_max > @last_frame
  264.       if @battler.current_action.kind == 0 and @battler.current_action.basic == 1
  265.       else
  266.         # 单回合只有一次攻击
  267.         if @last_hits == 1 and not @battler.dead? and @battler.damage.is_a?(Numeric) and @battler.damage > 0
  268.           ############ #小改动
  269.           #p 222
  270.           @last_hits = 0
  271.           ############
  272.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[$battler_damage], 1)
  273.           @battler.setup_battler_hurt_ani(1)
  274.           #################################################################
  275.         # 单回合多次攻击
  276.        elsif @hits > @temp_hits and @frame_index != @last_frame and not @battler.dead? and @battler.damage.is_a?(Numeric) and @battler.damage > 0
  277.           ############ #小改动
  278.           #p 111
  279.           @temp_hits+=1
  280.           ############
  281.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[$battler_damage], 1)
  282.           @battler.setup_battler_hurt_ani(1)
  283.           #################################################################
  284.         # 死亡之前攻击
  285.        elsif @hits > @temp_hits and @frame_index != @last_frame and @battler.damage.is_a?(Numeric) and @battler.damage > 0 and @battler.dead? and @battler.battler_dead_ani != 1
  286.           ############ #小改动
  287.           #p 333
  288.           @temp_hits+=1
  289.           ############
  290.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[$battler_damage], 1)
  291.           @battler.setup_battler_hurt_ani(1)
  292.           #################################################################
  293.         # 无伤害的攻击
  294.         elsif !@battler_damage.is_a?(Numeric) and @last_hits == 1 and @frame_index == @last_frame
  295.           @last_hits = 0
  296.           #################################################################
  297.         # 闪避的回合
  298.         elsif @battler_damage.is_a?(Numeric) and @battler.damage == 0 and @last_hits == 1 and @frame_index == @last_frame
  299.           @last_hits = 0
  300.           #################################################################
  301.         # 死亡判定
  302.         elsif @frame_index == @last_frame and @battler.dead? and @battler.battler_dead_ani != 1
  303.           #p $fanime_frame_max
  304.         #elsif @last_hits == 1 and @frame_index == @last_frame and @battler.dead? and @battler.battler_dead_ani != 1
  305.           @last_hits = 0
  306.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[4], 1)
  307.           @battler.setup_battler_dead_ani(1)
  308.           collapse
  309.         end
  310.       end
  311.       @battler.setup_battler_ani(@battler.battler_name.split(/★/)[$battler_damage], 1) if @frame_index < @last_frame and @frame_index > 0 and @battler.battler_dead_ani != 1 and $battler_damage != 3 and @battler.damage.is_a?(Numeric)
  312.     end
  313.   end
  314. end
复制代码

之前让你插入的脚本替换这个..

点评

位移写好了  发表于 2017-8-15 20:51
因为上述三种角度是标准图块类ACT地图常用的角度,操作是拉方向键前后,是与产生相应角度的位移,Y数值增加或者减小。  发表于 2017-8-15 17:30
重力系统显示异常bug修正以后,我又能在后面剧情里加ACT用的地图了。这次可以考虑做遇敌与各种2Dact机关,因此需要解决操作恶心的问题  发表于 2017-8-15 17:29
说起来 XP有办法实现2Dact系统或者rpg系统下的斜角移动吗22.5度30度45度三种每次上楼梯都得蹦,下楼梯都得下落而不是走 很不爽啊- -b  发表于 2017-8-15 17:27
程序方面就全靠你了,我只能拿素材来测试,报告bug  发表于 2017-8-15 16:38
回复

使用道具 举报

梦石
0
星屑
35258
在线时间
4171 小时
注册时间
2007-12-15
回帖
9490
 楼主| 发表于 2017-8-15 22:03:37 | 显示全部楼层
本帖最后由 89444640 于 2017-8-15 22:05 编辑

能不能用先放一边,RXDataEditor保存修改未响应半天,如果中间一直未响应,强制关闭 就无法在打开数据库了,感觉非常不安全。也许是我数据库太大了?
上面的说明我不太理解
比如我对敌人攻击造成位移,描述是 X+32 Y+16
等待是什么意思?受创持续时间?还是第几帧的时候出现受创位移?
然后受创动作 用星号隔开的编号,比如正常情况敌人如果有受创的话应该是第三个星号 我就写3?

最后RXDataEdito 姑且称之为战斗位移编辑器吧
这里面写的应该是
X+32
Y+16
14
3

然后 我要是多段技能呢?比如4连斩的招式,中间会出现好几次位移不但角色有位移 敌人也应该有,
怎么处理?

先不说这个,我就写了个位移数值
X+32
y+16
然后进游戏测试 普通攻击就出这个
01.png
不知道哪里冲突了

点评

另外命令是没次序的..只要没有等待命令都是同一帧执行..  发表于 2017-8-16 10:14
等待:10 受伤动作:7 这样写才对..  发表于 2017-8-16 10:13
另外用星号隔开的编号..你可以在战斗图名字后面加星来新加动作的. .我测试过.没影响..  发表于 2017-8-16 10:11
保存后关掉RXDataEditor才正常保存?  发表于 2017-8-16 10:09
读取RXDataEditor修改前的DAT..所以最好关掉再打开RMXP..另外你应该有把RXDataEditor相关的脚本加在脚本编辑器最上吧?  发表于 2017-8-16 10:07
回复

使用道具 举报

梦石
0
星屑
39336
在线时间
11161 小时
注册时间
2009-3-15
回帖
4768
发表于 2017-8-16 10:03:36 | 显示全部楼层
89444640 发表于 2017-8-15 22:03
能不能用先放一边,RXDataEditor保存修改未响应半天,如果中间一直未响应,强制关闭 就无法在打开数据库了 ...

你写错命令了..
是这样写的..
X移动:+:32

等待是等一定帧数后才继续执行下个命令..

点评

RXDataEditor保存修改我一会就好了..然后好像要关掉这个工具才正常..另外RMXP编辑器最好是未打开时编辑备注...因为即使重新读取工程文件也是读取  发表于 2017-8-16 10:05
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部