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

Project1

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

事件上显示多个动画与地图上显示伤害和彩虹sj同时用

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
55
在线时间
9 小时
注册时间
2006-4-26
帖子
444
跳转到指定楼层
1
发表于 2007-7-29 14:40:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
可是彩虹神剑和一个事件上显示多个动画不能同时使用
彩虹放在一个事件上显示多个动画上面的话342行出错

彩虹放下面的话.一个事件上显示多个动画又没用了.



我要的是将3个脚本可以同时用.
有效果就可以了




[一个事件上显示多个动画]


  1. #--------------------------------------------------
  2. # 此脚本来自www.66RPG.com,使用请保留此信息
  3. #--------------------------------------------------
  4. module RPG
  5.   class Sprite < ::Sprite
  6.     def initialize(viewport = nil)
  7.       super(viewport)
  8.       @_whiten_duration = 0
  9.       @_appear_duration = 0
  10.       @_escape_duration = 0
  11.       @_collapse_duration = 0
  12.       @_damage_duration = 0
  13.       @_animation_duration = 0
  14.       @_blink = false
  15.       @_animation = []
  16.     end
  17.     def animation(animation, hit)
  18.       return if animation == nil
  19.       num = @_animation.size
  20.       @_animation.push([animation, hit, animation.frame_max, []])
  21.       bitmap = RPG::Cache.animation(animation.animation_name,
  22.                                     animation.animation_hue)
  23.       if @@_reference_count.include?(bitmap)
  24.         @@_reference_count[bitmap] += 1
  25.       else
  26.         @@_reference_count[bitmap] = 1
  27.       end
  28.       if @_animation[num][0] != 3 or not @@_animations.include?(animation)
  29.         for i in 0..15
  30.           sprite = ::Sprite.new
  31.           sprite.bitmap = bitmap
  32.           sprite.visible = false
  33.           @_animation[num][3].push(sprite)
  34.         end
  35.         unless @@_animations.include?(animation)
  36.           @@_animations.push(animation)
  37.         end
  38.       end
  39.       update_animation(@_animation[num])
  40.     end
  41.     def loop_animation(animation)
  42.       return if animation == @_loop_animation
  43.       dispose_loop_animation
  44.       @_loop_animation = animation
  45.       return if @_loop_animation == nil
  46.       @_loop_animation_index = 0
  47.       animation_name = @_loop_animation.animation_name
  48.       animation_hue = @_loop_animation.animation_hue
  49.       bitmap = RPG::Cache.animation(animation_name, animation_hue)
  50.       if @@_reference_count.include?(bitmap)
  51.         @@_reference_count[bitmap] += 1
  52.       else
  53.         @@_reference_count[bitmap] = 1
  54.       end
  55.       @_loop_animation_sprites = []
  56.       for i in 0..15
  57.         sprite = ::Sprite.new
  58.         sprite.bitmap = bitmap
  59.         sprite.visible = false
  60.         @_loop_animation_sprites.push(sprite)
  61.       end
  62.       # update_loop_animation
  63.     end
  64.     def dispose_animation
  65.       for anime in @_animation.reverse
  66.         sprite = anime[3][0]
  67.         if sprite != nil
  68.           @@_reference_count[sprite.bitmap] -= 1
  69.           if @@_reference_count[sprite.bitmap] == 0
  70.             sprite.bitmap.dispose
  71.           end
  72.         end
  73.         for sprite in anime[3]
  74.           sprite.dispose
  75.         end
  76.         @_animation.delete(anime)
  77.       end
  78.     end
  79.    
  80.     def update
  81.       super
  82.       if @_whiten_duration > 0
  83.         @_whiten_duration -= 1
  84.         self.color.alpha = 128 - (16 - @_whiten_duration) * 10
  85.       end
  86.       if @_appear_duration > 0
  87.         @_appear_duration -= 1
  88.         self.opacity = (16 - @_appear_duration) * 16
  89.       end
  90.       if @_escape_duration > 0
  91.         @_escape_duration -= 1
  92.         self.opacity = 256 - (32 - @_escape_duration) * 10
  93.       end
  94.       if @_collapse_duration > 0
  95.         @_collapse_duration -= 1
  96.         self.opacity = 256 - (48 - @_collapse_duration) * 6
  97.       end
  98.       if @_damage_duration > 0
  99.         @_damage_duration -= 1
  100.         case @_damage_duration
  101.         when 38..39
  102.           @_damage_sprite.y -= 4
  103.         when 36..37
  104.           @_damage_sprite.y -= 2
  105.         when 34..35
  106.           @_damage_sprite.y += 2
  107.         when 28..33
  108.           @_damage_sprite.y += 4
  109.         end
  110.         @_damage_sprite.opacity = 256 - (12 - @_damage_duration) * 32
  111.         if @_damage_duration == 0
  112.           dispose_damage
  113.         end
  114.       end
  115.       for anime in @_animation
  116.         if (Graphics.frame_count % 2 == 0)
  117.           anime[2] -= 1
  118.           update_animation(anime)
  119.         end
  120.       end
  121.       if @_loop_animation != nil and (Graphics.frame_count % 2 == 0)
  122.         update_loop_animation
  123.         @_loop_animation_index += 1
  124.         @_loop_animation_index %= @_loop_animation.frame_max
  125.       end
  126.       if @_blink
  127.         @_blink_count = (@_blink_count + 1) % 32
  128.         if @_blink_count < 16
  129.           alpha = (16 - @_blink_count) * 6
  130.         else
  131.           alpha = (@_blink_count - 16) * 6
  132.         end
  133.         self.color.set(255, 255, 255, alpha)
  134.       end
  135.       @@_animations.clear
  136.     end

  137.     def update_animation(anime)
  138.       if anime[2] > 0
  139.         frame_index = anime[0].frame_max - anime[2]
  140.         cell_data = anime[0].frames[frame_index].cell_data
  141.         position = anime[0].position
  142.         animation_set_sprites(anime[3], cell_data, position)
  143.         for timing in anime[0].timings
  144.           if timing.frame == frame_index
  145.             animation_process_timing(timing, anime[1])
  146.           end
  147.         end
  148.       else
  149.         @@_reference_count[anime[3][0].bitmap] -= 1
  150.         if @@_reference_count[anime[3][0].bitmap] == 0
  151.             anime[3][0].bitmap.dispose
  152.         end
  153.         for sprite in anime[3]
  154.           sprite.dispose
  155.         end
  156.         @_animation.delete(anime)
  157.       end
  158.     end
  159.     def animation_set_sprites(sprites, cell_data, position)
  160.       for i in 0..15
  161.         sprite = sprites[i]
  162.         pattern = cell_data[i, 0]
  163.         if sprite == nil or pattern == nil or pattern == -1
  164.           sprite.visible = false if sprite != nil
  165.           next
  166.         end
  167.         sprite.visible = true
  168.         sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
  169.         if position == 3
  170.           if self.viewport != nil
  171.             sprite.x = self.viewport.rect.width / 2
  172.             if $game_temp.in_battle and self.battler.is_a?(Game_Enemy)
  173.               sprite.y = self.viewport.rect.height - 320
  174.             else
  175.               sprite.y = self.viewport.rect.height - 160
  176.             end
  177.           else
  178.             sprite.x = 320
  179.             sprite.y = 240
  180.           end
  181.         else
  182.           sprite.x = self.x + self.viewport.rect.x -
  183.                       self.ox + self.src_rect.width / 2
  184.           if $game_temp.in_battle and self.battler.is_a?(Game_Enemy)
  185.             sprite.y = self.y - self.oy * self.zoom_y / 2 +
  186.                         self.viewport.rect.y
  187.             if position == 0
  188.               sprite.y -= self.src_rect.height * self.zoom_y / 4
  189.             elsif position == 2
  190.               sprite.y += self.src_rect.height * self.zoom_y / 4
  191.             end
  192.           else
  193.             sprite.y = self.y + self.viewport.rect.y -
  194.                         self.oy + self.src_rect.height / 2
  195.             sprite.y -= self.src_rect.height / 4 if position == 0
  196.             sprite.y += self.src_rect.height / 4 if position == 2
  197.           end
  198.         end
  199.         sprite.x += cell_data[i, 1]
  200.         sprite.y += cell_data[i, 2]
  201.         sprite.z = 2000
  202.         sprite.ox = 96
  203.         sprite.oy = 96
  204.         sprite.zoom_x = cell_data[i, 3] / 100.0
  205.         sprite.zoom_y = cell_data[i, 3] / 100.0
  206.         if position != 3
  207.           sprite.zoom_x *= self.zoom_x
  208.           sprite.zoom_y *= self.zoom_y
  209.         end
  210.         sprite.angle = cell_data[i, 4]
  211.         sprite.mirror = (cell_data[i, 5] == 1)
  212.         sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
  213.         sprite.blend_type = cell_data[i, 7]
  214.       end
  215.     end
  216.   end
  217. end
复制代码

