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

Project1

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

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

[复制链接]

Lv5.捕梦者

梦石
0
星屑
35138
在线时间
4164 小时
注册时间
2007-12-15
帖子
10061
跳转到指定楼层
1
发表于 2017-8-12 19:02:23 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

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

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

RUBY 代码复制
  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.  
  8.   def setup_battler_ani(battler_ani, once = 0,exflag = 0)
  9.     case exflag
  10.     when 1
  11.       arr = battler_ani.split(/!/)
  12.       if arr.size > 1
  13.         @win_rnd_flag = rand(arr.size)
  14.         battler_ani = arr[@win_rnd_flag]
  15.       end
  16.     when 2
  17.       arr = battler_ani.split(/!/)
  18.       if arr.size > 1
  19.         @win_rnd_flag ||= 0
  20.         battler_ani = arr[@win_rnd_flag]
  21.       end
  22.     end
  23.     @battler_ani = battler_ani
  24.     [url=home.php?mod=space&uid=2659152]@oNCE[/url] = once
  25.   end
  26.  
  27.   alias _ini_fux initialize unless $@
  28.   def initialize
  29.     @states_source = {}
  30.     _ini_fux
  31.   end
  32.  
  33.   alias _ad_state_fux add_state unless $@
  34.   def add_state(state_id, force = false)
  35.     _ad_state_fux(state_id, force)
  36.     if $game_temp.in_battle && $scene.active_battler
  37.       user = $scene.active_battler
  38.       if self.is_a?(Game_Enemy) && user.is_a?(Game_Actor)
  39.         @states_source[state_id] = user if user
  40.       end
  41.     end
  42.   end
  43.  
  44.   alias _rm_state_fux remove_state unless $@
  45.   def remove_state(state_id, force = false)
  46.     _rm_state_fux(state_id, force)
  47.     if state?(state_id) == false
  48.       @states_source.delete(state_id)
  49.     end
  50.   end
  51.  
  52.   alias _sde_fux slip_damage_effect unless $@
  53.   def slip_damage_effect
  54.     spk = nil
  55.     if @states_source.size > 0
  56.       spk = @states_source.values[0]
  57.     end
  58.     ret = _sde_fux
  59.     if self.dead?
  60.       if $game_temp.in_battle
  61.         $scene.spec_killer = spk
  62.       end
  63.     end
  64.     return ret
  65.   end
  66.  
  67.   alias _hpp_fux hp= unless $@
  68.   def hp=(hp)
  69.     _hpp_fux(hp)
  70.     if self.dead?
  71.       if $game_temp.in_battle
  72.         $scene.spec_killer = nil
  73.       end
  74.     end
  75.     self.hp
  76.   end
  77. end
  78.  
  79. class Sprite_Battler < RPG::Sprite
  80.  
  81.   def update
  82.     super
  83.     if [url=home.php?mod=space&uid=133701]@battler[/url] == nil
  84.       self.bitmap = nil
  85.       loop_animation(nil)
  86.       loop_animation1(nil)
  87.       return
  88.     end
  89.     if @battler.battler_name != @battler_name or
  90.       @battler.battler_hue != @battler_hue
  91.       @battler_name = @battler.battler_name
  92.       @battler_hue = @battler.battler_hue
  93.       self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
  94.       if not @battler.hidden and not @battler.dead?
  95.         @battler.setup_battler_ani(@battler.battler_name.split(/★/)[1])
  96.       end
  97.       @width = bitmap.width
  98.       [url=home.php?mod=space&uid=291977]@height[/url] = bitmap.height
  99.       self.ox = @width / 2
  100.       self.oy = @height
  101.     end
  102.     update_actor_animation
  103.     update_enemy_animation
  104.     if @battler.is_a?(Game_Enemy)
  105.       if @once == 1 and @loop_animation_once == 1 and
  106.         @battler.battler_dead_ani == 1
  107.         @battler.setup_battler_ani(@battler.battler_name.split(/★/)[5])
  108.       elsif @once == 1 and @loop_animation_once == 1 and $scene.phase != 5
  109.         @battler.setup_battler_ani(@battler.battler_name.split(/★/)[1])
  110.       end
  111.     end
  112.     if @battler.is_a?(Game_Actor)
  113.       if @once == 1 and @loop_animation_once == 1 and $scene.phase != 5 and
  114.         @battler.battler_dead_ani == 1 and @battler.dead?
  115.         @battler.setup_battler_ani(@battler.battler_name.split(/★/)[5])
  116.       elsif @once == 1 and @loop_animation_once == 1 and $scene.phase != 5
  117.         @battler.setup_battler_ani(@battler.battler_name.split(/★/)[1])
  118.         $fangyu = 0
  119.         @battler.setup_battler_dead_ani(0)
  120.       elsif @once == 1 and @loop_animation_once == 1 and $scene.phase == 5 and
  121.         not @battler.dead?
  122.         @battler.setup_battler_ani(@battler.battler_name.split(/★/)[7],0,2)
  123.         $fangyu = 0
  124.         @battler.setup_battler_dead_ani(0)
  125.       end
  126.     end
  127.     if @battler.damage == nil and
  128.       @battler.state_animation_id != @state_animation_id
  129.       @state_animation_id = @battler.state_animation_id
  130.       loop_animation1($data_animations[@state_animation_id])
  131.     end
  132.     if @battler.battler_ani != @battler_ani
  133.       @battler_ani = @battler.battler_ani
  134.       @once = @battler.battler_ani_once
  135.       loop_animation($data_animations[@battler_ani.to_i])
  136.     end
  137.     if @battler.blink
  138.       blink_on
  139.     else
  140.       blink_off
  141.     end
  142.     unless @battler_visible
  143.       if not @battler.hidden and not @battler.dead? and
  144.         (@battler.damage == nil or @battler.damage_pop)
  145.         if @battler.is_a?(Game_Enemy)
  146.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[1])
  147.         else
  148.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[1])
  149.         end
  150.         @battler_visible = true
  151.       end
  152.     end
  153.     if @battler_visible
  154.       if @battler.hidden
  155.         $game_system.se_play($data_system.escape_se)
  156.         escape
  157.         @battler_visible = false
  158.       end
  159.       if @battler.white_flash
  160.         whiten
  161.         @battler.white_flash = false
  162.       end
  163.       if @battler.animation_id != 0
  164.         animation = $data_animations[@battler.animation_id]
  165.         animation(animation, @battler.animation_hit,@battler.damage, @battler.critical)
  166.         @battler.animation_id = 0
  167.       end
  168.       if @battler.damage_pop
  169.         @battler.damage = nil
  170.         @battler.critical = false
  171.         @battler.damage_pop = false
  172.       end
  173.       if @battler.damage == nil and @battler.dead?
  174.         if @battler.is_a?(Game_Enemy)
  175.           if @battler.battler_dead_ani != 1
  176.             $game_system.se_play($data_system.enemy_collapse_se)
  177.             @battler.setup_battler_ani(@battler.battler_name.split(/★/)[4], 1)
  178.             @battler.setup_battler_dead_ani(1)
  179.           end
  180.           collapse
  181.         else
  182.           if @battler.battler_dead_ani != 1
  183.             $game_system.se_play($data_system.enemy_collapse_se)
  184.             @battler.setup_battler_ani(@battler.battler_name.split(/★/)[4], 1)
  185.             @battler.setup_battler_dead_ani(1)
  186.           end
  187.         end
  188.         @battler_visible = false
  189.       end
  190.     end
  191.     if @flash_shake_switch == true
  192.       self.x = @battler.screen_x
  193.       self.y = @battler.screen_y
  194.       self.z = @battler.screen_z
  195.       @flash_shake_switch = false
  196.     end
  197.     if @flash_shake != 0 and @battler.damage != nil and RPG::BATTLER_JUMP
  198.       if @battler.is_a?(Game_Enemy)
  199.         case @flash_shake
  200.         when 9..10
  201.           self.x -=4
  202.           self.y -=4
  203.           self.z = @battler.screen_z
  204.         when 6..8
  205.           self.x -=2
  206.           self.y -=2
  207.           self.z = @battler.screen_z
  208.         when 3..5
  209.           self.x +=2
  210.           self.y +=2
  211.           self.z = @battler.screen_z
  212.         when 1..2
  213.           self.x +=4
  214.           self.y +=4
  215.           self.z = @battler.screen_z
  216.         end
  217.       end
  218.       if @battler.is_a?(Game_Actor)
  219.         case @flash_shake
  220.         when 9..10
  221.           self.x +=4
  222.           self.y +=4
  223.           self.z = @battler.screen_z
  224.         when 6..8
  225.           self.x +=2
  226.           self.y +=2
  227.           self.z = @battler.screen_z
  228.         when 3..5
  229.           self.x -=2
  230.           self.y -=2
  231.           self.z = @battler.screen_z
  232.         when 1..2
  233.           self.x -=4
  234.           self.y -=4
  235.           self.z = @battler.screen_z
  236.         end
  237.       end
  238.       @flash_shake -= 1
  239.     end
  240.   end
  241.  
  242.   def win
  243.     if @battler_name != nil and not @battler.hidden and not @battler.dead?
  244.       @battler.setup_battler_ani(@battler_name.split(/★/)[6], 1, 1)
  245.     end
  246.   end
  247.  
  248.   def update_actor_animation
  249.     if @battler.is_a?(Game_Actor)
  250.       if @battler.show_damage_value != nil
  251.         self.damage(@battler.show_damage_value, false)
  252.         @battler.show_damage(nil)
  253.         @battler.setup_battler_ani(@battler.battler_name.split(/★/)[3], 1)
  254.         @battler.setup_battler_hurt_ani(1)
  255.       end
  256.       if @battler.current_action.kind == 0 and @battler.current_action.basic == 1 and @battler.show_damage_value != nil
  257.         if @hits > @temp_hits and not @battler.dead?
  258.           @temp_hits+=1
  259.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[2], 1)
  260.           @battler.setup_battler_hurt_ani(1)
  261.         elsif @last_hits == 1 and not @battler.dead?
  262.           @last_hits = 0
  263.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[2], 1)
  264.           @battler.setup_battler_hurt_ani(1)
  265.         elsif @frame_index != -1 and @frame_index != @last_frame and not @battler.dead? and !@battler.damage.is_a?(Numeric)
  266.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[2], 1)
  267.           @battler.setup_battler_hurt_ani(1)
  268.         elsif @last_hits == 1 and not @battler.dead? and !@battler.damage.is_a?(Numeric)
  269.           @last_hits = 0
  270.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[2], 1)
  271.           @battler.setup_battler_hurt_ani(1)
  272.         end
  273.       else
  274.         if @last_hits == 1 and not @battler.dead? and @battler.damage.is_a?(Numeric) and @battler.damage > 0 and $fangyu != 1
  275.           @last_hits = 0
  276.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[3], 1)
  277.           @battler.setup_battler_hurt_ani(1)
  278.         elsif @hits > @temp_hits and @frame_index != @last_frame and not @battler.dead? and @battler.damage.is_a?(Numeric) and @battler.damage > 0 and  
  279.           $fangyu != 1
  280.           @temp_hits+=1
  281.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[3], 1)
  282.           @battler.setup_battler_hurt_ani(1)
  283.         elsif @hits > @temp_hits and @frame_index != @last_frame and @battler.damage.is_a?(Numeric) and @battler.damage > 0 and $fangyu != 1 and  
  284.           @battler.dead? and @battler.battler_dead_ani != 1
  285.           @temp_hits+=1
  286.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[3], 1)
  287.           @battler.setup_battler_hurt_ani(1)
  288.         elsif !@battler_damage.is_a?(Numeric) and @last_hits == 1 and @frame_index == @last_frame
  289.           @last_hits = 0
  290.         elsif @battler_damage.is_a?(Numeric) and @battler.damage == 0 and @last_hits == 1 and @frame_index == @last_frame
  291.           @last_hits = 0
  292.         elsif @last_hits == 1 and @frame_index == @last_frame and @battler.dead? and @battler.battler_dead_ani != 1
  293.           @last_hits = 0
  294.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[4], 1)
  295.           @battler.setup_battler_dead_ani(1)
  296.         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
  297.           @once = 1
  298.           @battler.setup_battler_ani(@battler_name.split(/★/)[6], 1,1)
  299.         end
  300.       end
  301.     end
  302.   end
  303. end
  304.  
  305. class Scene_Battle
  306.   attr_reader   :active_battler
  307.   attr_accessor :spec_killer
  308.   def initialize
  309.     @spec_killer = nil
  310.   end
  311.  
  312.   def get_real_killer
  313.     if @spec_killer
  314.       return @spec_killer
  315.     end
  316.     return @active_battler
  317.   end
  318.  
  319.   def start_phase5
  320.     @spriteset.win(get_real_killer)
  321.     start_phase5101
  322.   end
  323. end
  324.  
  325. class Spriteset_Battle
  326.   def win(winner)
  327.     if winner
  328.       @actor_sprites.find{|ac| ac.battler==winner}.win
  329.     else
  330.       for sprite in @actor_sprites
  331.         sprite.win
  332.       end
  333.     end
  334.   end
  335. end
  336.  
  337. class Game_Actor < Game_Battler
  338.   def screen_z
  339.     case self.index
  340.     when 0
  341.       return 70
  342.     when 1
  343.       return 90
  344.     when 2
  345.       return 80
  346.     when 3
  347.       return 100
  348.     else
  349.       return 0
  350.     end
  351.   end
  352. end
  353.  
  354. module RPG
  355.   class Sprite < ::Sprite
  356.     def animation_set_sprites(sprites, cell_data, position)
  357.       for i in 0..15
  358.         sprite = sprites[i]
  359.         pattern = cell_data[i, 0]
  360.         if sprite == nil or pattern == nil or pattern == -1
  361.           sprite.visible = false if sprite != nil
  362.           next
  363.         end
  364.         sprite.visible = true
  365.         sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
  366.         if position == 3
  367.           if self.viewport != nil
  368.             sprite.x = self.viewport.rect.width / 2
  369.             sprite.y = self.viewport.rect.height - 160
  370.           else
  371.             sprite.x = 320
  372.             sprite.y = 240
  373.           end
  374.         else
  375.           sprite.x = self.x - self.ox + self.src_rect.width / 2
  376.           sprite.y = self.y - self.oy + self.src_rect.height / 2
  377.           sprite.y -= self.src_rect.height / 4 if position == 0
  378.           sprite.y += self.src_rect.height / 4 if position == 2
  379.         end
  380.         sprite.x += cell_data[i, 1]
  381.         sprite.y += cell_data[i, 2]
  382.         sprite.z = 2000+self.z
  383.         sprite.ox = 96
  384.         sprite.oy = 96
  385.         sprite.zoom_x = cell_data[i, 3] / 100.0
  386.         sprite.zoom_y = cell_data[i, 3] / 100.0
  387.         sprite.angle = cell_data[i, 4]
  388.         sprite.mirror = (cell_data[i, 5] == 1)
  389.         sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
  390.         sprite.blend_type = cell_data[i, 7]
  391.       end
  392.     end
  393.   end
  394. end

