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

Project1

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

[已经解决] 胜利之后显示动画更改战斗图

[复制链接]

Lv2.观梦者

梦石
0
星屑
555
在线时间
111 小时
注册时间
2013-11-22
帖子
301
跳转到指定楼层
1
发表于 2018-7-19 18:53:41 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 凝望·流年 于 2018-7-20 15:05 编辑

为了在战斗之后显示动画我在Scene_Battle 2中的start_phase5中加了一个
  1.     @active_battler.animation_id = 6
复制代码
为了角色在最后一帧定格,想改变角色的战斗图
请问这种思路是否正确,以及实现方法

已经解决,感谢楼下的回复
想出来一招
$game_actors[1].set_graphic("行走图",0,"战斗图",0)

Lv5.捕梦者

梦石
0
星屑
34870
在线时间
4148 小时
注册时间
2007-12-15
帖子
9981
2
发表于 2018-7-20 09:33:25 | 只看该作者
可以实现,而且可以实现最后一个攻击的人播放胜利动画。不过我这个是依赖于全动画脚本的,可能没有全动画的默认战斗系统修改不一样。

具体请参考这个脚本,干洗呢FUX2大大和相关人员。
  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.     @once = 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 @battler == 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.       @height = 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]) if [6].include?($scene.phase4_step) and @battler.current_action.basic == 1 or @battler.current_action.basic != 1#SOULSAGA小改动修正防御动作
  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.dead? and $frame_index == $fanime2_frame_max-1 and $scene.phase4_step >= 4
  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.           #p $fanime2_frame_max# if $frame_index == $fanime2_frame_max
  178.           collapse# if @battler.animation_id == 0# and !$game_system.battle_interpreter.running?# if $frame_index == $fanime2_frame_max
  179.         else
  180.           if @battler.battler_dead_ani != 1
  181.             $game_system.se_play($data_system.enemy_collapse_se)
  182.             @battler.setup_battler_ani(@battler.battler_name.split(/★/)[4], 1)
  183.             @battler.setup_battler_dead_ani(1)
  184.           end
  185.         end
  186.         @battler_visible = false
  187.       end
  188.     end
  189.     if @flash_shake_switch == true
  190.       self.x = @battler.screen_x
  191.       self.y = @battler.screen_y
  192.       self.z = @battler.screen_z
  193.       @flash_shake_switch = false
  194.     end
  195.     if @flash_shake != 0 and @battler.damage != nil and RPG::BATTLER_JUMP
  196.       if @battler.is_a?(Game_Enemy)
  197.         case @flash_shake
  198.         when 9..10
  199.           self.x -=4
  200.           self.y -=4
  201.           self.z = @battler.screen_z
  202.         when 6..8
  203.           self.x -=2
  204.           self.y -=2
  205.           self.z = @battler.screen_z
  206.         when 3..5
  207.           self.x +=2
  208.           self.y +=2
  209.           self.z = @battler.screen_z
  210.         when 1..2
  211.           self.x +=4
  212.           self.y +=4
  213.           self.z = @battler.screen_z
  214.         end
  215.       end
  216.       if @battler.is_a?(Game_Actor)
  217.         case @flash_shake
  218.         when 9..10
  219.           self.x +=4
  220.           self.y +=4
  221.           self.z = @battler.screen_z
  222.         when 6..8
  223.           self.x +=2
  224.           self.y +=2
  225.           self.z = @battler.screen_z
  226.         when 3..5
  227.           self.x -=2
  228.           self.y -=2
  229.           self.z = @battler.screen_z
  230.         when 1..2
  231.           self.x -=4
  232.           self.y -=4
  233.           self.z = @battler.screen_z
  234.         end
  235.       end
  236.       @flash_shake -= 1
  237.     end
  238.   end
  239.   
  240.   def win
  241.     if @battler_name != nil and not @battler.hidden and not @battler.dead?
  242.       @battler.setup_battler_ani(@battler_name.split(/★/)[6], 1, 1)
  243.     end
  244.   end
  245.   
  246.   def update_actor_animation
  247.     if @battler.is_a?(Game_Actor)
  248.       if @battler.show_damage_value != nil
  249.         self.damage(@battler.show_damage_value, false)
  250.         @battler.show_damage(nil)
  251.         @battler.setup_battler_ani(@battler.battler_name.split(/★/)[3], 1)
  252.         @battler.setup_battler_hurt_ani(1)
  253.       end
  254.       # 防御的时候
  255.       #p @battler.show_damage_value if @battler.damage.is_a?(Numeric)
  256.       @last_frame = $fanime_frame_max if $fanime_frame_max > @last_frame
  257.       if @battler.current_action.kind == 0 and @battler.current_action.basic == 1# and @battler.show_damage_value == nil
  258.         @battler.setup_battler_ani(@battler.battler_name.split(/★/)[2], 1)
  259.         @battler.setup_battler_hurt_ani(1)
  260. =begin
  261.         if @hits > @temp_hits and not @battler.dead?
  262.           @temp_hits+=1
  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?
  266.           @last_hits = 0
  267.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[2], 1)
  268.           @battler.setup_battler_hurt_ani(1)
  269.         elsif @frame_index != -1 and @frame_index != @last_frame and not @battler.dead? and [email protected]_a?(Numeric)
  270.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[2], 1)
  271.           @battler.setup_battler_hurt_ani(1)
  272.         elsif @last_hits == 1 and not @battler.dead? and [email protected]_a?(Numeric)
  273.           @last_hits = 0
  274.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[2], 1)
  275.           @battler.setup_battler_hurt_ani(1)
  276.         end
  277. =end
  278.       else
  279.         if @last_hits == 1 and not @battler.dead? and @battler.damage.is_a?(Numeric) and @battler.damage > 0 and $fangyu != 1 and $scene.phase4_step == 5
  280.           @last_hits = 0
  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 not @battler.dead? and @battler.damage.is_a?(Numeric) and @battler.damage > 0 and  
  284.           $fangyu != 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 @hits > @temp_hits and @frame_index != @last_frame and @battler.damage.is_a?(Numeric) and @battler.damage > 0 and $fangyu != 1 and  
  289.           @battler.dead? and @battler.battler_dead_ani != 1
  290.           @temp_hits+=1
  291.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[3], 1)
  292.           @battler.setup_battler_hurt_ani(1)
  293.         elsif !@battler_damage.is_a?(Numeric) and @last_hits == 1 and @frame_index == @last_frame
  294.           @last_hits = 0
  295.         elsif @battler_damage.is_a?(Numeric) and @battler.damage == 0 and @last_hits == 1 and @frame_index == @last_frame
  296.           @last_hits = 0
  297.         elsif @last_hits == 1 and @frame_index == @last_frame and @battler.dead? and @battler.battler_dead_ani != 1
  298.           @last_hits = 0
  299.           @battler.setup_battler_ani(@battler.battler_name.split(/★/)[4], 1)
  300.           @battler.setup_battler_dead_ani(1)
  301.         elsif $scene.is_a?(Scene_Battle) and $scene.phase == 5 and @once == 0 and @battler_name != nil and not @battler.hidden and not @battler.dead? and $game_temp.battle_proc == nil
  302.           @once = 1
  303.           @battler.setup_battler_ani(@battler_name.split(/★/)[6], 1,1)
  304.         end
  305.       end
  306.     end
  307.   end
  308. end

  309. class Scene_Battle
  310.   attr_reader   :active_battler
  311.   attr_accessor :spec_killer
  312.   def initialize
  313.     @spec_killer = nil
  314.   end
  315.   
  316. def get_real_killer
  317.     if @spec_killer
  318.       return @spec_killer
  319.     end
  320.     return $activebattler
  321.   end
  322.   
  323.   def start_phase5
  324.     @spriteset.win(get_real_killer)
  325.     start_phase5101
  326.   end
  327. end

  328. class Spriteset_Battle
  329.   def win(winner)
  330.     if winner
  331.       @actor_sprites.find{|ac| ac.battler==winner}.win
  332.     else
  333.       for sprite in @actor_sprites
  334.         sprite.win
  335.       end
  336.     end
  337.   end
  338. end

  339. class Game_Actor < Game_Battler
  340.   def screen_z
  341.     case self.index
  342.     when 0
  343.       return 0
  344.     when 1
  345.       return 100
  346.     when 2
  347.       return 0
  348.     when 3
  349.       return 100
  350.     else
  351.       return 0
  352.     end
  353.   end
  354. end

  355. module RPG
  356.   class Sprite < ::Sprite
  357.     def animation_set_sprites(sprites, cell_data, position)
  358.       for i in 0..15
  359.         sprite = sprites[i]
  360.         pattern = cell_data[i, 0]
  361.         if sprite == nil or pattern == nil or pattern == -1
  362.           sprite.visible = false if sprite != nil
  363.           next
  364.         end
  365.         sprite.visible = true
  366.         sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
  367.         if position == 3
  368.           if self.viewport != nil
  369.             sprite.x = self.viewport.rect.width / 2
  370.             sprite.y = self.viewport.rect.height - 160
  371.           else
  372.             sprite.x = 320
  373.             sprite.y = 240
  374.           end
  375.         else
  376.           sprite.x = self.x - self.ox + self.src_rect.width / 2
  377.           sprite.y = self.y - self.oy + self.src_rect.height / 2
  378.           sprite.y -= self.src_rect.height / 4 if position == 0
  379.           sprite.y += self.src_rect.height / 4 if position == 2
  380.         end
  381.         sprite.x += cell_data[i, 1]
  382.         sprite.y += cell_data[i, 2]
  383.         sprite.z = 2000+self.z
  384.         sprite.ox = 96
  385.         sprite.oy = 96
  386.         sprite.zoom_x = cell_data[i, 3] / 100.0
  387.         sprite.zoom_y = cell_data[i, 3] / 100.0
  388.         sprite.angle = cell_data[i, 4]
  389.         sprite.mirror = (cell_data[i, 5] == 1)
  390.         sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
  391.         sprite.blend_type = cell_data[i, 7]
  392.       end
  393.     end
  394.   end
  395. end
复制代码

点评

“干洗呢FUX2大大和相关人员”_(:зゝ∠)_  发表于 2018-7-20 10:57
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-27 00:13

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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