显示伤害
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================
  4. #
  5. # 使用方法:
  6. #
  7. # ★、对角色显示伤害,如下3步:
  8. #
  9. # 1、设置伤害内容:$game_player.damage = 数值
  10. #    注意:如果数值是负数,就变成补血的颜色了。
  11. #
  12. # 2、设置是否会心一击:$game_player.critical = true/false
  13. #    如果不是会心一击,就不用这一步了
  14. #$game_player.damage = 数值
  15. # 3、释放伤害:$game_player.damage_pop = true
  16. #
  17. #
  18. # ★、对普通NPC和事件进行伤害,类似的3步:
  19. #
  20. # 1、设置伤害内容:$game_map.events[事件编号].damage = 数值
  21. #
  22. # 2、设置是否会心一击:$game_map.events[事件编号].critical = true/false
  23. #
  24. # 3、释放伤害:$game_map.events[事件编号].damage_pop = true
  25. #
  26. # 注意,事件编号是事件的ID号,如果目标是“本事件”,那么在事件编号输入@event_id
  27. #
  28. #------------------------------------------------------------------------------
  29. # 预祝有人能早日做出华丽的ARPG来,别忘了到网站发布哦~
  30. #------------------------------------------------------------------------------
  31. class Sprite_Character < RPG::Sprite
  32.   alias carol3_66RPG_damage_pop_update update
  33.   def update
  34.     carol3_66RPG_damage_pop_update
  35.     if @character.damage_pop
  36.       damage(@character.damage, @character.critical)
  37.       @character.damage = nil
  38.       @character.critical = false
  39.       @character.damage_pop = false
  40.     end
  41.     #------------------------------
  42.     # 动画 ID 与当前的情况有差异的情况下
  43.     if @character.damage == nil and
  44.        @character.state_animation_id != @state_animation_id
  45.       @state_animation_id = @character.state_animation_id
  46.       loop_animation($data_animations[@state_animation_id])
  47.     end
  48.    
  49.     #collapse
  50.     # 明灭
  51.     if @character.blink
  52.       blink_on
  53.     else
  54.       blink_off
  55.     end
  56.     # 白色闪烁
  57.     if @character.white_flash
  58.       whiten
  59.       @character.white_flash = false
  60.     end
  61.     # 死亡
  62.     if @character.dead
  63.       collapse
  64.       @character.dead = false
  65.     end
  66.     #------------------------------
  67.   end  
  68. end
  69. class Game_Character
  70.   attr_accessor :damage_pop
  71.   attr_accessor :damage
  72.   attr_accessor :critical
  73.   attr_accessor :white_flash              # 白色屏幕闪烁标志
  74.   attr_accessor :blink                    # 闪烁标志
  75.   attr_accessor :dead                     # 死亡消失标志
  76.   attr_accessor :state_animation_id       # 状态动画ID
  77.   alias carol3_66RPG_damage_pop_initialize initialize
  78.   def initialize
  79.     @damage_pop = false
  80.     @damage = nil
  81.     @critical = false
  82.     carol3_66RPG_damage_pop_initialize
  83.     @white_flash = false
  84.     @blink = false
  85.     @dead = false
  86.   end
  87. end

  88. #==============================================================================
  89. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  90. #==============================================================================
复制代码