Lv5.捕梦者

梦石
0
星屑
36124
在线时间
10712 小时
注册时间
2009-3-15
帖子
4806
来自 6楼
发表于 2017-8-14 12:09:40 | 只看该作者
本帖最后由 soulsaga 于 2017-8-14 14:23 编辑

有问题的话还原脚本..

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

反击死的问题可能要改成这样..
然后MAIN上面插入以下脚本
RUBY 代码复制
  1. class Game_Battler
  2.     #--------------------------------------------------------------------------
  3.   # ● 应用通常攻击效果
  4.   #     attacker : 攻击者 (battler)
  5.   #--------------------------------------------------------------------------
  6.  
  7. alias attack_effect20170814 attack_effect
  8.   def attack_effect(attacker)
  9.     $activebattler = attacker if attacker.is_a?(Game_Actor)#如果攻击者是角色就代入到变量里
  10.  
  11.     return attack_effect20170814(attacker)
  12.   end
  13.     #--------------------------------------------------------------------------
  14.   # ● 应用特技效果
  15.   #     user  : 特技的使用者 (battler)
  16.   #     skill : 特技
  17.   #--------------------------------------------------------------------------
  18. alias skill_effect20170814 skill_effect
  19.   def skill_effect(user, skill)
  20.     $activebattler = user if user.is_a?(Game_Actor)#如果攻击者是角色就代入到变量里
  21.     return skill_effect20170814(user, skill)
  22.   end
  23. 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
