Project1

标题: 游戏战斗动画与伤害显示的顺序如何修正 [打印本页]

作者: pan2003abc    时间: 2008-8-2 01:28
标题: 游戏战斗动画与伤害显示的顺序如何修正
个人脚本高手们,我想请问大家一个问题,在游戏里战斗的时候,出一个绝招,几乎是攻击方动画,受攻击方动画,受攻击方伤害数字显示同时出现。这样使得往往动画还没显示完,伤害显示已经出现了。如果人一多的话更加混乱,往往几秒钟全部角色的动画就都显示完了。
请问个位高手,能够不能通过对脚本“最小限度”的修改,使得顺序变为先显示出招方动画,显示完出招方动画后,再显示挨打方动画,挨打一方动画显示完后才显示伤害值弹出数字。
我并没有采用主战上介绍的半即时制战斗脚本,也不希望采用那种方式,希望各位脚本高手帮我解决这个问题,谢谢各位!!!最好是能尽量少的改动脚本!我一定在第一时间认可答案,谢谢! [LINE]1,#dddddd[/LINE]此贴于 2008-8-4 2:21:43 被版主darkten提醒,请楼主看到后对本贴做出回应。 [LINE]1,#dddddd[/LINE]版务信息:版主帮忙结贴~
作者: IamI    时间: 2008-8-2 01:40
通过把这里的8加大或许可以延后伤害弹出
http://rpg.blue/web/htm/news599.htm
作者: dbshy    时间: 2008-8-2 01:51
LZ用的什么战斗系统

另看了那个链接
Sailcat大,太佩服了...


作者: pan2003abc    时间: 2008-8-2 01:55
我的战斗系统没有修改,是最初默认的系统,只是改成了横板罢了
作者: pan2003abc    时间: 2008-8-2 01:59
IamI前辈,谢谢您的指点,但是您说的这个方法怕是不行,因为打击动画的长度是不一样的,普通攻击和大绝招的动画甚至能差上60~70桢。都等待一样的时间显然是不太现实的。
作者: IamI    时间: 2008-8-2 02:06
我就不相信了= =
    @wait_count = $data_animations[@animation2_id].frame_max + 2
后面那个+2随便改
(小声的说,八成是直接弹错……)
作者: pan2003abc    时间: 2008-8-2 02:09
什么意思?没有听明白
作者: pan2003abc    时间: 2008-8-2 02:11
只能用这种办法吗?难道不能改成现实完打击动画再现实伤害值吗?如果不能,为什么那个主站
上的即时制战斗系统里是这样的呢?他是怎么实现的呢?
作者: pan2003abc    时间: 2008-8-2 02:47
拜托!帮帮忙啊!
作者: 灯笼菜刀王    时间: 2008-8-2 03:57
理解不能...

如果什么战斗系统都没加,也就是单纯的改坐标,默认的战斗系统也都是动画完了才显示伤害...

2楼给的那个链接更是说明这点,
这个计数的真正作用,是在显示完打击动画以后,等待8帧(0.4秒)再弹出伤害值。
这样,不论你的动画有多长,得,显示完以后一律得等上0.4秒才能看到伤害。