彩虹

  1. =begin
  2. ==============================================================================

  3. 彩虹神剑(伤害分段显示)显示总伤害版 v1.0d

  4. ==============================================================================

  5. 彩虹神剑 -柳柳

  6. 6-20-2006 v1.0 -叶子
  7. 在彩虹神剑的基础上增加了显示总伤害的功能,而且总伤害的数字是弹出伤害时逐渐增加的

  8. v1.0a -叶子
  9. 修正了显示伤害和实际伤害有差别的问题
  10. 修正了miss的情况下显示miss混乱的问题
  11. 修正了对己方技能重复显示伤害的问题
  12. 未修正播放目标动画第一帧时目标有时无端跳动的BUG

  13. v1.0b -叶子
  14. 修改了总伤害数字的位置和z坐标
  15. 未修正播放目标动画第一帧时目标有时无端跳动的BUG

  16. v1.0c -柳柳
  17. ? ? ?

  18. v1.0d -柳柳
  19. 1.0d最终解决了那个闪光问题,还有最末帧伤害多次的算法

  20. 7-24-2006 v1.0e -叶子
  21. 修正全屏幕闪烁弹出伤害错误的问题
  22. 修正连续伤害不会弹出伤害的问题
  23. 仍然未修正播放目标动画第一帧时目标有时无端跳动的BUG

  24. 我鼓起很大勇气才敢动偶像们的脚本的,不知道会不会出问题啊......  -cftx
  25. 修正了总伤害显示
  26. 增加了伤害美化和HIT数显示
  27. 修正了两次音效

  28. ==============================================================================
  29. =end
  30. # 核心的说明:
  31. # damage_pop 不再附带damage()的功能,这个放到animation里面去了

  32. module RPG
  33. #--------------------------------------------------------------------------
  34. # ● 常量设定
  35. #--------------------------------------------------------------------------
  36. # 是否显示总伤害
  37. SHOW_TOTAL_DAMAGE = true
  38. # 角色受攻击时是否跳一下
  39. BATTLER_JUMP = false
  40. # 连续伤害的动画ID
  41. SLIP_DAMAGE_ANIMATION_ID = 10

  42. class Sprite < ::Sprite
  43.    #==========================================
  44.    # 修改说明:
  45.    # @flash_shake用来制作挨打时候跳跃
  46.    # @_damage    用来记录每次打击之后弹出数字
  47.    # @_total_damage 记录总伤害
  48.    # @_total_damage_duration 总伤害持续帧
  49.    #==========================================
  50.    #alias 66RPG_rainbow_initialize : initialize
  51.    
  52.    def initialize(viewport = nil)
  53.      #66RPG_rainbow_initialize(viewport)
  54.      super(viewport)
  55.      @_whiten_duration = 0
  56.      @_appear_duration = 0
  57.      @_escape_duration = 0
  58.      @_collapse_duration = 0
  59.      @_damage_duration = 0
  60.      @_animation_duration = 0
  61.      @_blink = false
  62.      # 挨打时候跳跃
  63.      @flash_shake = 0
  64.      # 伤害记录数组
  65.      @_damage = []
  66.      # 总伤害数字
  67.      @_total_damage = 0
  68.      # 总伤害持续帧
  69.      @_total_damage_duration = 0
  70.      #记录已经发生的伤害的变量★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  71.      @p_dam=0
  72.      @hits=0
  73.    end
  74. #美化的伤害处理★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  75. def damage(value, critical)
  76.       # 释放伤害,效果是伤害数字快速消失,觉得不如不消失好看......
  77.       #dispose_damage
  78.       #清除hit数
  79.       dispose_hit
  80.       # 如果伤害值是数值
  81.       if value.is_a?(Numeric)
  82.         # 绝对值转为字符串
  83.         damage_string = value.abs.to_s
  84.       else
  85.         # 转为字符串
  86.         damage_string = value.to_s
  87.       end
  88.       # 初始化位图
  89.       bitmap = Bitmap.new(162, 64)
  90.       bitmap.font.name = ["黑体","华文行楷", "宋体"]
  91.       bitmap.font.size = 32
  92.       # 伤害值是数值的情况下
  93.       if value.is_a?(Numeric)
  94.         # 分割伤害值字符串
  95.         damage_array = damage_string.scan(/./)
  96.         damage_x = 81 - damage_string.size * 9
  97.         # 伤害值为负的情况下
  98.         if value < 0
  99.           # 调用回复数字表
  100.           rect_y = 32
  101.         else
  102.           # 调用伤害数字表
  103.           rect_y = 0
  104.         end
  105.         # 循环伤害值字符串
  106.         for char in damage_array
  107.           number = char.to_i
  108.           # 显示伤害数字
  109.           bitmap.blt(damage_x, 32, RPG::Cache.picture("Damage"),
  110.           Rect.new(number * 18, rect_y, 18, 32))
  111.           # 后移一位
  112.           damage_x += 18
  113.         end
  114.       # 伤害值不是数值的情况
  115.       else
  116.         if $game_variables[6] <= $game_variables[5]
  117.           # 系统默认描画字符串
  118.           bitmap.font.color.set(0, 0, 0)
  119.           bitmap.draw_text(-1, 27, 162, 36, damage_string, 1)
  120.           bitmap.draw_text(+1, 27, 162, 36, damage_string, 1)
  121.           bitmap.draw_text(-1, 29, 162, 36, damage_string, 1)
  122.           bitmap.draw_text(+1, 29, 162, 36, damage_string, 1)
  123.           bitmap.font.color.set(255, 255, 255)
  124.           bitmap.draw_text(0, 28, 162, 36, damage_string, 1)
  125.         # Miss 的情况下
  126.         else
  127.           # 显示未击中图画
  128.           bitmap.blt(36, 28, RPG::Cache.picture("Damage"), Rect.new(90, 64, 90, 32))
  129.         end
  130.       end
  131.       # 会心一击标志打开的情况
  132.       if critical
  133.         # 显示会心一击图画
  134.         bitmap.blt(36, 0, RPG::Cache.picture("Damage"), Rect.new(0, 64, 90, 32))
  135.       end
  136.       # 伤害值定位
  137.       @_damage_sprite = ::Sprite.new(self.viewport)
  138.       @_damage_sprite.bitmap = bitmap
  139.       @_damage_sprite.ox = 81
  140.       @_damage_sprite.oy = 20
  141.       @_damage_sprite.x = self.x
  142.       @_damage_sprite.y = self.y - self.oy / 2
  143.       @_damage_sprite.z = 3000
  144.       @_damage_duration = 40
  145.       @_damage.push([@_damage_sprite,@_damage_duration-10,0, rand(30) - 15, rand(3)])
  146.       make_total_damage(value)  

  147.     end

  148. #   ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  149. # hit数的美化描绘
  150.     def hit

  151.       # 如果伤害值是数值
  152.       # 转为字符串
  153.       value=@hits
  154.         hits_string = value.to_s
  155.       # 初始化位图
  156.        bitmap = Bitmap.new(320, 64)
  157.        bitmap.font.name = "Arial Black"
  158.        bitmap.font.size = 32
  159.        # 分割伤害值字符串
  160.         hits_array = hits_string.scan(/./)
  161.         hits_x = 81 - hits_string.size * 18.1
  162.           rect_y = 0
  163.         # 循环伤害值字符串
  164.         for char in hits_array
  165.           number = char.to_i
  166.           # 显示伤害数字
  167.           bitmap.blt(hits_x, 0, RPG::Cache.picture("Number"),
  168.           Rect.new(number * 36.2, rect_y, 36.2, 50))
  169.           # 后移一位
  170.           hits_x += 36.2
  171.         end
  172.         bitmap.blt(hits_x, 0, RPG::Cache.picture("HITS"),
  173.         Rect.new(0, -21, 90, 50))

  174.       # 伤害值定位
  175.       @_hits_sprite = ::Sprite.new(self.viewport)
  176.       @_hits_sprite.bitmap = bitmap
  177.       @_hits_sprite.ox = 81
  178.       @_hits_sprite.oy = 20
  179.       @_hits_sprite.x = 300
  180.       @_hits_sprite.y = 20
  181.       @_hits_sprite.z = 3000
  182.       @_hits_duration = 40
  183.     end
  184. #--------------------------------------------------------------------------
  185.    # ● 总伤害处理
  186.    #--------------------------------------------------------------------------
  187.    def make_total_damage(value)
  188.      if value.is_a?(Numeric) and SHOW_TOTAL_DAMAGE
  189.        @_total_damage += value
  190.         # 绝对值转为字符串
  191.         damage_string = @_total_damage.abs.to_s
  192.       else
  193.         return
  194.       end
  195.       # 初始化位图
  196.       bitmap = Bitmap.new(300, 150)
  197.       bitmap.font.name = "Arial Black"
  198.       bitmap.font.size = 32
  199.       # 伤害值是数值的情况下
  200.       if value.is_a?(Numeric)
  201.         # 分割伤害值字符串
  202.         damage_array = damage_string.scan(/./)
  203.         damage_x = 40 - damage_string.size * 9
  204.         # 伤害值为负的情况下
  205.           if value < 0
  206.             name="Number3"

  207.         else
  208.           # 调用伤害数字表
  209.             name="Number2"

  210.         end

  211.         
  212.         # 循环伤害值字符串
  213.         for char in damage_array
  214.           number = char.to_i
  215.           # 显示伤害数字
  216.           bitmap.blt(damage_x, 0, RPG::Cache.picture(name),
  217.           Rect.new(number * 36.2, 0, 36.2, 50))
  218.           # 后移一位
  219.           damage_x += 36.2
  220.         end
  221.       end
  222.       
  223.       
  224.         
  225.         
  226. #     if value.is_a?(Numeric) and SHOW_TOTAL_DAMAGE
  227. #       @_total_damage += value
  228. #     else
  229. #       return
  230. #     end
  231. #     bitmap = Bitmap.new(300, 150)
  232. #     bitmap.font.name = "Arial Black"
  233. #     bitmap.font.size = 40
  234. #     bitmap.font.color.set(0, 0, 0)
  235. #     bitmap.draw_text(+2, 12+2, 160, 40, @_total_damage.abs.to_s, 1)
  236. #     if @_total_damage < 0
  237. #       bitmap.font.color.set(80, 255, 00)
  238. #    else
  239. #       bitmap.font.color.set(255, 140, 0)
  240. #     end
  241. #     bitmap.draw_text(0, 12, 160, 40, @_total_damage.abs.to_s, 1)
  242. #     bitmap.font.color.set(55, 55,255)
  243.      
  244.      
  245.      if @_total_damage_sprite.nil?
  246.        @_total_damage_sprite = ::Sprite.new(self.viewport)
  247.        @_total_damage_sprite.ox = 80
  248.        @_total_damage_sprite.oy = 20
  249.        @_total_damage_sprite.z = 3000

  250.      end
  251.      @_total_damage_sprite.bitmap = bitmap
  252.      @_total_damage_sprite.zoom_x = 0.8
  253.      @_total_damage_sprite.zoom_y = 0.8
  254.      @_total_damage_sprite.x = self.x
  255.      @_total_damage_sprite.y = self.y  - self.oy / 2 - 64
  256.      @_total_damage_sprite.z = 3001
  257.      @_total_damage_duration = 80
  258.      #hit数描绘
  259.      @hits+=1
  260.     if @_total_damage > 0
  261.       hit
  262.     end
  263.    end


  264.    def animation(animation, hit, battler_damage="", battler_critical=false)
  265.      dispose_animation      
  266.      #=======================================
  267.      # 修改:记录伤害和critical
  268.      #=======================================
  269.      @battler_damage = battler_damage
  270.      @battler_critical = battler_critical
  271.      @_animation = animation
  272.      return if @_animation == nil
  273.      @_animation_hit = hit
  274.      @_animation_duration = @_animation.frame_max
  275.      animation_name = @_animation.animation_name
  276.      animation_hue = @_animation.animation_hue
  277.      bitmap = RPG::Cache.animation(animation_name, animation_hue)
  278.      #=======================================
  279.      # 修改:计算总闪光权限值
  280.      #=======================================
  281.      for timing in @_animation.timings
  282.        quanzhong = animation_process_timing(timing, @_animation_hit,true)
  283.        @all_quanzhong += quanzhong
  284.        # 记录最后一次闪光
  285.        @_last_frame = timing.frame if quanzhong != 0
  286.      end      
  287.      if @@_reference_count.include?(bitmap)
  288.        @@_reference_count[bitmap] += 1
  289.      else
  290.        @@_reference_count[bitmap] = 1
  291.      end
  292.      #=======================================
  293.      # 修改:行动方动画不显示伤害
  294.      #=======================================
  295.      if $scene.is_a?(Scene_Battle)
  296.        if $scene.animation1_id == @battler.animation_id
  297.          @battler_damage = ""
  298.        end
  299.      end
  300.      @_animation_sprites = []
  301.      if @_animation.position != 3 or not @@_animations.include?(animation)
  302.        for i in 0..15
  303.          sprite = ::Sprite.new(self.viewport)
  304.          sprite.bitmap = bitmap
  305.          sprite.visible = false
  306.          @_animation_sprites.push(sprite)
  307.        end
  308.        unless @@_animations.include?(animation)
  309.          @@_animations.push(animation)
  310.        end
  311.      end
  312.      update_animation
  313.   end
  314.    #=======================================
  315.    # 修改:更换清除伤害的算法,以防万一
  316.    #       本内容在脚本中没有使用过
  317.    #=======================================
  318.    def dispose_damage
  319.      for damage in @_damage.reverse
  320.        damage[0].bitmap.dispose
  321.        damage[0].dispose
  322.        @_damage.delete(damage)
  323.      end
  324.      @_total_damage = 0
  325.      @_last_frame = -1
  326.      if @_total_damage_sprite != nil
  327.        @_total_damage_duration = 0
  328.        @_total_damage_sprite.bitmap.dispose
  329.        @_total_damage_sprite.dispose
  330.        @_total_damage_sprite = nil
  331.      end
  332.    end
  333.    #=======================================
  334.    # 清除hit数★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  335.    #=======================================
  336.    def dispose_hit
  337.      if @_hits_sprite != nil
  338.        @_hits_sprite.bitmap.dispose
  339.        @_hits_sprite.dispose
  340.        @_hits_sprite = nil
  341.      end
  342.    end
  343.    def dispose_animation
  344.      #=======================================
  345.      # 修改:清除记录的伤害,清除权重记录
  346.      #=======================================
  347.      @battler_damage = nil
  348.      @battler_critical = nil
  349.      @all_quanzhong = 1
  350.      @_total_damage = 0
  351.      @_last_frame = -1
  352.      if @_animation_sprites != nil
  353.        sprite = @_animation_sprites[0]
  354.        if sprite != nil
  355.          @@_reference_count[sprite.bitmap] -= 1
  356.          if @@_reference_count[sprite.bitmap] == 0
  357.            sprite.bitmap.dispose
  358.          end
  359.        end
  360.        for sprite in @_animation_sprites
  361.          sprite.dispose
  362.        end
  363.        @_animation_sprites = nil
  364.        @_animation = nil
  365.      end
  366.    end
  367.    def update
  368.      super
  369.      if @_whiten_duration > 0
  370.        @_whiten_duration -= 1
  371.        self.color.alpha = 128 - (16 - @_whiten_duration) * 10
  372.      end
  373.      if @_appear_duration > 0
  374.        @_appear_duration -= 1
  375.        self.opacity = (16 - @_appear_duration) * 16
  376.      end
  377.      if @_escape_duration > 0
  378.        @_escape_duration -= 1
  379.        self.opacity = 256 - (32 - @_escape_duration) * 10
  380.      end
  381.      if @_collapse_duration > 0
  382.        @_collapse_duration -= 1
  383.        self.opacity = 256 - (48 - @_collapse_duration) * 6
  384.      end
  385.      #=======================================
  386.      # 修改:更新算法,更新弹出
  387.      #=======================================
  388.      if @_damage_duration > 0
  389.        @_damage_duration -= 1
  390.        for damage in @_damage
  391.          damage[0].x = self.x + self.viewport.rect.x
  392.          damage[0].y -= 3
  393.          damage[0].opacity = damage[1]*20
  394.          damage[1] -= 1
  395.          if damage[1]==0
  396.            damage[0].bitmap.dispose
  397.            damage[0].dispose
  398.            @_damage.delete(damage)

  399.            next
  400.          end
  401.        end
  402.      end
  403.      #=======================================
  404.      # 添加:弹出总伤害
  405.      #=======================================
  406.      if @_total_damage_duration > 0
  407.        @_total_damage_duration -= 1
  408.        @_total_damage_sprite.y -= 1 if @_total_damage_duration % 2 == 0
  409.        if @_total_damage_sprite.zoom_x > 1.0
  410.          @_total_damage_sprite.zoom_x -= 0.05
  411.        end
  412.        if @_total_damage_sprite.zoom_y > 1.0
  413.          @_total_damage_sprite.zoom_y -= 0.05
  414.        end
  415.        @_total_damage_sprite.opacity = 256 - (24 - @_total_damage_duration) * 16
  416.        if @_total_damage_duration <= 0
  417.          dispose_hit#★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  418.          @_total_damage = 0
  419.          @_total_damage_duration = 0
  420.          @_total_damage_sprite.bitmap.dispose
  421.          @_total_damage_sprite.dispose
  422.          @_total_damage_sprite = nil
  423.        end
  424.      end
  425.      #=======================================
  426.      if @_animation != nil and (Graphics.frame_count % 2 == 0)
  427.        @_animation_duration -= 1
  428.        update_animation
  429.      end
  430.      if @_loop_animation != nil and (Graphics.frame_count % 2 == 0)
  431.        update_loop_animation
  432.        @_loop_animation_index += 1
  433.        @_loop_animation_index %= @_loop_animation.frame_max
  434.      end
  435.      if @_blink
  436.        @_blink_count = (@_blink_count + 1) % 32
  437.        if @_blink_count < 16
  438.          alpha = (16 - @_blink_count) * 6
  439.        else
  440.          alpha = (@_blink_count - 16) * 6
  441.        end
  442.        self.color.set(255, 255, 255, alpha)
  443.      end
  444.      @@_animations.clear
  445.    end
  446.    def update_animation
  447.     if @_animation_duration > 0
  448.        frame_index = @_animation.frame_max - @_animation_duration
  449.        cell_data = @_animation.frames[frame_index].cell_data
  450.        position = @_animation.position
  451.        animation_set_sprites(@_animation_sprites, cell_data, position)
  452.        #=======================================
  453.        # 修改:弹出伤害,权重计算
  454.        #=======================================
  455.        for timing in @_animation.timings
  456.          if timing.frame == frame_index
  457.            t = 1.0 * animation_process_timing(timing, @_animation_hit)  
  458.                    if timing.se.name != ""
  459.           se=timing.se
  460.           Audio.se_play("Audio/SE/" + se.name, se.volume, se.pitch)
  461.         end
  462.            #p t,"当前权重", @all_quanzhong,"总权重"
  463.            if @battler_damage.is_a?(Numeric) and t != 0
  464.              t *= @battler_damage
  465.              t /= @all_quanzhong
  466.              t = t.to_i
  467.              #在闪光不是最后一次的情况下,把这次伤害加入到已经发生的伤害中★★★★★★★★★★★★★★★★★★★★★★★★★★
  468.              if frame_index != @_last_frame
  469.              @p_dam+= t
  470.              end
  471.              #p @p_dam,"已发生伤害",@battler_damage,"总伤害"(调试用)★★★★★★★★★★★★★★★★★★★★★★★★★★
  472.              #闪光为最后一次的情况下,改变这次伤害的计算方法(总伤害-已经发生伤害)★★★★★★★★★★★★★★★★★★★★★★★★★★
  473.              if frame_index == @_last_frame
  474.                t=@battler_damage-@p_dam
  475.              end
  476.              #p t,"当前伤害",@battler_damage,"总伤害"
  477.              # 最后一次闪光的话,伤害修正
  478.              if frame_index == @_last_frame
  479.                @_total_damage = @battler_damage - t
  480.                @p_dam=0      #已经发生的伤害归0★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  481.             end
  482.              #p t,@battler_damage,@all_quanzhong
  483.              damage(t,@battler_critical)
  484.             #连击次数归0★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  485.             if frame_index == @_last_frame
  486.                       @hits=0  
  487.             end
  488.            # 防止重复播放miss
  489.            elsif !@battler_damage.is_a?(Numeric) and timing.flash_scope != 0
  490.              damage(@battler_damage,@battler_critical)
  491.            end
  492.          end
  493.        end
  494.      else
  495.        dispose_animation
  496.      end
  497.    end
  498.    #=======================================
  499.    # 修改:敌人跳跃的功能 + 添加返回数值
  500.    #=======================================
  501.     def animation_process_timing(timing, hit,dontflash=false)
  502.       if (timing.condition == 0) or
  503.          (timing.condition == 1 and hit == true) or
  504.          (timing.condition == 2 and hit == false)
  505.         case timing.flash_scope
  506.         when 1
  507.           unless dontflash
  508.             self.flash(timing.flash_color, timing.flash_duration * 2)
  509.             if @_total_damage >0
  510.               @flash_shake_switch = true
  511.               @flash_shake = 10
  512.             end
  513.           end
  514.           return timing.flash_color.alpha * timing.flash_duration
  515.         when 2
  516.           unless dontflash
  517.             if self.viewport != nil
  518.               self.viewport.flash(timing.flash_color, timing.flash_duration * 2)
  519.             end
  520.           end
  521.           return timing.flash_color.alpha * timing.flash_duration
  522.         when 3
  523.           unless dontflash
  524.             self.flash(nil, timing.flash_duration * 2)
  525.           end
  526.           return timing.flash_color.alpha * timing.flash_duration
  527.         end
  528.       end      
  529.       return 0
  530.     end   
  531. end
  532. end
  533. #==============================================================================
  534. # ■ Sprite_Battler
  535. #==============================================================================
  536. class Sprite_Battler < RPG::Sprite
  537. #--------------------------------------------------------------------------
  538. # ● 初始化对像
  539. #    添加跳跃记录
  540. #--------------------------------------------------------------------------
  541. def initialize(viewport, battler = nil)
  542.   super(viewport)
  543.   @battler = battler
  544.   @battler_visible = false
  545.   @flash_shake_switch = true
  546. end
  547. #--------------------------------------------------------------------------
  548. # ● 刷新画面
  549. #    增添跳跃功能
  550. #--------------------------------------------------------------------------
  551. def update
  552.   super
  553.   # 战斗者为 nil 的情况下
  554.   if @battler == nil
  555.     self.bitmap = nil
  556.     loop_animation(nil)
  557.     return
  558.   end
  559.   # 文件名和色相与当前情况有差异的情况下
  560.   if @battler.battler_name != @battler_name or
  561.      @battler.battler_hue != @battler_hue
  562.     # 获取、设置位图
  563.     @battler_name = @battler.battler_name
  564.     @battler_hue = @battler.battler_hue
  565.     self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
  566.     @width = bitmap.width
  567.     @height = bitmap.height
  568.     self.ox = @width / 2
  569.     self.oy = @height
  570.     # 如果是战斗不能或者是隐藏状态就把透明度设置成 0
  571.     if @battler.dead? or @battler.hidden
  572.       self.opacity = 0
  573.     end
  574.   end
  575.   # 动画 ID 与当前的情况有差异的情况下
  576.   if @battler.damage == nil and
  577.      @battler.state_animation_id != @state_animation_id
  578.     @state_animation_id = @battler.state_animation_id
  579.     loop_animation($data_animations[@state_animation_id])
  580.   end
  581.   # 应该被显示的角色的情况下
  582.   if @battler.is_a?(Game_Actor) and @battler_visible
  583.     # 不是主状态的时候稍稍降低点透明度
  584.     if $game_temp.battle_main_phase
  585.       self.opacity += 3 if self.opacity < 255
  586.     else
  587.       self.opacity -= 3 if self.opacity > 207
  588.     end
  589.   end
  590.   # 明灭
  591.   if @battler.blink
  592.     blink_on
  593.   else
  594.     blink_off
  595.   end
  596.   # 不可见的情况下
  597.   unless @battler_visible
  598.     # 出现
  599.     if not @battler.hidden and not @battler.dead? and
  600.        (@battler.damage == nil or @battler.damage_pop)
  601.       appear
  602.       @battler_visible = true
  603.     end
  604.   end
  605.   # 可见的情况下
  606.   if @battler_visible
  607.     # 逃跑
  608.     if @battler.hidden
  609.       $game_system.se_play($data_system.escape_se)
  610.       escape
  611.       @battler_visible = false
  612.     end
  613.     # 白色闪烁
  614.     if @battler.white_flash
  615.       whiten
  616.       @battler.white_flash = false
  617.     end
  618.     # 动画
  619.     if @battler.animation_id != 0
  620.       animation = $data_animations[@battler.animation_id]
  621.       animation(animation, @battler.animation_hit,@battler.damage, @battler.critical)
  622.       @battler.animation_id = 0
  623.     end
  624.     # 伤害
  625.     if @battler.damage_pop
  626.       @battler.damage = nil
  627.       @battler.critical = false
  628.       @battler.damage_pop = false
  629.     end
  630.     # korapusu
  631.     if @battler.damage == nil and @battler.dead?
  632.       if @battler.is_a?(Game_Enemy)
  633.         $game_system.se_play($data_system.enemy_collapse_se)
  634.       else
  635.         $game_system.se_play($data_system.actor_collapse_se)
  636.       end
  637.       collapse
  638.       @battler_visible = false
  639.     end
  640.   end
  641.   # 设置活动块的坐标
  642.   if @flash_shake_switch == true
  643.     self.x = @battler.screen_x
  644.     self.y = @battler.screen_y
  645.     self.z = @battler.screen_z
  646.     @flash_shake_switch = false
  647.   end
  648.   if @flash_shake != 0 and @battler.damage != nil and RPG::BATTLER_JUMP
  649.     case @flash_shake
  650.     when 9..10
  651.       self.x = @battler.screen_x
  652.       self.y -=4
  653.       self.z = @battler.screen_z
  654.     when 6..8
  655.       self.x = @battler.screen_x
  656.       self.y -=2
  657.       self.z = @battler.screen_z
  658.     when 3..5
  659.       self.x = @battler.screen_x
  660.       self.y +=2
  661.       self.z = @battler.screen_z
  662.     when 2
  663.       self.x = @battler.screen_x
  664.       self.y += 4
  665.       self.z = @battler.screen_z
  666.     when 1
  667.       self.x = @battler.screen_x
  668.       self.y = @battler.screen_y
  669.       self.z = @battler.screen_z
  670.     end
  671.     @flash_shake -= 1
  672.   end
  673. end
  674. end

  675. #==============================================================================
  676. # ■ Scene_Battle
  677. #------------------------------------------------------------------------------
  678. #  处理战斗画面的类。
  679. #==============================================================================

  680. class Scene_Battle
  681. #--------------------------------------------------------------------------
  682. # ● 定义实例变量
  683. #--------------------------------------------------------------------------
  684. attr_reader   :animation1_id                    # 行动方动画ID
  685. end

  686. #==============================================================================
  687. # ■ Game_Battler
  688. #------------------------------------------------------------------------------
  689. #  处理战斗者的类。这个类作为 Game_Actor 类与 Game_Enemy 类的
  690. # 超级类来使用。
  691. #==============================================================================

  692. #class Game_Battler
  693. #  #--------------------------------------------------------------------------
  694. #  # ● 应用连续伤害效果
  695. #  #--------------------------------------------------------------------------
  696. #  alias rainbow_sword_slip_damage_effect slip_damage_effect
  697. #  def slip_damage_effect
  698. #    self.animation_id = RPG::SLIP_DAMAGE_ANIMATION_ID
  699. #    self.animation_hit = true
  700. #    rainbow_sword_slip_damage_effect
  701. #  end
  702. #end