回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
36124
在线时间
10712 小时
注册时间
2009-3-15
帖子
4806
2
发表于 2017-8-12 23:00:20 | 只看该作者
怎么不@版主过来?
回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
35138
在线时间
4164 小时
注册时间
2007-12-15
帖子
10061
3
 楼主| 发表于 2017-8-12 23:04:52 | 只看该作者
本帖最后由 89444640 于 2017-8-13 09:39 编辑

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

点评

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

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
35138
在线时间
4164 小时
注册时间
2007-12-15
帖子
10061
4
 楼主| 发表于 2017-8-14 09:05:54 | 只看该作者
本帖最后由 89444640 于 2017-8-15 14:38 编辑

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

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
36124
在线时间
10712 小时
注册时间
2009-3-15
帖子
4806
5
发表于 2017-8-14 09:59:48 | 只看该作者
本帖最后由 soulsaga 于 2017-8-14 10:09 编辑
89444640 发表于 2017-8-14 09:05
这样吧,我清理出来一个测试工程过来容易修改。
敌人设置100%逃跑,都调好了,请测试。


RUBY 代码复制
  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

查看全部评分

回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
35138
在线时间
4164 小时
注册时间
2007-12-15
帖子
10061
7
 楼主| 发表于 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
回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
36124
在线时间
10712 小时
注册时间
2009-3-15
帖子
4806
8
发表于 2017-8-14 16:46:29 | 只看该作者
本帖最后由 soulsaga 于 2017-8-15 20:50 编辑