感觉楼主说的是和这个相反的= =... [LINE]1,#dddddd[/LINE]系统信息:本贴由本区版主认可为正确答案,66RPG感谢您的热情解答~
作者: nasa123    时间: 2008-8-2 04:02
提示: 作者被禁止或删除 内容自动屏蔽
作者: pan2003abc    时间: 2008-8-2 05:33
可是我没用啊
作者: pan2003abc    时间: 2008-8-2 05:33
我只好去看看这断脚本还在吗
作者: pan2003abc    时间: 2008-8-2 05:37
各位前辈,我看了一下我游戏的脚本,我好加了一个叫做module RPG的脚本,这个脚本就是从66主站上下的,各位能告诉我这段脚本到底干什么用的吗?是不是影响了我说的这个问题?
#--------------------------------------------------
# 此脚本来自www.66RPG.com,使用请保留此信息
#--------------------------------------------------
module RPG
  class Sprite < ::Sprite
    def initialize(viewport = nil)
      super(viewport)
      @_whiten_duration = 0
      @_appear_duration = 0
      @_escape_duration = 0
      @_collapse_duration = 0
      @_damage_duration = 0
      @_damage = []
      @_animation_duration = 0
      @_blink = false
      @_animation = []
    end
    def damage(value, critical, type = 0)
      if value.is_a?(Numeric)
        damage_string = value.abs.to_s
      else
        damage_string = value.to_s
      end
      bitmap = Bitmap.new(160, 48)
      bitmap.font.name = "Arial Black"
      bitmap.font.size = 32
      bitmap.font.color.set(0, 0, 0)
      bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
      bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
      bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
      bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)
      if value.is_a?(Numeric) and value < 0
        if type == 0
          bitmap.font.color.set(176, 255, 144)
        else
          bitmap.font.color.set(176, 144, 255)
        end
      else
        if type == 0
          bitmap.font.color.set(255, 255, 255)
        else
          bitmap.font.color.set(255, 176, 144)
        end
      end
      if type == 2
        bitmap.font.color.set(255, 224, 128)
      end
      bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
      if critical
        string = "CRITICAL"
        bitmap.font.size = 20
        bitmap.font.color.set(0, 0, 0)
        bitmap.draw_text(-1, -1, 160, 20, string, 1)
        bitmap.draw_text(+1, -1, 160, 20, string, 1)
        bitmap.draw_text(-1, +1, 160, 20, string, 1)
        bitmap.draw_text(+1, +1, 160, 20, string, 1)
        bitmap.font.color.set(255, 255, 255)
        bitmap.draw_text(0, 0, 160, 20, string, 1)
      end
      num = @_damage.size
      if type != 2
        @_damage.push([::Sprite.new, 40, 0, rand(40) - 20, rand(30) + 50])
      else
        @_damage.push([::Sprite.new, 40, 0, rand(20) - 10, rand(20) + 60])
      end
      @_damage[num][0].bitmap = bitmap
      @_damage[num][0].ox = 80 + self.viewport.ox
      @_damage[num][0].oy = 20 + self.viewport.oy
      if self.battler.is_a?(Game_Actor)
        @_damage[num][0].x = self.x
        @_damage[num][0].y = self.y - self.oy / 2
      else
        @_damage[num][0].x = self.x + self.viewport.rect.x -
                            self.ox + self.src_rect.width / 2
        @_damage[num][0].y = self.y - self.oy * self.zoom_y / 2 +
                            self.viewport.rect.y
        @_damage[num][0].zoom_x = self.zoom_x
        @_damage[num][0].zoom_y = self.zoom_y
        @_damage[num][0].z = 3000
      end
    end
    def animation(animation, hit)
      return if animation == nil
      num = @_animation.size
      @_animation.push([animation, hit, animation.frame_max, []])
      bitmap = RPG::Cache.animation(animation.animation_name,
                                    animation.animation_hue)
      if @@_reference_count.include?(bitmap)
        @@_reference_count[bitmap] += 1
      else
        @@_reference_count[bitmap] = 1
      end
      if @_animation[num][0] != 3 or not @@_animations.include?(animation)
        for i in 0..15
          sprite = ::Sprite.new
          sprite.bitmap = bitmap
          sprite.visible = false
          @_animation[num][3].push(sprite)
        end
        unless @@_animations.include?(animation)
          @@_animations.push(animation)
        end
      end
      update_animation(@_animation[num])
    end
    def loop_animation(animation)
      return if animation == @_loop_animation
      dispose_loop_animation
      @_loop_animation = animation
      return if @_loop_animation == nil
      @_loop_animation_index = 0
      animation_name = @_loop_animation.animation_name
      animation_hue = @_loop_animation.animation_hue
      bitmap = RPG::Cache.animation(animation_name, animation_hue)
      if @@_reference_count.include?(bitmap)
        @@_reference_count[bitmap] += 1
      else
        @@_reference_count[bitmap] = 1
      end
      @_loop_animation_sprites = []
      for i in 0..15
        sprite = ::Sprite.new
        sprite.bitmap = bitmap
        sprite.visible = false
        @_loop_animation_sprites.push(sprite)
      end
      # update_loop_animation
    end
    def dispose_animation
      for anime in @_animation.reverse
        sprite = anime[3][0]
        if sprite != nil
          @@_reference_count[sprite.bitmap] -= 1
          if @@_reference_count[sprite.bitmap] == 0
            sprite.bitmap.dispose
          end
        end
        for sprite in anime[3]
          sprite.dispose
        end
        @_animation.delete(anime)
      end
    end
   
    def update
      super
      if @_whiten_duration > 0
        @_whiten_duration -= 1
        self.color.alpha = 128 - (16 - @_whiten_duration) * 10
      end
      if @_appear_duration > 0
        @_appear_duration -= 1
        self.opacity = (16 - @_appear_duration) * 16
      end
      if @_escape_duration > 0
        @_escape_duration -= 1
        self.opacity = 256 - (32 - @_escape_duration) * 10
      end
      if @_collapse_duration > 0
        @_collapse_duration -= 1
        self.opacity = 256 - (48 - @_collapse_duration) * 6
      end
      for damage in @_damage
        if damage[1] > 0
          damage[1] -= 1
          damage[4] -= 3
          damage[2] -= damage[4]
          if self.battler.is_a?(Game_Actor)
            damage[0].x = self.x + (40 - damage[1]) * damage[3] / 10
            damage[0].y = self.y - self.oy / 2 + damage[2] / 10
          else
            damage[0].x = self.x + self.viewport.rect.x -
                          self.ox + self.src_rect.width / 2 +
                          (40 - damage[1]) * damage[3] / 10
            damage[0].y = self.y - self.oy * self.zoom_y / 2 +
                          self.viewport.rect.y + damage[2] / 10
            damage[0].zoom_x = self.zoom_x
            damage[0].zoom_y = self.zoom_y
          end
          damage[0].z = 2960 + damage[1]
          damage[0].opacity = 256 - (12 - damage[1]) * 32
          if damage[1] == 0
            damage[0].bitmap.dispose
            damage[0].dispose
            @_damage.delete(damage)
          end
        end
      end
      for anime in @_animation
        if (Graphics.frame_count % 2 == 0)
          anime[2] -= 1
          update_animation(anime)
        end
      end
      if @_loop_animation != nil and (Graphics.frame_count % 2 == 0)
        update_loop_animation
        @_loop_animation_index += 1
        @_loop_animation_index %= @_loop_animation.frame_max
      end
      if @_blink
        @_blink_count = (@_blink_count + 1) % 32
        if @_blink_count < 16
          alpha = (16 - @_blink_count) * 6
        else
          alpha = (@_blink_count - 16) * 6
        end
        self.color.set(255, 255, 255, alpha)
      end
      @@_animations.clear
    end

    def update_animation(anime)
      if anime[2] > 0
        frame_index = anime[0].frame_max - anime[2]
        cell_data = anime[0].frames[frame_index].cell_data
        position = anime[0].position
        animation_set_sprites(anime[3], cell_data, position)
        for timing in anime[0].timings
          if timing.frame == frame_index
            animation_process_timing(timing, anime[1])
          end
        end
      else
        @@_reference_count[anime[3][0].bitmap] -= 1
        if @@_reference_count[anime[3][0].bitmap] == 0
            anime[3][0].bitmap.dispose
        end
        for sprite in anime[3]
          sprite.dispose
        end
        @_animation.delete(anime)
      end
    end
    def animation_set_sprites(sprites, cell_data, position)
      for i in 0..15
        sprite = sprites
        pattern = cell_data[i, 0]
        if sprite == nil or pattern == nil or pattern == -1
          sprite.visible = false if sprite != nil
          next
        end
        sprite.visible = true
        sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
        if position == 3
          if self.viewport != nil
            sprite.x = self.viewport.rect.width / 2
            if $game_temp.in_battle and self.battler.is_a?(Game_Enemy)
              sprite.y = self.viewport.rect.height - 320
            else
              sprite.y = self.viewport.rect.height - 160
            end
          else
            sprite.x = 320
            sprite.y = 240
          end
        else
          sprite.x = self.x + self.viewport.rect.x -
                      self.ox + self.src_rect.width / 2
          if $game_temp.in_battle and self.battler.is_a?(Game_Enemy)
            sprite.y = self.y - self.oy * self.zoom_y / 2 +
                        self.viewport.rect.y
            if position == 0
              sprite.y -= self.src_rect.height * self.zoom_y / 4
            elsif position == 2
              sprite.y += self.src_rect.height * self.zoom_y / 4
            end
          else
            sprite.y = self.y + self.viewport.rect.y -
                        self.oy + self.src_rect.height / 2
            sprite.y -= self.src_rect.height / 4 if position == 0
            sprite.y += self.src_rect.height / 4 if position == 2
          end
        end
        sprite.x += cell_data[i, 1]
        sprite.y += cell_data[i, 2]
        sprite.z = 2000
        sprite.ox = 96
        sprite.oy = 96
        sprite.zoom_x = cell_data[i, 3] / 100.0
        sprite.zoom_y = cell_data[i, 3] / 100.0
        if position != 3
          sprite.zoom_x *= self.zoom_x
          sprite.zoom_y *= self.zoom_y
        end
        sprite.angle = cell_data[i, 4]
        sprite.mirror = (cell_data[i, 5] == 1)
        sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
        sprite.blend_type = cell_data[i, 7]
      end
    end
  end
end


作者: dbshy    时间: 2008-8-2 06:08
看别人脚本很累的,好象是伤害美化,然后动画看了一半,就懒得看了

LZ下的脚本,应该有说明,把说明铁出来,或者把连接帖出来
作者: pan2003abc    时间: 2008-8-2 06:43
啊,伤害美化,好像是有这么个脚本我下过,但是我删了他就解决了问题了
作者: Ж纯Ж蓝Ж    时间: 2008-8-2 08:08
以下引用灯笼菜刀王于2008-8-1 19:57:52的发言:

理解不能...

如果什么战斗系统都没加,也就是单纯的改坐标,默认的战斗系统也都是动画完了才显示伤害...

2楼给的那个链接更是说明这点,
这个计数的真正作用,是在显示完打击动画以后,等待8帧(0.4秒)再弹出伤害值。
这样,不论你的动画有多长,得,显示完以后一律得等上0.4秒才能看到伤害。


感觉楼主说的是和这个相反的= =...

同上........無法理解LZ的長篇大論.....




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1