复制代码
群:13283861

Lv1.梦旅人

梦石
0
星屑
55
在线时间
9 小时
注册时间
2006-4-26
帖子
444
2
 楼主| 发表于 2007-7-29 14:40:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
可是彩虹神剑和一个事件上显示多个动画不能同时使用
彩虹放在一个事件上显示多个动画上面的话342行出错

彩虹放下面的话.一个事件上显示多个动画又没用了.



我要的是将3个脚本可以同时用.
有效果就可以了




[一个事件上显示多个动画]


  1. #--------------------------------------------------
  2. # 此脚本来自www.66RPG.com,使用请保留此信息
  3. #--------------------------------------------------
  4. module RPG
  5.   class Sprite < ::Sprite
  6.     def initialize(viewport = nil)
  7.       super(viewport)
  8.       @_whiten_duration = 0
  9.       @_appear_duration = 0
  10.       @_escape_duration = 0
  11.       @_collapse_duration = 0
  12.       @_damage_duration = 0
  13.       @_animation_duration = 0
  14.       @_blink = false
  15.       @_animation = []
  16.     end
  17.     def animation(animation, hit)
  18.       return if animation == nil
  19.       num = @_animation.size
  20.       @_animation.push([animation, hit, animation.frame_max, []])
  21.       bitmap = RPG::Cache.animation(animation.animation_name,
  22.                                     animation.animation_hue)
  23.       if @@_reference_count.include?(bitmap)
  24.         @@_reference_count[bitmap] += 1
  25.       else
  26.         @@_reference_count[bitmap] = 1
  27.       end
  28.       if @_animation[num][0] != 3 or not @@_animations.include?(animation)
  29.         for i in 0..15
  30.           sprite = ::Sprite.new
  31.           sprite.bitmap = bitmap
  32.           sprite.visible = false
  33.           @_animation[num][3].push(sprite)
  34.         end
  35.         unless @@_animations.include?(animation)
  36.           @@_animations.push(animation)
  37.         end
  38.       end
  39.       update_animation(@_animation[num])
  40.     end
  41.     def loop_animation(animation)
  42.       return if animation == @_loop_animation
  43.       dispose_loop_animation
  44.       @_loop_animation = animation
  45.       return if @_loop_animation == nil
  46.       @_loop_animation_index = 0
  47.       animation_name = @_loop_animation.animation_name
  48.       animation_hue = @_loop_animation.animation_hue
  49.       bitmap = RPG::Cache.animation(animation_name, animation_hue)
  50.       if @@_reference_count.include?(bitmap)
  51.         @@_reference_count[bitmap] += 1
  52.       else
  53.         @@_reference_count[bitmap] = 1
  54.       end
  55.       @_loop_animation_sprites = []
  56.       for i in 0..15
  57.         sprite = ::Sprite.new
  58.         sprite.bitmap = bitmap
  59.         sprite.visible = false
  60.         @_loop_animation_sprites.push(sprite)
  61.       end
  62.       # update_loop_animation
  63.     end
  64.     def dispose_animation
  65.       for anime in @_animation.reverse
  66.         sprite = anime[3][0]
  67.         if sprite != nil
  68.           @@_reference_count[sprite.bitmap] -= 1
  69.           if @@_reference_count[sprite.bitmap] == 0
  70.             sprite.bitmap.dispose
  71.           end
  72.         end
  73.         for sprite in anime[3]
  74.           sprite.dispose
  75.         end
  76.         @_animation.delete(anime)
  77.       end
  78.     end
  79.    
  80.     def update
  81.       super
  82.       if @_whiten_duration > 0
  83.         @_whiten_duration -= 1
  84.         self.color.alpha = 128 - (16 - @_whiten_duration) * 10
  85.       end
  86.       if @_appear_duration > 0
  87.         @_appear_duration -= 1
  88.         self.opacity = (16 - @_appear_duration) * 16
  89.       end
  90.       if @_escape_duration > 0
  91.         @_escape_duration -= 1
  92.         self.opacity = 256 - (32 - @_escape_duration) * 10
  93.       end
  94.       if @_collapse_duration > 0
  95.         @_collapse_duration -= 1
  96.         self.opacity = 256 - (48 - @_collapse_duration) * 6
  97.       end
  98.       if @_damage_duration > 0
  99.         @_damage_duration -= 1
  100.         case @_damage_duration
  101.         when 38..39
  102.           @_damage_sprite.y -= 4
  103.         when 36..37
  104.           @_damage_sprite.y -= 2
  105.         when 34..35
  106.           @_damage_sprite.y += 2
  107.         when 28..33
  108.           @_damage_sprite.y += 4
  109.         end
  110.         @_damage_sprite.opacity = 256 - (12 - @_damage_duration) * 32
  111.         if @_damage_duration == 0
  112.           dispose_damage
  113.         end
  114.       end
  115.       for anime in @_animation
  116.         if (Graphics.frame_count % 2 == 0)
  117.           anime[2] -= 1
  118.           update_animation(anime)
  119.         end
  120.       end
  121.       if @_loop_animation != nil and (Graphics.frame_count % 2 == 0)
  122.         update_loop_animation
  123.         @_loop_animation_index += 1
  124.         @_loop_animation_index %= @_loop_animation.frame_max
  125.       end
  126.       if @_blink
  127.         @_blink_count = (@_blink_count + 1) % 32
  128.         if @_blink_count < 16
  129.           alpha = (16 - @_blink_count) * 6
  130.         else
  131.           alpha = (@_blink_count - 16) * 6
  132.         end
  133.         self.color.set(255, 255, 255, alpha)
  134.       end
  135.       @@_animations.clear
  136.     end

  137.     def update_animation(anime)
  138.       if anime[2] > 0
  139.         frame_index = anime[0].frame_max - anime[2]
  140.         cell_data = anime[0].frames[frame_index].cell_data
  141.         position = anime[0].position
  142.         animation_set_sprites(anime[3], cell_data, position)
  143.         for timing in anime[0].timings
  144.           if timing.frame == frame_index
  145.             animation_process_timing(timing, anime[1])
  146.           end
  147.         end
  148.       else
  149.         @@_reference_count[anime[3][0].bitmap] -= 1
  150.         if @@_reference_count[anime[3][0].bitmap] == 0
  151.             anime[3][0].bitmap.dispose
  152.         end
  153.         for sprite in anime[3]
  154.           sprite.dispose
  155.         end
  156.         @_animation.delete(anime)
  157.       end
  158.     end
  159.     def animation_set_sprites(sprites, cell_data, position)
  160.       for i in 0..15
  161.         sprite = sprites[i]
  162.         pattern = cell_data[i, 0]
  163.         if sprite == nil or pattern == nil or pattern == -1
  164.           sprite.visible = false if sprite != nil
  165.           next
  166.         end
  167.         sprite.visible = true
  168.         sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
  169.         if position == 3
  170.           if self.viewport != nil
  171.             sprite.x = self.viewport.rect.width / 2
  172.             if $game_temp.in_battle and self.battler.is_a?(Game_Enemy)
  173.               sprite.y = self.viewport.rect.height - 320
  174.             else
  175.               sprite.y = self.viewport.rect.height - 160
  176.             end
  177.           else
  178.             sprite.x = 320
  179.             sprite.y = 240
  180.           end
  181.         else
  182.           sprite.x = self.x + self.viewport.rect.x -
  183.                       self.ox + self.src_rect.width / 2
  184.           if $game_temp.in_battle and self.battler.is_a?(Game_Enemy)
  185.             sprite.y = self.y - self.oy * self.zoom_y / 2 +
  186.                         self.viewport.rect.y
  187.             if position == 0
  188.               sprite.y -= self.src_rect.height * self.zoom_y / 4
  189.             elsif position == 2
  190.               sprite.y += self.src_rect.height * self.zoom_y / 4
  191.             end
  192.           else
  193.             sprite.y = self.y + self.viewport.rect.y -
  194.                         self.oy + self.src_rect.height / 2
  195.             sprite.y -= self.src_rect.height / 4 if position == 0
  196.             sprite.y += self.src_rect.height / 4 if position == 2
  197.           end
  198.         end
  199.         sprite.x += cell_data[i, 1]
  200.         sprite.y += cell_data[i, 2]
  201.         sprite.z = 2000
  202.         sprite.ox = 96
  203.         sprite.oy = 96
  204.         sprite.zoom_x = cell_data[i, 3] / 100.0
  205.         sprite.zoom_y = cell_data[i, 3] / 100.0
  206.         if position != 3
  207.           sprite.zoom_x *= self.zoom_x
  208.           sprite.zoom_y *= self.zoom_y
  209.         end
  210.         sprite.angle = cell_data[i, 4]
  211.         sprite.mirror = (cell_data[i, 5] == 1)
  212.         sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
  213.         sprite.blend_type = cell_data[i, 7]
  214.       end
  215.     end
  216.   end
  217. end