https://rpg.blue/forum.php?mod=v ... &extra=page%3D1
位移写好了..要配合上面地址的工具使用..
RUBY 代码复制
  1. #位移BY:SOULSAGA
  2. #使用方法:打开RMXP备注编辑器RXDataEditor.exe
  3. #在技能备注写
  4. #X移动:+:位移植
  5. #X移动:-:位移植
  6. #向左移是+向右移是-敌人打我方则相反
  7. #Y移动:+:位移植
  8. #Y移动:-:位移植
  9. #等待:帧数值   最大是动画总帧数+14 超过不会有效
  10. #受伤动作:战斗图用星号隔开的编号..
  11.  
  12.  
  13.  
  14. class Game_Battler
  15.   alias item_effectsoulsaga item_effect
  16.   def item_effect(item)
  17.     $skill_id = 1
  18.     $skillmoveflag = "OFF"
  19.     $wait_count = 0
  20.     @wait_skill = false
  21.     $i = 0
  22.     $battler_damage = 3
  23.     return item_effectsoulsaga(item)
  24.   end
  25.  
  26.     #--------------------------------------------------------------------------
  27.   # ● 应用通常攻击效果
  28.   #     attacker : 攻击者 (battler)
  29.   #--------------------------------------------------------------------------
  30.  
  31.  
  32. alias attack_effect20170814 attack_effect
  33.   def attack_effect(attacker)
  34.     $activebattler = attacker if attacker.is_a?(Game_Actor)#如果攻击者是角色就代入到变量里
  35.     $skill_id = 1
  36.     $skillmoveflag = "OFF"
  37.     $wait_count = 0
  38.     @wait_skill = false
  39.     $i = 0
  40.     $battler_damage = 3
  41.     return attack_effect20170814(attacker)
  42.   end
  43.     #--------------------------------------------------------------------------
  44.   # ● 应用特技效果
  45.   #     user  : 特技的使用者 (battler)
  46.   #     skill : 特技
  47.   #--------------------------------------------------------------------------
  48. alias skill_effect20170814 skill_effect
  49.   def skill_effect(user, skill)
  50.     $skill_id = skill.id
  51.     $skillmoveflag = "OFF"
  52.     $wait_count = 0
  53.     @wait_skill = false
  54.     $i = 0
  55.     $battler_damage = 3
  56.     $activebattler = user if user.is_a?(Game_Actor)#如果攻击者是角色就代入到变量里
  57.     return skill_effect20170814(user, skill)
  58.   end
  59. end
  60. module RPG
  61. class Sprite < ::Sprite
  62. #位移BY:SOULSAGA
  63.    #..........................................................................
  64.    def update_animation
  65.      if @_animation_duration > 0
  66.        frame_index = @_animation.frame_max - @_animation_duration
  67.        @frame_index = frame_index
  68.        cell_data = @_animation.frames[frame_index].cell_data
  69.        position = @_animation.position
  70.        animation_set_sprites(@_animation_sprites, cell_data, position)
  71.  
  72.        $wait_count -= 1 if $wait_count >= 1
  73.        if $skillmoveflag == "OFF"
  74.        @skill_xmove = []
  75. skill = $data_skills[$skill_id]
  76. skill_xymove = skill.note.split(/\r\n/)
  77. if $wait_count <= 0 and @battler.damage != "Miss" and @battler.damage != nil
  78.       while $i < skill_xymove.length
  79.         if $wait_count <= 0 and @battler.damage != "Miss" and @battler.damage != nil
  80.         @skill_xmove = skill_xymove[$i].split(/:/)
  81.       if skill_xymove[$i].include?("X移动")
  82.        case @skill_xmove[1]
  83.     when "+"
  84.        self.ox += @skill_xmove[2].to_i if @battler.is_a?(Game_Enemy)
  85.        self.ox -= @skill_xmove[2].to_i if @battler.is_a?(Game_Actor)
  86.        when "-"
  87.        self.ox -= @skill_xmove[2].to_i if @battler.is_a?(Game_Enemy)
  88.        self.ox += @skill_xmove[2].to_i if @battler.is_a?(Game_Actor)
  89.        end
  90.      end
  91.      if skill_xymove[$i].include?("Y移动")
  92.        case @skill_xmove[1]
  93.     when "+"
  94.        self.oy += @skill_xmove[2].to_i if @battler.is_a?(Game_Enemy)
  95.        self.oy += @skill_xmove[2].to_i if @battler.is_a?(Game_Actor)
  96.        when "-"
  97.        self.oy -= @skill_xmove[2].to_i if @battler.is_a?(Game_Enemy)
  98.        self.oy -= @skill_xmove[2].to_i if @battler.is_a?(Game_Actor)
  99.      end
  100.      end
  101.    end
  102.    if skill_xymove[$i].include?("受伤动作")
  103.      $battler_damage = @skill_xmove[1].to_i
  104.      end
  105.    if skill_xymove[$i].include?("等待")
  106.      $wait_count = @skill_xmove[1].to_i
  107.      $skillmoveflag = "OFF"
  108.       end
  109.       $i += 1
  110.       break if $wait_count > 0
  111.       $skillmoveflag = "ON"
  112.       end
  113.   end
  114.   end
  115.   #=======================================
  116.        # 修改:弹出伤害,权重计算
  117.        #=======================================
  118.        for timing in @_animation.timings
  119.          if timing.frame == frame_index
  120.            t = 1.0 * animation_process_timing(timing, @_animation_hit)            
  121.            #p t,"当前权重", @all_quanzhong,"总权重"
  122.            if @battler_damage.is_a?(Numeric) and t != 0
  123.              t *= @battler_damage
  124.              t /= @all_quanzhong
  125.              t = t.to_i
  126.              #在闪光不是最后一次的情况下,把这次伤害加入到已经发生的伤害中★★★★★★★★★★★★★★★★★★★★★★★★★★
  127.              if frame_index != @_last_frame
  128.              @p_dam+= t
  129.              end
  130.              #p @p_dam,"已发生伤害",@battler_damage,"总伤害"(调试用)★★★★★★★★★★★★★★★★★★★★★★★★★★
  131.              #闪光为最后一次的情况下,改变这次伤害的计算方法(总伤害-已经发生伤害)★★★★★★★★★★★★★★★★★★★★★★★★★★
  132.              if frame_index == @_last_frame
  133.                t= @battler_damage-@p_dam
  134.              end
  135.              #p t,"当前伤害",@battler_damage,"总伤害"
  136.              # 最后一次闪光的话,伤害修正
  137.              if frame_index == @_last_frame
  138.                @_total_damage = @battler_damage - t
  139.                @p_dam=0      #已经发生的伤害归0★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  140.             end
  141.              #p t,@battler_damage,@all_quanzhong
  142.              damage(t,@battler_critical) if timing.flash_scope != 3
  143.             #连击次数归0★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  144.             if frame_index == @_last_frame
  145.                       ############ #小改动
  146.                       @last_hits=1
  147.                       @temp_hits=0
  148.                       ############
  149.                       @hits=0
  150.             end
  151.            # 防止重复播放miss
  152.            elsif !@battler_damage.is_a?(Numeric) and timing.flash_scope != 0
  153.              damage(@battler_damage,@battler_critical)
  154.            end
  155.          end
  156.        end
  157.      else
  158.        dispose_animation
  159.        end
  160. end
  161. end
  162. end
  163.  
  164.  
  165. class Sprite_Battler < RPG::Sprite
  166.   #--------------------------------------------------------------------------
  167.   # ● 处理角色动作
  168.   #--------------------------------------------------------------------------
  169.   def update_actor_animation
  170.     if @battler.is_a?(Game_Actor)
  171.       if @battler.show_damage_value != nil
  172.         self.damage(@battler.show_damage_value, false)
  173.         @battler.show_damage(nil)
  174.         @battler.setup_battler_ani(@battler.battler_name.split(/★/)[$battler_damage], 1)
  175.         @battler.setup_battler_hurt_ani(1)
  176.       end
  177.       @last_frame = $fanime_frame_max if $fanime_frame_max > @last_frame
  178.       if @battler.current_action.kind == 0 and @battler.current_action.basic == 1 and @battler.show_damage_value != nil
  179.         # 防御的时候
  180.         if @hits > @temp_hits and not @battler.dead?
  181.           ############ #小改动
  182.           @temp_hits+=1
  183.           ############
  184.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[2], 1)
  185.           @battler.setup_battler_hurt_ani(1)
  186.           #################################################################
  187.         elsif @last_hits == 1 and not @battler.dead?
  188.           ############ #小改动
  189.           @last_hits = 0
  190.           ############
  191.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[2], 1)
  192.           @battler.setup_battler_hurt_ani(1)
  193.           #################################################################
  194.         elsif @frame_index != -1 and @frame_index != @last_frame and not @battler.dead? and !@battler.damage.is_a?(Numeric)
  195.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[2], 1)
  196.           @battler.setup_battler_hurt_ani(1)
  197.           #################################################################
  198.         elsif @last_hits == 1 and not @battler.dead? and !@battler.damage.is_a?(Numeric)
  199.           ############ #小改动
  200.           @last_hits = 0
  201.           ############
  202.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[2], 1)
  203.           @battler.setup_battler_hurt_ani(1)
  204.           #################################################################
  205.         end
  206.       else
  207.         # 单回合只有一次攻击
  208.        if @last_hits == 1 and not @battler.dead? and @battler.damage.is_a?(Numeric) and @battler.damage > 0 and $fangyu != 1
  209.           ############ #小改动
  210.           @last_hits = 0
  211.           ############
  212.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[$battler_damage], 1)
  213.           @battler.setup_battler_hurt_ani(1)
  214.           #################################################################
  215.         # 单回合多次攻击
  216.        elsif @hits > @temp_hits and @frame_index != @last_frame and not @battler.dead? and @battler.damage.is_a?(Numeric) and @battler.damage > 0 and  
  217. $fangyu != 1
  218.           ############ #小改动
  219.           @temp_hits+=1
  220.           ############
  221.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[$battler_damage], 1)
  222.           @battler.setup_battler_hurt_ani(1)
  223.         ########################################################################
  224.         # 死亡之前攻击
  225.        elsif @hits > @temp_hits and @frame_index != @last_frame and @battler.damage.is_a?(Numeric) and @battler.damage > 0 and $fangyu != 1 and  
  226. @battler.dead? and @battler.battler_dead_ani != 1
  227.           ############ #小改动
  228.           @temp_hits+=1
  229.           ############
  230.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[$battler_damage], 1)
  231.           @battler.setup_battler_hurt_ani(1)
  232.           #################################################################
  233.         # 闪避的回合
  234.        elsif !@battler_damage.is_a?(Numeric) and @last_hits == 1 and @frame_index == @last_frame
  235.           @last_hits = 0
  236.           #################################################################
  237.         # 无伤害的攻击
  238.         elsif @battler_damage.is_a?(Numeric) and @battler.damage == 0 and @last_hits == 1 and @frame_index == @last_frame
  239.           @last_hits = 0
  240.           #################################################################
  241.         # 死亡判定
  242.         elsif @frame_index == @last_frame and @battler.dead? and @battler.battler_dead_ani != 1
  243.           #p 111
  244.        #elsif @last_hits == 1 and @frame_index == @last_frame and @battler.dead? and @battler.battler_dead_ani != 1
  245.           @last_hits = 0
  246.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[4], 1)
  247.           #@battler.setup_battler_dead_ani(1)
  248.           #################################################################
  249.         # 胜利判定
  250.        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
  251.              @once = 1
  252.              @battler.setup_battler_ani(@battler_name.split(/★/)[6], 1)
  253.         end
  254.       end
  255.       @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)
  256.     end
  257.   end
  258.   #--------------------------------------------------------------------------
  259.   # ● 处理敌人动作
  260.   #--------------------------------------------------------------------------
  261.   def update_enemy_animation
  262.     if @battler.is_a?(Game_Enemy)
  263.       if @battler.show_damage_value != nil
  264.         self.damage(@battler.show_damage_value, false)
  265.         @battler.show_damage(nil)
  266.         @battler.setup_battler_ani(@battler.battler_name.split(/★/)[$battler_damage], 1)
  267.         @battler.setup_battler_hurt_ani(1)
  268.       end
  269.       @last_frame = $fanime_frame_max if $fanime_frame_max > @last_frame
  270.       if @battler.current_action.kind == 0 and @battler.current_action.basic == 1
  271.       else
  272.         # 单回合只有一次攻击
  273.         if @last_hits == 1 and not @battler.dead? and @battler.damage.is_a?(Numeric) and @battler.damage > 0
  274.           ############ #小改动
  275.           #p 222
  276.           @last_hits = 0
  277.           ############
  278.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[$battler_damage], 1)
  279.           @battler.setup_battler_hurt_ani(1)
  280.           #################################################################
  281.         # 单回合多次攻击
  282.        elsif @hits > @temp_hits and @frame_index != @last_frame and not @battler.dead? and @battler.damage.is_a?(Numeric) and @battler.damage > 0
  283.           ############ #小改动
  284.           #p 111
  285.           @temp_hits+=1
  286.           ############
  287.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[$battler_damage], 1)
  288.           @battler.setup_battler_hurt_ani(1)
  289.           #################################################################
  290.         # 死亡之前攻击
  291.        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
  292.           ############ #小改动
  293.           #p 333
  294.           @temp_hits+=1
  295.           ############
  296.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[$battler_damage], 1)
  297.           @battler.setup_battler_hurt_ani(1)
  298.           #################################################################
  299.         # 无伤害的攻击
  300.         elsif !@battler_damage.is_a?(Numeric) and @last_hits == 1 and @frame_index == @last_frame
  301.           @last_hits = 0
  302.           #################################################################
  303.         # 闪避的回合
  304.         elsif @battler_damage.is_a?(Numeric) and @battler.damage == 0 and @last_hits == 1 and @frame_index == @last_frame
  305.           @last_hits = 0
  306.           #################################################################
  307.         # 死亡判定
  308.         elsif @frame_index == @last_frame and @battler.dead? and @battler.battler_dead_ani != 1
  309.           #p $fanime_frame_max
  310.         #elsif @last_hits == 1 and @frame_index == @last_frame and @battler.dead? and @battler.battler_dead_ani != 1
  311.           @last_hits = 0
  312.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[4], 1)
  313.           @battler.setup_battler_dead_ani(1)
  314.           collapse
  315.         end
  316.       end
  317.       @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)
  318.     end
  319.   end
  320. 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
回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
35138
在线时间
4164 小时
注册时间
2007-12-15
帖子
10061
9
 楼主| 发表于 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
然后进游戏测试 普通攻击就出这个

不知道哪里冲突了

点评

另外命令是没次序的..只要没有等待命令都是同一帧执行..  发表于 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
回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
36124
在线时间
10712 小时
注册时间
2009-3-15
帖子
4806
10
发表于 2017-8-16 10:03:36 | 只看该作者
89444640 发表于 2017-8-15 22:03
能不能用先放一边,RXDataEditor保存修改未响应半天,如果中间一直未响应,强制关闭 就无法在打开数据库了 ...

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

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

点评

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

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-21 20:31

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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