复制代码

显示伤害
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================
  4. #
  5. # 使用方法:
  6. #
  7. # ★、对角色显示伤害,如下3步:
  8. #
  9. # 1、设置伤害内容:$game_player.damage = 数值
  10. #    注意:如果数值是负数,就变成补血的颜色了。
  11. #
  12. # 2、设置是否会心一击:$game_player.critical = true/false
  13. #    如果不是会心一击,就不用这一步了
  14. #$game_player.damage = 数值
  15. # 3、释放伤害:$game_player.damage_pop = true
  16. #
  17. #
  18. # ★、对普通NPC和事件进行伤害,类似的3步:
  19. #
  20. # 1、设置伤害内容:$game_map.events[事件编号].damage = 数值
  21. #
  22. # 2、设置是否会心一击:$game_map.events[事件编号].critical = true/false
  23. #
  24. # 3、释放伤害:$game_map.events[事件编号].damage_pop = true
  25. #
  26. # 注意,事件编号是事件的ID号,如果目标是“本事件”,那么在事件编号输入@event_id
  27. #
  28. #------------------------------------------------------------------------------
  29. # 预祝有人能早日做出华丽的ARPG来,别忘了到网站发布哦~
  30. #------------------------------------------------------------------------------
  31. class Sprite_Character < RPG::Sprite
  32.   alias carol3_66RPG_damage_pop_update update
  33.   def update
  34.     carol3_66RPG_damage_pop_update
  35.     if @character.damage_pop
  36.       damage(@character.damage, @character.critical)
  37.       @character.damage = nil
  38.       @character.critical = false
  39.       @character.damage_pop = false
  40.     end
  41.     #------------------------------
  42.     # 动画 ID 与当前的情况有差异的情况下
  43.     if @character.damage == nil and
  44.        @character.state_animation_id != @state_animation_id
  45.       @state_animation_id = @character.state_animation_id
  46.       loop_animation($data_animations[@state_animation_id])
  47.     end
  48.    
  49.     #collapse
  50.     # 明灭
  51.     if @character.blink
  52.       blink_on
  53.     else
  54.       blink_off
  55.     end
  56.     # 白色闪烁
  57.     if @character.white_flash
  58.       whiten
  59.       @character.white_flash = false
  60.     end
  61.     # 死亡
  62.     if @character.dead
  63.       collapse
  64.       @character.dead = false
  65.     end
  66.     #------------------------------
  67.   end  
  68. end
  69. class Game_Character
  70.   attr_accessor :damage_pop
  71.   attr_accessor :damage
  72.   attr_accessor :critical
  73.   attr_accessor :white_flash              # 白色屏幕闪烁标志
  74.   attr_accessor :blink                    # 闪烁标志
  75.   attr_accessor :dead                     # 死亡消失标志
  76.   attr_accessor :state_animation_id       # 状态动画ID
  77.   alias carol3_66RPG_damage_pop_initialize initialize
  78.   def initialize
  79.     @damage_pop = false
  80.     @damage = nil
  81.     @critical = false
  82.     carol3_66RPG_damage_pop_initialize
  83.     @white_flash = false
  84.     @blink = false
  85.     @dead = false
  86.   end
  87. end

  88. #==============================================================================
  89. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  90. #==============================================================================
复制代码

彩虹

  1. =begin
  2. ==============================================================================

  3. 彩虹神剑(伤害分段显示)显示总伤害版 v1.0d

  4. ==============================================================================

  5. 彩虹神剑 -柳柳

  6. 6-20-2006 v1.0 -叶子
  7. 在彩虹神剑的基础上增加了显示总伤害的功能,而且总伤害的数字是弹出伤害时逐渐增加的

  8. v1.0a -叶子
  9. 修正了显示伤害和实际伤害有差别的问题
  10. 修正了miss的情况下显示miss混乱的问题
  11. 修正了对己方技能重复显示伤害的问题
  12. 未修正播放目标动画第一帧时目标有时无端跳动的BUG

  13. v1.0b -叶子
  14. 修改了总伤害数字的位置和z坐标
  15. 未修正播放目标动画第一帧时目标有时无端跳动的BUG

  16. v1.0c -柳柳
  17. ? ? ?

  18. v1.0d -柳柳
  19. 1.0d最终解决了那个闪光问题,还有最末帧伤害多次的算法

  20. 7-24-2006 v1.0e -叶子
  21. 修正全屏幕闪烁弹出伤害错误的问题
  22. 修正连续伤害不会弹出伤害的问题
  23. 仍然未修正播放目标动画第一帧时目标有时无端跳动的BUG

  24. 我鼓起很大勇气才敢动偶像们的脚本的,不知道会不会出问题啊......  -cftx
  25. 修正了总伤害显示
  26. 增加了伤害美化和HIT数显示
  27. 修正了两次音效

  28. ==============================================================================
  29. =end
  30. # 核心的说明:
  31. # damage_pop 不再附带damage()的功能,这个放到animation里面去了

  32. module RPG
  33. #--------------------------------------------------------------------------
  34. # ● 常量设定
  35. #--------------------------------------------------------------------------
  36. # 是否显示总伤害
  37. SHOW_TOTAL_DAMAGE = true
  38. # 角色受攻击时是否跳一下
  39. BATTLER_JUMP = false
  40. # 连续伤害的动画ID
  41. SLIP_DAMAGE_ANIMATION_ID = 10

  42. class Sprite < ::Sprite
  43.    #==========================================
  44.    # 修改说明:
  45.    # @flash_shake用来制作挨打时候跳跃
  46.    # @_damage    用来记录每次打击之后弹出数字
  47.    # @_total_damage 记录总伤害
  48.    # @_total_damage_duration 总伤害持续帧
  49.    #==========================================
  50.    #alias 66RPG_rainbow_initialize : initialize
  51.    
  52.    def initialize(viewport = nil)
  53.      #66RPG_rainbow_initialize(viewport)
  54.      super(viewport)
  55.      @_whiten_duration = 0
  56.      @_appear_duration = 0
  57.      @_escape_duration = 0
  58.      @_collapse_duration = 0
  59.      @_damage_duration = 0
  60.      @_animation_duration = 0
  61.      @_blink = false
  62.      # 挨打时候跳跃
  63.      @flash_shake = 0
  64.      # 伤害记录数组
  65.      @_damage = []
  66.      # 总伤害数字
  67.      @_total_damage = 0
  68.      # 总伤害持续帧
  69.      @_total_damage_duration = 0
  70.      #记录已经发生的伤害的变量★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  71.      @p_dam=0
  72.      @hits=0
  73.    end
  74. #美化的伤害处理★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  75. def damage(value, critical)
  76.       # 释放伤害,效果是伤害数字快速消失,觉得不如不消失好看......
  77.       #dispose_damage
  78.       #清除hit数
  79.       dispose_hit
  80.       # 如果伤害值是数值
  81.       if value.is_a?(Numeric)
  82.         # 绝对值转为字符串
  83.         damage_string = value.abs.to_s
  84.       else
  85.         # 转为字符串
  86.         damage_string = value.to_s
  87.       end
  88.       # 初始化位图
  89.       bitmap = Bitmap.new(162, 64)
  90.       bitmap.font.name = ["黑体","华文行楷", "宋体"]
  91.       bitmap.font.size = 32
  92.       # 伤害值是数值的情况下
  93.       if value.is_a?(Numeric)
  94.         # 分割伤害值字符串
  95.         damage_array = damage_string.scan(/./)
  96.         damage_x = 81 - damage_string.size * 9
  97.         # 伤害值为负的情况下
  98.         if value < 0
  99.           # 调用回复数字表
  100.           rect_y = 32
  101.         else
  102.           # 调用伤害数字表
  103.           rect_y = 0
  104.         end
  105.         # 循环伤害值字符串
  106.         for char in damage_array
  107.           number = char.to_i
  108.           # 显示伤害数字
  109.           bitmap.blt(damage_x, 32, RPG::Cache.picture("Damage"),
  110.           Rect.new(number * 18, rect_y, 18, 32))
  111.           # 后移一位
  112.           damage_x += 18
  113.         end
  114.       # 伤害值不是数值的情况
  115.       else
  116.         if $game_variables[6] <= $game_variables[5]
  117.           # 系统默认描画字符串
  118.           bitmap.font.color.set(0, 0, 0)
  119.           bitmap.draw_text(-1, 27, 162, 36, damage_string, 1)
  120.           bitmap.draw_text(+1, 27, 162, 36, damage_string, 1)
  121.           bitmap.draw_text(-1, 29, 162, 36, damage_string, 1)
  122.           bitmap.draw_text(+1, 29, 162, 36, damage_string, 1)
  123.           bitmap.font.color.set(255, 255, 255)
  124.           bitmap.draw_text(0, 28, 162, 36, damage_string, 1)
  125.         # Miss 的情况下
  126.         else
  127.           # 显示未击中图画
  128.           bitmap.blt(36, 28, RPG::Cache.picture("Damage"), Rect.new(90, 64, 90, 32))
  129.         end
  130.       end
  131.       # 会心一击标志打开的情况
  132.       if critical
  133.         # 显示会心一击图画
  134.         bitmap.blt(36, 0, RPG::Cache.picture("Damage"), Rect.new(0, 64, 90, 32))
  135.       end
  136.       # 伤害值定位
  137.       @_damage_sprite = ::Sprite.new(self.viewport)
  138.       @_damage_sprite.bitmap = bitmap
  139.       @_damage_sprite.ox = 81
  140.       @_damage_sprite.oy = 20
  141.       @_damage_sprite.x = self.x
  142.       @_damage_sprite.y = self.y - self.oy / 2
  143.       @_damage_sprite.z = 3000
  144.       @_damage_duration = 40
  145.       @_damage.push([@_damage_sprite,@_damage_duration-10,0, rand(30) - 15, rand(3)])
  146.       make_total_damage(value)  

  147.     end

  148. #   ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  149. # hit数的美化描绘
  150.     def hit

  151.       # 如果伤害值是数值
  152.       # 转为字符串
  153.       value=@hits
  154.         hits_string = value.to_s
  155.       # 初始化位图
  156.        bitmap = Bitmap.new(320, 64)
  157.        bitmap.font.name = "Arial Black"
  158.        bitmap.font.size = 32
  159.        # 分割伤害值字符串
  160.         hits_array = hits_string.scan(/./)
  161.         hits_x = 81 - hits_string.size * 18.1
  162.           rect_y = 0
  163.         # 循环伤害值字符串
  164.         for char in hits_array
  165.           number = char.to_i
  166.           # 显示伤害数字
  167.           bitmap.blt(hits_x, 0, RPG::Cache.picture("Number"),
  168.           Rect.new(number * 36.2, rect_y, 36.2, 50))
  169.           # 后移一位
  170.           hits_x += 36.2
  171.         end
  172.         bitmap.blt(hits_x, 0, RPG::Cache.picture("HITS"),
  173.         Rect.new(0, -21, 90, 50))

  174.       # 伤害值定位
  175.       @_hits_sprite = ::Sprite.new(self.viewport)
  176.       @_hits_sprite.bitmap = bitmap
  177.       @_hits_sprite.ox = 81
  178.       @_hits_sprite.oy = 20
  179.       @_hits_sprite.x = 300
  180.       @_hits_sprite.y = 20
  181.       @_hits_sprite.z = 3000
  182.       @_hits_duration = 40
  183.     end
  184. #--------------------------------------------------------------------------
  185.    # ● 总伤害处理
  186.    #--------------------------------------------------------------------------
  187.    def make_total_damage(value)
  188.      if value.is_a?(Numeric) and SHOW_TOTAL_DAMAGE
  189.        @_total_damage += value
  190.         # 绝对值转为字符串
  191.         damage_string = @_total_damage.abs.to_s
  192.       else
  193.         return
  194.       end
  195.       # 初始化位图
  196.       bitmap = Bitmap.new(300, 150)
  197.       bitmap.font.name = "Arial Black"
  198.       bitmap.font.size = 32
  199.       # 伤害值是数值的情况下
  200.       if value.is_a?(Numeric)
  201.         # 分割伤害值字符串
  202.         damage_array = damage_string.scan(/./)
  203.         damage_x = 40 - damage_string.size * 9
  204.         # 伤害值为负的情况下
  205.           if value < 0
  206.             name="Number3"

  207.         else
  208.           # 调用伤害数字表
  209.             name="Number2"

  210.         end

  211.         
  212.         # 循环伤害值字符串
  213.         for char in damage_array
  214.           number = char.to_i
  215.           # 显示伤害数字
  216.           bitmap.blt(damage_x, 0, RPG::Cache.picture(name),
  217.           Rect.new(number * 36.2, 0, 36.2, 50))
  218.           # 后移一位
  219.           damage_x += 36.2
  220.         end
  221.       end
  222.       
  223.       
  224.         
  225.         
  226. #     if value.is_a?(Numeric) and SHOW_TOTAL_DAMAGE
  227. #       @_total_damage += value
  228. #     else
  229. #       return
  230. #     end
  231. #     bitmap = Bitmap.new(300, 150)
  232. #     bitmap.font.name = "Arial Black"
  233. #     bitmap.font.size = 40
  234. #     bitmap.font.color.set(0, 0, 0)
  235. #     bitmap.draw_text(+2, 12+2, 160, 40, @_total_damage.abs.to_s, 1)
  236. #     if @_total_damage < 0
  237. #       bitmap.font.color.set(80, 255, 00)
  238. #    else
  239. #       bitmap.font.color.set(255, 140, 0)
  240. #     end
  241. #     bitmap.draw_text(0, 12, 160, 40, @_total_damage.abs.to_s, 1)
  242. #     bitmap.font.color.set(55, 55,255)
  243.      
  244.      
  245.      if @_total_damage_sprite.nil?
  246.        @_total_damage_sprite = ::Sprite.new(self.viewport)
  247.        @_total_damage_sprite.ox = 80
  248.        @_total_damage_sprite.oy = 20
  249.        @_total_damage_sprite.z = 3000

  250.      end
  251.      @_total_damage_sprite.bitmap = bitmap
  252.      @_total_damage_sprite.zoom_x = 0.8
  253.      @_total_damage_sprite.zoom_y = 0.8
  254.      @_total_damage_sprite.x = self.x
  255.      @_total_damage_sprite.y = self.y  - self.oy / 2 - 64
  256.      @_total_damage_sprite.z = 3001
  257.      @_total_damage_duration = 80
  258.      #hit数描绘
  259.      @hits+=1
  260.     if @_total_damage > 0
  261.       hit
  262.     end
  263.    end


  264.    def animation(animation, hit, battler_damage="", battler_critical=false)
  265.      dispose_animation      
  266.      #=======================================
  267.      # 修改:记录伤害和critical
  268.      #=======================================
  269.      @battler_damage = battler_damage
  270.      @battler_critical = battler_critical
  271.      @_animation = animation
  272.      return if @_animation == nil
  273.      @_animation_hit = hit
  274.      @_animation_duration = @_animation.frame_max
  275.      animation_name = @_animation.animation_name
  276.      animation_hue = @_animation.animation_hue
  277.      bitmap = RPG::Cache.animation(animation_name, animation_hue)
  278.      #=======================================
  279.      # 修改:计算总闪光权限值
  280.      #=======================================
  281.      for timing in @_animation.timings
  282.        quanzhong = animation_process_timing(timing, @_animation_hit,true)
  283.        @all_quanzhong += quanzhong
  284.        # 记录最后一次闪光
  285.        @_last_frame = timing.frame if quanzhong != 0
  286.      end      
  287.      if @@_reference_count.include?(bitmap)
  288.        @@_reference_count[bitmap] += 1
  289.      else
  290.        @@_reference_count[bitmap] = 1
  291.      end
  292.      #=======================================
  293.      # 修改:行动方动画不显示伤害
  294.      #=======================================
  295.      if $scene.is_a?(Scene_Battle)
  296.        if $scene.animation1_id == @battler.animation_id
  297.          @battler_damage = ""
  298.        end
  299.      end
  300.      @_animation_sprites = []
  301.      if @_animation.position != 3 or not @@_animations.include?(animation)
  302.        for i in 0..15
  303.          sprite = ::Sprite.new(self.viewport)
  304.          sprite.bitmap = bitmap
  305.          sprite.visible = false
  306.          @_animation_sprites.push(sprite)
  307.        end
  308.        unless @@_animations.include?(animation)
  309.          @@_animations.push(animation)
  310.        end
  311.      end
  312.      update_animation
  313.   end
  314.    #=======================================
  315.    # 修改:更换清除伤害的算法,以防万一
  316.    #       本内容在脚本中没有使用过
  317.    #=======================================
  318.    def dispose_damage
  319.      for damage in @_damage.reverse
  320.        damage[0].bitmap.dispose
  321.        damage[0].dispose
  322.        @_damage.delete(damage)
  323.      end
  324.      @_total_damage = 0
  325.      @_last_frame = -1
  326.      if @_total_damage_sprite != nil
  327.        @_total_damage_duration = 0
  328.        @_total_damage_sprite.bitmap.dispose
  329.        @_total_damage_sprite.dispose
  330.        @_total_damage_sprite = nil
  331.      end
  332.    end
  333.    #=======================================
  334.    # 清除hit数★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  335.    #=======================================
  336.    def dispose_hit
  337.      if @_hits_sprite != nil
  338.        @_hits_sprite.bitmap.dispose
  339.        @_hits_sprite.dispose
  340.        @_hits_sprite = nil
  341.      end
  342.    end
  343.    def dispose_animation
  344.      #=======================================
  345.      # 修改:清除记录的伤害,清除权重记录
  346.      #=======================================
  347.      @battler_damage = nil
  348.      @battler_critical = nil
  349.      @all_quanzhong = 1
  350.      @_total_damage = 0
  351.      @_last_frame = -1
  352.      if @_animation_sprites != nil
  353.        sprite = @_animation_sprites[0]
  354.        if sprite != nil
  355.          @@_reference_count[sprite.bitmap] -= 1
  356.          if @@_reference_count[sprite.bitmap] == 0
  357.            sprite.bitmap.dispose
  358.          end
  359.        end
  360.        for sprite in @_animation_sprites
  361.          sprite.dispose
  362.        end
  363.        @_animation_sprites = nil
  364.        @_animation = nil
  365.      end
  366.    end
  367.    def update
  368.      super
  369.      if @_whiten_duration > 0
  370.        @_whiten_duration -= 1
  371.        self.color.alpha = 128 - (16 - @_whiten_duration) * 10
  372.      end
  373.      if @_appear_duration > 0
  374.        @_appear_duration -= 1
  375.        self.opacity = (16 - @_appear_duration) * 16
  376.      end
  377.      if @_escape_duration > 0
  378.        @_escape_duration -= 1
  379.        self.opacity = 256 - (32 - @_escape_duration) * 10
  380.      end
  381.      if @_collapse_duration > 0
  382.        @_collapse_duration -= 1
  383.        self.opacity = 256 - (48 - @_collapse_duration) * 6
  384.      end
  385.      #=======================================
  386.      # 修改:更新算法,更新弹出
  387.      #=======================================
  388.      if @_damage_duration > 0
  389.        @_damage_duration -= 1
  390.        for damage in @_damage
  391.          damage[0].x = self.x + self.viewport.rect.x
  392.          damage[0].y -= 3
  393.          damage[0].opacity = damage[1]*20
  394.          damage[1] -= 1
  395.          if damage[1]==0
  396.            damage[0].bitmap.dispose
  397.            damage[0].dispose
  398.            @_damage.delete(damage)

  399.            next
  400.          end
  401.        end
  402.      end
  403.      #=======================================
  404.      # 添加:弹出总伤害
  405.      #=======================================
  406.      if @_total_damage_duration > 0
  407.        @_total_damage_duration -= 1
  408.        @_total_damage_sprite.y -= 1 if @_total_damage_duration % 2 == 0
  409.        if @_total_damage_sprite.zoom_x > 1.0
  410.          @_total_damage_sprite.zoom_x -= 0.05
  411.        end
  412.        if @_total_damage_sprite.zoom_y > 1.0
  413.          @_total_damage_sprite.zoom_y -= 0.05
  414.        end
  415.        @_total_damage_sprite.opacity = 256 - (24 - @_total_damage_duration) * 16
  416.        if @_total_damage_duration <= 0
  417.          dispose_hit#★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  418.          @_total_damage = 0
  419.          @_total_damage_duration = 0
  420.          @_total_damage_sprite.bitmap.dispose
  421.          @_total_damage_sprite.dispose
  422.          @_total_damage_sprite = nil
  423.        end
  424.      end
  425.      #=======================================
  426.      if @_animation != nil and (Graphics.frame_count % 2 == 0)
  427.        @_animation_duration -= 1
  428.        update_animation
  429.      end
  430.      if @_loop_animation != nil and (Graphics.frame_count % 2 == 0)
  431.        update_loop_animation
  432.        @_loop_animation_index += 1
  433.        @_loop_animation_index %= @_loop_animation.frame_max
  434.      end
  435.      if @_blink
  436.        @_blink_count = (@_blink_count + 1) % 32
  437.        if @_blink_count < 16
  438.          alpha = (16 - @_blink_count) * 6
  439.        else
  440.          alpha = (@_blink_count - 16) * 6
  441.        end
  442.        self.color.set(255, 255, 255, alpha)
  443.      end
  444.      @@_animations.clear
  445.    end
  446.    def update_animation
  447.     if @_animation_duration > 0
  448.        frame_index = @_animation.frame_max - @_animation_duration
  449.        cell_data = @_animation.frames[frame_index].cell_data
  450.        position = @_animation.position
  451.        animation_set_sprites(@_animation_sprites, cell_data, position)
  452.        #=======================================
  453.        # 修改:弹出伤害,权重计算
  454.        #=======================================
  455.        for timing in @_animation.timings
  456.          if timing.frame == frame_index
  457.            t = 1.0 * animation_process_timing(timing, @_animation_hit)  
  458.                    if timing.se.name != ""
  459.           se=timing.se
  460.           Audio.se_play("Audio/SE/" + se.name, se.volume, se.pitch)
  461.         end
  462.            #p t,"当前权重", @all_quanzhong,"总权重"
  463.            if @battler_damage.is_a?(Numeric) and t != 0
  464.              t *= @battler_damage
  465.              t /= @all_quanzhong
  466.              t = t.to_i
  467.              #在闪光不是最后一次的情况下,把这次伤害加入到已经发生的伤害中★★★★★★★★★★★★★★★★★★★★★★★★★★
  468.              if frame_index != @_last_frame
  469.              @p_dam+= t
  470.              end
  471.              #p @p_dam,"已发生伤害",@battler_damage,"总伤害"(调试用)★★★★★★★★★★★★★★★★★★★★★★★★★★
  472.              #闪光为最后一次的情况下,改变这次伤害的计算方法(总伤害-已经发生伤害)★★★★★★★★★★★★★★★★★★★★★★★★★★
  473.              if frame_index == @_last_frame
  474.                t=@battler_damage-@p_dam
  475.              end
  476.              #p t,"当前伤害",@battler_damage,"总伤害"
  477.              # 最后一次闪光的话,伤害修正
  478.              if frame_index == @_last_frame
  479.                @_total_damage = @battler_damage - t
  480.                @p_dam=0      #已经发生的伤害归0★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  481.             end
  482.              #p t,@battler_damage,@all_quanzhong
  483.              damage(t,@battler_critical)
  484.             #连击次数归0★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  485.             if frame_index == @_last_frame
  486.                       @hits=0  
  487.             end
  488.            # 防止重复播放miss
  489.            elsif !@battler_damage.is_a?(Numeric) and timing.flash_scope != 0
  490.              damage(@battler_damage,@battler_critical)
  491.            end
  492.          end
  493.        end
  494.      else
  495.        dispose_animation
  496.      end
  497.    end
  498.    #=======================================
  499.    # 修改:敌人跳跃的功能 + 添加返回数值
  500.    #=======================================
  501.     def animation_process_timing(timing, hit,dontflash=false)
  502.       if (timing.condition == 0) or
  503.          (timing.condition == 1 and hit == true) or
  504.          (timing.condition == 2 and hit == false)
  505.         case timing.flash_scope
  506.         when 1
  507.           unless dontflash
  508.             self.flash(timing.flash_color, timing.flash_duration * 2)
  509.             if @_total_damage >0
  510.               @flash_shake_switch = true
  511.               @flash_shake = 10
  512.             end
  513.           end
  514.           return timing.flash_color.alpha * timing.flash_duration
  515.         when 2
  516.           unless dontflash
  517.             if self.viewport != nil
  518.               self.viewport.flash(timing.flash_color, timing.flash_duration * 2)
  519.             end
  520.           end
  521.           return timing.flash_color.alpha * timing.flash_duration
  522.         when 3
  523.           unless dontflash
  524.             self.flash(nil, timing.flash_duration * 2)
  525.           end
  526.           return timing.flash_color.alpha * timing.flash_duration
  527.         end
  528.       end      
  529.       return 0
  530.     end   
  531. end
  532. end
  533. #==============================================================================
  534. # ■ Sprite_Battler
  535. #==============================================================================
  536. class Sprite_Battler < RPG::Sprite
  537. #--------------------------------------------------------------------------
  538. # ● 初始化对像
  539. #    添加跳跃记录
  540. #--------------------------------------------------------------------------
  541. def initialize(viewport, battler = nil)
  542.   super(viewport)
  543.   @battler = battler
  544.   @battler_visible = false
  545.   @flash_shake_switch = true
  546. end
  547. #--------------------------------------------------------------------------
  548. # ● 刷新画面
  549. #    增添跳跃功能
  550. #--------------------------------------------------------------------------
  551. def update
  552.   super
  553.   # 战斗者为 nil 的情况下
  554.   if @battler == nil
  555.     self.bitmap = nil
  556.     loop_animation(nil)
  557.     return
  558.   end
  559.   # 文件名和色相与当前情况有差异的情况下
  560.   if @battler.battler_name != @battler_name or
  561.      @battler.battler_hue != @battler_hue
  562.     # 获取、设置位图
  563.     @battler_name = @battler.battler_name
  564.     @battler_hue = @battler.battler_hue
  565.     self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
  566.     @width = bitmap.width
  567.     @height = bitmap.height
  568.     self.ox = @width / 2
  569.     self.oy = @height
  570.     # 如果是战斗不能或者是隐藏状态就把透明度设置成 0
  571.     if @battler.dead? or @battler.hidden
  572.       self.opacity = 0
  573.     end
  574.   end
  575.   # 动画 ID 与当前的情况有差异的情况下
  576.   if @battler.damage == nil and
  577.      @battler.state_animation_id != @state_animation_id
  578.     @state_animation_id = @battler.state_animation_id
  579.     loop_animation($data_animations[@state_animation_id])
  580.   end
  581.   # 应该被显示的角色的情况下
  582.   if @battler.is_a?(Game_Actor) and @battler_visible
  583.     # 不是主状态的时候稍稍降低点透明度
  584.     if $game_temp.battle_main_phase
  585.       self.opacity += 3 if self.opacity < 255
  586.     else
  587.       self.opacity -= 3 if self.opacity > 207
  588.     end
  589.   end
  590.   # 明灭
  591.   if @battler.blink
  592.     blink_on
  593.   else
  594.     blink_off
  595.   end
  596.   # 不可见的情况下
  597.   unless @battler_visible
  598.     # 出现
  599.     if not @battler.hidden and not @battler.dead? and
  600.        (@battler.damage == nil or @battler.damage_pop)
  601.       appear
  602.       @battler_visible = true
  603.     end
  604.   end
  605.   # 可见的情况下
  606.   if @battler_visible
  607.     # 逃跑
  608.     if @battler.hidden
  609.       $game_system.se_play($data_system.escape_se)
  610.       escape
  611.       @battler_visible = false
  612.     end
  613.     # 白色闪烁
  614.     if @battler.white_flash
  615.       whiten
  616.       @battler.white_flash = false
  617.     end
  618.     # 动画
  619.     if @battler.animation_id != 0
  620.       animation = $data_animations[@battler.animation_id]
  621.       animation(animation, @battler.animation_hit,@battler.damage, @battler.critical)
  622.       @battler.animation_id = 0
  623.     end
  624.     # 伤害
  625.     if @battler.damage_pop
  626.       @battler.damage = nil
  627.       @battler.critical = false
  628.       @battler.damage_pop = false
  629.     end
  630.     # korapusu
  631.     if @battler.damage == nil and @battler.dead?
  632.       if @battler.is_a?(Game_Enemy)
  633.         $game_system.se_play($data_system.enemy_collapse_se)
  634.       else
  635.         $game_system.se_play($data_system.actor_collapse_se)
  636.       end
  637.       collapse
  638.       @battler_visible = false
  639.     end
  640.   end
  641.   # 设置活动块的坐标
  642.   if @flash_shake_switch == true
  643.     self.x = @battler.screen_x
  644.     self.y = @battler.screen_y
  645.     self.z = @battler.screen_z
  646.     @flash_shake_switch = false
  647.   end
  648.   if @flash_shake != 0 and @battler.damage != nil and RPG::BATTLER_JUMP
  649.     case @flash_shake
  650.     when 9..10
  651.       self.x = @battler.screen_x
  652.       self.y -=4
  653.       self.z = @battler.screen_z
  654.     when 6..8
  655.       self.x = @battler.screen_x
  656.       self.y -=2
  657.       self.z = @battler.screen_z
  658.     when 3..5
  659.       self.x = @battler.screen_x
  660.       self.y +=2
  661.       self.z = @battler.screen_z
  662.     when 2
  663.       self.x = @battler.screen_x
  664.       self.y += 4
  665.       self.z = @battler.screen_z
  666.     when 1
  667.       self.x = @battler.screen_x
  668.       self.y = @battler.screen_y
  669.       self.z = @battler.screen_z
  670.     end
  671.     @flash_shake -= 1
  672.   end
  673. end
  674. end

  675. #==============================================================================
  676. # ■ Scene_Battle
  677. #------------------------------------------------------------------------------
  678. #  处理战斗画面的类。
  679. #==============================================================================

  680. class Scene_Battle
  681. #--------------------------------------------------------------------------
  682. # ● 定义实例变量
  683. #--------------------------------------------------------------------------
  684. attr_reader   :animation1_id                    # 行动方动画ID
  685. end

  686. #==============================================================================
  687. # ■ Game_Battler
  688. #------------------------------------------------------------------------------
  689. #  处理战斗者的类。这个类作为 Game_Actor 类与 Game_Enemy 类的
  690. # 超级类来使用。
  691. #==============================================================================

  692. #class Game_Battler
  693. #  #--------------------------------------------------------------------------
  694. #  # ● 应用连续伤害效果
  695. #  #--------------------------------------------------------------------------
  696. #  alias rainbow_sword_slip_damage_effect slip_damage_effect
  697. #  def slip_damage_effect
  698. #    self.animation_id = RPG::SLIP_DAMAGE_ANIMATION_ID
  699. #    self.animation_hit = true
  700. #    rainbow_sword_slip_damage_effect
  701. #  end
  702. #end
复制代码
群:13283861

Lv2.观梦者

梦石
0
星屑
270
在线时间
1373 小时
注册时间
2005-10-16
帖子
5113

贵宾

3
发表于 2007-7-29 14:53:24 | 只看该作者
你的提问我感觉看着很费解。。。。。。

以下引用冰鸷殛霰于2007-7-29 6:40:06的发言:
魔法重叠!!!!!!!!!
就是柳柳以前写的那个
有bug
要与damage无冲突的.
地图上显示伤害无冲突的!!!!!!!!!!!

1、“魔法重叠”是何物?脚本?请给出链接地址。
2、“有bug”。啥bug?你不说我怎么知道?
3、“与damage无冲突”。damage又是什么?  -v-

如此看来,请尽快编辑帖子吧
我只个搬答案的
叔叔我已经当爹了~
婚后闪人了……
回复 支持 反对

使用道具 举报

Lv1.梦旅人

66RPG站长

梦石
0
星屑
54
在线时间
615 小时
注册时间
2005-10-10
帖子
5734

RMVX自由创作大赛亚军第2届短篇游戏比赛亚军第5届短篇游戏比赛冠军

4
发表于 2007-7-30 16:10:35 | 只看该作者
以下引用冰鸷殛霰于2007-7-29 6:40:06的发言:
魔法重叠!!!!!!!!!
就是柳柳以前改写的那个
地图上显示伤害无冲突的!!!!!!!!!!!
和彩虹神剑无冲突!!!!!!!!!

湖里糊涂的解决了2地图上显示伤害和一个事件上显示多个动画的问题
可是彩虹神剑和一个事件上显示多个动画不能同时使用
彩虹放在一个事件上显示多个动画上面的话342行出错

彩虹放下面的话.一个事件上显示多个动画又没用了.


那么多惊叹句还是让人不知道楼主到底在说什么,你糊里糊涂解决了什么?主题贴里面还有错别字,未达本区规范,转移自由提问区吧。

请楼主发帖时一定要注意:你没有说的内容我们一定是不知道的。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
55
在线时间
9 小时
注册时间
2006-4-26
帖子
444
5
 楼主| 发表于 2007-7-30 16:26:27 | 只看该作者
以下引用柳柳于2007-7-30 8:10:35的发言:
那么多惊叹句还是让人不知道楼主到底在说什么,你糊里糊涂解决了什么?主题贴里面还有错别字,未达本区规范,转移自由提问区吧。

请楼主发帖时一定要注意:你没有说的内容我们一定是不知道的。

这下可以了?
群:13283861
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
55
在线时间
9 小时
注册时间
2006-4-26
帖子
444
6
 楼主| 发表于 2007-8-2 15:41:39 | 只看该作者
自顶贴
这个对ARPG游戏很重要
群:13283861
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
55
在线时间
9 小时
注册时间
2006-4-26
帖子
444
7
 楼主| 发表于 2007-8-13 01:40:42 | 只看该作者
自顶贴
这个对ARPG游戏真的很重要

我认为我说得很清楚了哇.......{/gg}
群:13283861
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-28 11:42

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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