Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

RainBow_Swords(damage while animation playing)

VI_VI

Member

Code:
#--------------------------------------------------------------------- 
# 本脚本来自www.66rpg.com,作者柳柳,转载和使用请保留此说明 
#--------------------------------------------------------------------- 

# 冲突性:中高 

# 冲突说明: 
# damage_pop 不再附带damage()的功能,这个放到animation里面去了 


module RPG 
 class Sprite < ::Sprite 
   @@_animations = [] 
   @@_reference_count = {} 
   #========================================== 
   # 修改说明: 
   # @flash_shake用来制作挨打时候跳跃 
   # @_damage    用来记录每次打击之后弹出数字 
   #========================================== 
   def initialize(viewport = nil) 
     super(viewport) 
     @flash_shake = 0 
     @_whiten_duration = 0 
     @_appear_duration = 0 
     @_escape_duration = 0 
     @_collapse_duration = 0 
     @_damage_duration = 0 
     @_animation_duration = 0 
     @_blink = false 
     @_damage = [] #~66RPG~# 
     @py_y = 0 
   end 
   def damage(value, critical) 
     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 
       bitmap.font.color.set(176, 255, 144) 
     else 
       bitmap.font.color.set(255, 55, 55) 
     end 
     bitmap.draw_text(0, 12, 160, 36, damage_string, 1) 
     if critical 
       bitmap.font.size = 20 
       bitmap.font.color.set(0, 0, 0) 
       bitmap.draw_text(-1, -1, 160, 20, "CRITICAL", 1) 
       bitmap.draw_text(+1, -1, 160, 20, "CRITICAL", 1) 
       bitmap.draw_text(-1, +1, 160, 20, "CRITICAL", 1) 
       bitmap.draw_text(+1, +1, 160, 20, "CRITICAL", 1) 
       bitmap.font.color.set(255, 255, 255) 
       bitmap.draw_text(0, 0, 160, 20, "CRITICAL", 1) 
     end 
     @_damage_sprite = ::Sprite.new(self.viewport) 
     @_damage_sprite.bitmap = bitmap 
     @_damage_sprite.ox = 80 
     @_damage_sprite.oy = 20 
     @_damage_sprite.x = self.x 
     @_damage_sprite.y = self.y - self.oy / 2 
     @_damage_sprite.z = 3000 
     @_damage_duration = 40 
     #======================================= 
     # 修改:推入新的伤害 
     #======================================= 
     @_damage.push([@_damage_sprite,@_damage_duration-10,0, rand(30) - 15, rand(3)]) 
   end 
   def animation(animation, hit, battler_damage="", battler_critical=false) 
     dispose_animation       
     #======================================= 
     # 修改:记录伤害和critical 
     #======================================= 
     @battler_damage = battler_damage 
     @battler_critical = battler_critical 
     @_animation = animation 
     return if @_animation == nil 
     @_animation_hit = hit 
     @_animation_duration = @_animation.frame_max 
     animation_name = @_animation.animation_name 
     animation_hue = @_animation.animation_hue 
     bitmap = RPG::Cache.animation(animation_name, animation_hue) 
     #======================================= 
     # 修改:计算总闪光权限值 
     #======================================= 
     for timing in @_animation.timings 
       @all_quanzhong += animation_process_timing(timing, @_animation_hit)         
     end       
     if @@_reference_count.include?(bitmap) 
       @@_reference_count[bitmap] += 1 
     else 
       @@_reference_count[bitmap] = 1 
     end 
     @_animation_sprites = [] 
     if @_animation.position != 3 or not @@_animations.include?(animation) 
       for i in 0..15 
         sprite = ::Sprite.new(self.viewport) 
         sprite.bitmap = bitmap 
         sprite.visible = false 
         @_animation_sprites.push(sprite) 
       end 
       unless @@_animations.include?(animation) 
         @@_animations.push(animation) 
       end 
     end 
     update_animation 
   end 
   #======================================= 
   # 修改:更换清除伤害的算法,以防万一 
   #       本内容在脚本中没有使用过 
   #======================================= 
   def dispose_damage 
     for damage in @_damage.reverse 
       damage[0].bitmap.dispose 
       damage[0].dispose 
       @_damage.delete(damage) 
     end 
   end 
   def dispose_animation 
     #======================================= 
     # 修改:清除记录的伤害,清除权重记录 
     #======================================= 
     @battler_damage = nil 
     @battler_critical = nil 
     @all_quanzhong = 1 
     if @_animation_sprites != nil 
       sprite = @_animation_sprites[0] 
       if sprite != nil 
         @@_reference_count[sprite.bitmap] -= 1 
         if @@_reference_count[sprite.bitmap] == 0 
           sprite.bitmap.dispose 
         end 
       end 
       for sprite in @_animation_sprites 
         sprite.dispose 
       end 
       @_animation_sprites = nil 
       @_animation = nil 
     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 
     #======================================= 
     # 修改:更新算法,更新弹出 
     #======================================= 
     if @_damage_duration > 0 
       @_damage_duration -= 1 
       for damage in @_damage 
         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 -= damage[4]+damage[1]/10 
         damage[0].opacity = damage[1]*20 
         damage[1] -= 1 
         if damage[1]==0 
           damage[0].bitmap.dispose 
           damage[0].dispose 
           @_damage.delete(damage) 
           next 
         end 
       end 
     end 
     if @_animation != nil and (Graphics.frame_count % 2 == 0) 
       @_animation_duration -= 1 
       update_animation 
     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 
     if @_animation_duration > 0 
       frame_index = @_animation.frame_max - @_animation_duration 
       cell_data = @_animation.frames[frame_index].cell_data 
       position = @_animation.position 
       animation_set_sprites(@_animation_sprites, cell_data, position) 
       #======================================= 
       # 修改:弹出伤害,权重计算 
       #======================================= 
       for timing in @_animation.timings 
         if timing.frame == frame_index 
           t = 1.0 * animation_process_timing(timing, @_animation_hit)             
           #p t,"当前权重", @all_quanzhong,"总权重" 
           if @battler_damage.is_a?(Numeric) and t != 0 
             t *= @battler_damage 
             t /= @all_quanzhong 
             #p t,"当前伤害",@battler_damage,"总伤害" 
             t = t.to_i 
             #p t,@battler_damage,@all_quanzhong 
             damage(t,@battler_critical) 
           elsif !@battler_damage.is_a?(Numeric) 
             damage(@battler_damage,@battler_critical) 
           end 
         end 
       end 
     else 
       dispose_animation 
     end 
   end 
   #======================================= 
   # 修改:敌人跳跃的功能 + 添加返回数值 
   #======================================= 
    def animation_process_timing(timing, hit) 
      if (timing.condition == 0) or 
         (timing.condition == 1 and hit == true) or 
         (timing.condition == 2 and hit == false) 
        if timing.se.name != "" 
          se = timing.se 
          Audio.se_play("Audio/SE/" + se.name, se.volume, se.pitch) 
        end 
        case timing.flash_scope 
        when 1 
          self.flash(timing.flash_color, timing.flash_duration * 2) 
          @flash_shake_switch = true 
          @flash_shake = 10 
          return timing.flash_color.alpha * timing.flash_duration 
        when 2 
          if self.viewport != nil 
            self.viewport.flash(timing.flash_color, timing.flash_duration * 2) 
            return timing.flash_color.alpha * timing.flash_duration 
          end 
        when 3 
          self.flash(nil, timing.flash_duration * 2) 
          return timing.flash_color.alpha * timing.flash_duration 
        end 
      end        
      return 0 
    end     
 end 
end 
#============================================================================== 
# â–  Sprite_Battler 
#============================================================================== 
class Sprite_Battler < RPG::Sprite  
#-------------------------------------------------------------------------- 
# ● 初始化对像 
#    添加跳跃记录 
#-------------------------------------------------------------------------- 
def initialize(viewport, battler = nil) 
  super(viewport) 
  @battler = battler 
  @battler_visible = false 
  @flash_shake_switch = true 
end 
#-------------------------------------------------------------------------- 
# ● 刷新画面 
#    增添跳跃功能 
#-------------------------------------------------------------------------- 
def update 
  super 
  # 战斗者为 nil 的情况下 
  if @battler == nil 
    self.bitmap = nil 
    loop_animation(nil) 
    return 
  end 
  # 文件名和色相与当前情况有差异的情况下 
  if @battler.battler_name != @battler_name or 
     @battler.battler_hue != @battler_hue 
    # 获取、设置位图 
    @battler_name = @battler.battler_name 
    @battler_hue = @battler.battler_hue 
    self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue) 
    @width = bitmap.width 
    @height = bitmap.height 
    self.ox = @width / 2 
    self.oy = @height 
    # 如果是战斗不能或者是隐藏状态就把透明度设置成 0 
    if @battler.dead? or @battler.hidden 
      self.opacity = 0 
    end 
  end 
  # 动画 ID 与当前的情况有差异的情况下 
  if @battler.damage == nil and 
     @battler.state_animation_id != @state_animation_id 
    @state_animation_id = @battler.state_animation_id 
    loop_animation($data_animations[@state_animation_id]) 
  end 
  # 应该被显示的角色的情况下 
  if @battler.is_a?(Game_Actor) and @battler_visible 
    # 不是主状态的时候稍稍降低点透明度 
    if $game_temp.battle_main_phase 
      self.opacity += 3 if self.opacity < 255 
    else 
      self.opacity -= 3 if self.opacity > 207 
    end 
  end 
  # 明灭 
  if @battler.blink 
    blink_on 
  else 
    blink_off 
  end 
  # 不可见的情况下 
  unless @battler_visible 
    # 出现 
    if not @battler.hidden and not @battler.dead? and 
       (@battler.damage == nil or @battler.damage_pop) 
      appear 
      @battler_visible = true 
    end 
  end 
  # 可见的情况下 
  if @battler_visible 
    # 逃跑 
    if @battler.hidden 
      $game_system.se_play($data_system.escape_se) 
      escape 
      @battler_visible = false 
    end 
    # 白色闪烁 
    if @battler.white_flash 
      whiten 
      @battler.white_flash = false 
    end 
    # 动画 
    if @battler.animation_id != 0 
      animation = $data_animations[@battler.animation_id] 
      animation(animation, @battler.animation_hit,@battler.damage, @battler.critical) 
      @battler.animation_id = 0 
    end 
    # 伤害 
    if @battler.damage_pop 
      @battler.damage = nil 
      @battler.critical = false 
      @battler.damage_pop = false 
    end 
    # korapusu 
    if @battler.damage == nil and @battler.dead? 
      if @battler.is_a?(Game_Enemy) 
        $game_system.se_play($data_system.enemy_collapse_se) 
      else 
        $game_system.se_play($data_system.actor_collapse_se) 
      end 
      collapse 
      @battler_visible = false 
    end 
  end 
  # 设置活动块的坐标 
  if @flash_shake_switch == true 
    self.x = @battler.screen_x 
    self.y = @battler.screen_y 
    self.z = @battler.screen_z 
    @flash_shake_switch = false 
  end 
  if @flash_shake != 0 and @battler.damage != nil 
    case @flash_shake 
    when 9..10 
      self.x = @battler.screen_x 
      self.y -=4 
      self.z = @battler.screen_z 
    when 6..8 
      self.x = @battler.screen_x 
      self.y -=2 
      self.z = @battler.screen_z 
    when 3..5 
      self.x = @battler.screen_x 
      self.y +=2 
      self.z = @battler.screen_z 
    when 2 
      self.x = @battler.screen_x 
      self.y += 4 
      self.z = @battler.screen_z 
    when 1 
      self.x = @battler.screen_x 
      self.y = @battler.screen_y 
      self.z = @battler.screen_z 
    end 
    @flash_shake -= 1 
  end 
end 
end 
#--------------------------------------------------------------------- 
# 本脚本来自www.66rpg.com,作者柳柳,转载和使用请保留此说明 
#--------------------------------------------------------------------- 



it's just a small scripts made for my friend, she want to find... how to make the battle a little booldly not a good girl, hah? 

not a SUPER_RGSS and it did'nt use SDK(because SDK is not popular in China). post here.. I just wanna practise my english- -b, that's all.

[image of this script]

this is an preview of this scripts, the resource is here: http://www.rmxp.org/forums/showthread.php?t=3608&page=2 , if u wanna make a same animation like the picture shows.


[what this RGSS can do?]
it's damage while the animation playing. while animation playing, if there is a timings, it will show some damage. the damage amount relate to :
1. alpha of flash_color
2. flash_duration
before the animation plays, the script will caculate the ...the weight of all the animation timings (sorry, maybe "weight" is a wrong translation~~surely), then, while playing, compare the current frame's weight with all_weight, to decide damage_amount this frame.

p.s.
and if u use this scripts all I posted, while damage, the enemy will jump to show "it's hurt!"


[credits]
VI_VI (of course you can use my Chinese name "柳柳")


[sth about copyrights, and HOW_TO_USE of this scripts]
copyrights....nothing special, you can post this topic to anywhere you want, just don't sold it ^-^ But if you write "thanks to 66RPG.com" in your game's readme.txt, I will happy, really.
insert all the scripts before "main" -----all Chinese scripts is made like this. en.



[RGSS]
if you can't read Chinese characters, just delete it. but I hope you can keep it...
 
Well this sounds really nice, but could you add a demo maybe?
Cause I kinda don't get how to set up this effect in a battleanimation...
Currently I'm using the KGC MultiAttack, which has (if I'm not mistaken) the same effect, but your version looks much better
 
your demo doesn't work because the bgm u have shows up as a really weird name on my computer (since its chinese)

and rpg maker can't seem to understand it
 
It works fine, just go in to the game and change the music or turn it off. I think this is awesome! Nice job! Instead of the text "floating" away, is it possible to make it like in Tales of Symphonia where it just flies off into a random direction and comes back down and fades? I saw a script to show damage like that somewhere.

I tried it in a new game, and it works, but it only hits once, or sometimes twice.
 
It's REALLY good yet ceative.
So umm is this similar to the KGC multi attack script?
I believe it is but I just need some confirmation just incase.
 
good work, i am gonna use it!
a little thing, when i use it with the battle zoom script(xrxs?) the enemy damage appears in the left side of the screen.....please see whats wrong, ok?


Code:
# ▼▲▼ XRXS_BP 8. バトルバック・Full-View+可動カメラ ver..05c ▼▲▼
# by 桜雅 在土
#
#==============================================================================
# â–  Game_Battler
#==============================================================================
class Game_Battler
 #--------------------------------------------------------------------------
 # ● 追加・公開インスタンス変数
 #--------------------------------------------------------------------------
 attr_accessor :x_pos1                    # バトルフィールド 横 位置(+が右 )
 attr_accessor :y_pos1                    # バトルフィールド 高さ 位置(+が上 )
 attr_accessor :z_pos1                    # バトルフィールド奥行き位置(+が手前)
 attr_accessor :zoom                     # 現在のズーム倍率
 attr_accessor :x_destination           # X 目的地
 attr_accessor :y_blow                   # 現在Y 吹っ飛び速度
end
#==============================================================================
# â–  Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
 #--------------------------------------------------------------------------
 # ● 追加・公開インスタンス変数
 #--------------------------------------------------------------------------
 attr_reader   :actor_in_battlefield     # アクターもフィールドに
 #--------------------------------------------------------------------------
 # ● セットアップ
 #--------------------------------------------------------------------------
 alias xrxs_bp8_setup setup
 def setup(actor_id)
   xrxs_bp8_setup(actor_id)
   # 機能"アクターもフィールドに"
   # trueを優先する
   @actor_in_battlefield = false if @actor_in_battlefield != true
 end
end
#==============================================================================
# â–  Game_Enemy
#==============================================================================
class Game_Enemy < Game_Battler
 #--------------------------------------------------------------------------
 # ● 追加・公開インスタンス変数
 #--------------------------------------------------------------------------
 attr_reader   :actor_in_battlefield     # アクターもフィールドに
 #--------------------------------------------------------------------------
 # ● オブジェクト初期化
 #--------------------------------------------------------------------------
 alias xrxs_bp8_initialize initialize
 def initialize(troop_id, member_index)
   @actor_in_battlefield = false
   @x_pos1          =   $data_troops[troop_id].members[member_index].x - 320
   @y_pos1          = -($data_troops[troop_id].members[member_index].y - 304)
   @field_x_offset = -192
   @field_y_offset = -144
   @z_pos1          =    0
   @zoom           = 1.00
   xrxs_bp8_initialize(troop_id, member_index)
 end
 #--------------------------------------------------------------------------
 # ● バトル画面 X 座標の取得
 #--------------------------------------------------------------------------
 def screen_x
   return 320 - @field_x_offset + (@x_pos1.to_i - $xcam_x.to_i) * @zoom
 end
 #--------------------------------------------------------------------------
 # ● バトル画面 Y 座標の取得
 #--------------------------------------------------------------------------
 def screen_y
   return 240 - @field_y_offset + (-@y_pos1.to_i + 64 + $xcam_y.to_i) * @zoom
 end
end
#==============================================================================
# â–  Sprite_Battler
#==============================================================================
class Sprite_Battler < RPG::Sprite
 #--------------------------------------------------------------------------
 # ● フレーム更新
 #--------------------------------------------------------------------------
 alias xrxs_bp8_update update
 def update
   # 初期化
   @z_offset = 0
   # 戻す
   xrxs_bp8_update
   # バトラーが nil の場合戻る
   return if @battler == nil
   # 敵のみにカメラが影響。
   # 見方もバトルフィールドにいる場合ここの if を外す。
   if (@battler.is_a?(Game_Actor) and @battler.actor_in_battlefield) or @battler.is_a?(Game_Enemy)
     # ズーム率
     zoom = 1.00 * 185 / (($xcam_z != nil ? $xcam_z : 185) - @z_offset)
     self.zoom_x = zoom
     self.zoom_y = zoom
     @battler.zoom = zoom
     # スプライトの座標を設定
     self.x = @battler.screen_x
     self.y = @battler.screen_y
     self.z = @battler.screen_z
   end
 end
end
#==============================================================================
# â–  Spriteset_Battle
#==============================================================================
class Spriteset_Battle
 #--------------------------------------------------------------------------
 # ● オブジェクト初期化
 #--------------------------------------------------------------------------
 alias xrxs_bp8_initialize initialize
 def initialize
   # 初期化
   @now_bg_x = 0
   @now_bg_y = 0
   @now_bg_z = 185
   # 通常時の実行
   xrxs_bp8_initialize
   # ビューポートを作成
   @viewport1 = Viewport.new(-192, -144, 1024, 768)
   # バトルバックスプライトを作成
   @battleback_sprite = Sprite.new(@viewport1)
   @battleback_name = ""
   # エネミースプライトを作成
   @enemy_sprites = []
   for enemy in $game_troop.enemies.reverse
     @enemy_sprites.push(Sprite_Battler.new(@viewport1, enemy))
   end
   # 天候を作成
   @weather = RPG::Weather.new(@viewport1)
   # フレーム更新
   update
 end
 #--------------------------------------------------------------------------
 # ● フレーム更新
 #--------------------------------------------------------------------------
 alias xrxs_bp8_update update
 def update
   # バトルバックのファイル名が現在のものと違う場合
   if @battleback_name != $game_temp.battleback_name
     @battleback_name = $game_temp.battleback_name
     if @battleback_sprite.bitmap != nil
       @battleback_sprite.bitmap.dispose
     end
     bg_bitmap = RPG::Cache.battleback(@battleback_name)
     bg_bitmap_stretch = Bitmap.new(1024, 768)
     bg_bitmap_stretch.stretch_blt(Rect.new(0, 0, 1024, 768), bg_bitmap, bg_bitmap.rect)
     @battleback_sprite.bitmap = bg_bitmap_stretch
   end
   # カメラ位置が動いた場合
   if @now_bg_x != $xcam_x or @now_bg_y != $xcam_y or @now_bg_z != $xcam_z
     # ズーム率
     zoom = 1.00 * 185 / $xcam_z
     @battleback_sprite.zoom_x = zoom
     @battleback_sprite.zoom_y = zoom
     # カメラzによる位置の修正
     maximum = 192 * (296 - $xcam_z) / 111
     $xcam_x = [[$xcam_x, -maximum].max, maximum].min
     # 背景位置更新
     @battleback_sprite.x = -$xcam_x * zoom - 512 * (zoom - 1)
     @battleback_sprite.y =  $xcam_y * zoom - 384 * (zoom - 1)
     # 値更新
     @now_bg_x = $xcam_x
     @now_bg_y = $xcam_y
     @now_bg_z = $xcam_z
   end
   # 戻す
   xrxs_bp8_update
 end
end
#==============================================================================
# â–  Scene_Battle
#==============================================================================
class Scene_Battle
 #--------------------------------------------------------------------------
 # ● メイン処理
 #--------------------------------------------------------------------------
 alias xrxs_bp8_main main
 def main
   # カメラ初期位置決定
   $xcam_x = 0
   $xcam_y = 0
   $xcam_z = 295
   # カメラの最初の目的値
   @xcam_x_destination = 0
   @xcam_y_destination = 0
   @xcam_z_destination = 185
   # 今、注目バトラーは無し。
   @xcam_watch_battler = nil
   # 初期化
   @wait_count_xcam = 0
   # 戻す
   xrxs_bp8_main
 end
 #--------------------------------------------------------------------------
 # ● フレーム更新
 #--------------------------------------------------------------------------
 alias xrxs_bp8_update update
 def update
   # カメラ位置の更新。
   if @wait_count_xcam > 0
     # ウェイトカウントを減らす
     @wait_count_xcam -= 1
   else
     if $xcam_z != @xcam_z_destination
       if $xcam_z < @xcam_z_destination
         distance = [(@xcam_z_destination - $xcam_z)/8, 1].max
       else
         distance = [(@xcam_z_destination - $xcam_z)/8, -1].min
       end
       $xcam_z = [[$xcam_z + distance, 74].max, 296].min
     end
     if @xcam_watch_battler != nil
       if $xcam_x != @xcam_watch_battler.x_pos1
         if ($xcam_x - @xcam_watch_battler.x_pos1).abs < 8
           distance = @xcam_watch_battler.x_pos1 - $xcam_x
         elsif $xcam_x < @xcam_watch_battler.x_pos1
           distance = [(@xcam_watch_battler.x_pos1 - $xcam_x)/8, 8].max
         else
           distance = [(@xcam_watch_battler.x_pos1 - $xcam_x)/8, -8].min
         end
         maximum = 192 * (296 - $xcam_z) / 111
         $xcam_x = [[$xcam_x + distance, -maximum].max, maximum].min
       end
     elsif $xcam_x != @xcam_x_destination
       if ($xcam_x - @xcam_x_destination).abs < 8
         distance = @xcam_x_destination - $xcam_x
       elsif $xcam_x < @xcam_x_destination
         distance = [(@xcam_x_destination - $xcam_x)/8, 8].max
       else
         distance = [(@xcam_x_destination - $xcam_x)/8, -8].min
       end
       maximum = 192 * (296 - $xcam_z) / 111
       $xcam_x = [[$xcam_x + distance, -maximum].max, maximum].min
     end
     if @xcam_watch_battler != nil
       if $xcam_y != @xcam_watch_battler.y_pos1
         if ($xcam_y - @xcam_watch_battler.y_pos1).abs < 8
           distance = @xcam_watch_battler.y_pos1 - $xcam_y
         elsif $xcam_y < @xcam_watch_battler.y_pos1
           distance = [(@xcam_watch_battler.y_pos1 - $xcam_y)/8, 8].max
         else
           distance = [(@xcam_watch_battler.y_pos1 - $xcam_y)/8, -8].min
         end
         maximum = 144 * (296 - $xcam_z) / 111
         $xcam_y = [[$xcam_y + distance, -maximum].max, maximum].min          
       end
     elsif $xcam_y != @xcam_y_destination
       if $xcam_y < @xcam_y_destination
         distance = [(@xcam_y_destination - $xcam_y)/8, 1].max
       else
         distance = [(@xcam_y_destination - $xcam_y)/8, -1].min
       end
       maximum = 164 * (296 - $xcam_z) / 111
       $xcam_y = [[$xcam_y + distance, -maximum].max, maximum].min
     end
   end
   # 通常実行
   xrxs_bp8_update
 end
 #--------------------------------------------------------------------------
 # ● パーティコマンドフェーズ開始
 #--------------------------------------------------------------------------
 alias xrxs_bp8_start_phase2 start_phase2
 def start_phase2
   # カメラ:センタリング
   @xcam_watch_battler = nil
   @xcam_x_destination = 0
   @xcam_z_destination = 185
   # 戻す
   xrxs_bp8_start_phase2
 end
 #--------------------------------------------------------------------------
 # ● フレーム更新 (アクターコマンドフェーズ)
 #--------------------------------------------------------------------------
 alias xrxs_bp8_update_phase3 update_phase3
 def update_phase3
   # カメラをキャラ位置へ
   if @active_battler != nil and @active_battler.actor_in_battlefield
     @xcam_x_destination = @active_battler.x_pos1
     @xcam_z_destination = 175
   end
   xrxs_bp8_update_phase3
 end
 #--------------------------------------------------------------------------
 # ● フレーム更新 (アクターコマンドフェーズ : エネミー選択)
 #--------------------------------------------------------------------------
 alias xrxs_bp8_update_phase3_enemy_select update_phase3_enemy_select
 def update_phase3_enemy_select
   # カメラ:敵ターゲットをズームアップ
   @xcam_x_destination = $game_troop.enemies[@enemy_arrow.index].x_pos1 * $game_troop.enemies[@enemy_arrow.index].zoom
   @xcam_z_destination = 175
   # 戻す
   xrxs_bp8_update_phase3_enemy_select
 end
 #--------------------------------------------------------------------------
 # ● エネミー選択終了
 #--------------------------------------------------------------------------
 alias xrxs_bp8_end_enemy_select end_enemy_select
 def end_enemy_select
   # カメラ:中心へ
   @xcam_x_destination = 0
   @xcam_z_destination = 185
   # 戻す
   xrxs_bp8_end_enemy_select
 end
 #--------------------------------------------------------------------------
 # ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始)
 #--------------------------------------------------------------------------
 alias xrxs_bp8_update_phase4_step2 update_phase4_step2
 def update_phase4_step2
   # 戻す
   xrxs_bp8_update_phase4_step2
   # ステップ 3 に移行する場合
   if @phase4_step == 3
     if @active_battler.is_a?(Game_Enemy) or @active_battler.actor_in_battlefield
       # カメラ:行動バトラーへのズームアップを予約
       @xcam_x_destination = @active_battler.x_pos1 * @active_battler.zoom if @active_battler.x_pos1 != nil
       @xcam_z_destination = 175
     end
     # 最低 20 フレーム待つ
     @wait_count = 20
   end
 end
 #--------------------------------------------------------------------------
 # ● フレーム更新 (メインフェーズ ステップ 3 : 行動側アニメーション)
 #--------------------------------------------------------------------------
 alias xrxs_bp8_update_phase4_step3 update_phase4_step3
 def update_phase4_step3
   # 戻す
   xrxs_bp8_update_phase4_step3
   if @target_battlers.size > 0 and
     (@target_battlers[0].is_a?(Game_Enemy) or @target_battlers[0].actor_in_battlefield)
     # カメラ:ターゲットへのズームアップを予約
     @xcam_x_destination = @target_battlers[0].x_pos1 * @target_battlers[0].zoom if @target_battlers[0] != nil
     @xcam_z_destination = 185
     # もし対象アニメが「位置:画面」のものの場合
     if @animation2_id > 0 and $data_animations[@animation2_id].position == 3
       # カメラをセンタリング
       @xcam_x_destination = 0
       # ズームアウトまでやっちゃう・wï½¥
       @xcam_z_destination = 222
     end
   end
   # 最低 20 フレーム待つ
   @wait_count = 20
 end
 #--------------------------------------------------------------------------
 # ● アフターバトルフェーズ開始
 #--------------------------------------------------------------------------
 alias xrxs_bp8_start_phase5 start_phase5
 def start_phase5
   @xcam_z_destination = 185
   xrxs_bp8_start_phase5
 end
end
#==============================================================================
# ◇ RPG::再定義「戦闘中の"画面"アニメの位置修正」
#==============================================================================
module RPG
 class Sprite < ::Sprite
   def animation_set_sprites(sprites, cell_data, position)
     for i in 0..15
       sprite = sprites[i]
       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
           if $scene.is_a?(Scene_Battle)
             sprite.x = self.viewport.rect.width / 2
             sprite.y = 304
           else
             sprite.x = self.viewport.rect.width / 2
             sprite.y = self.viewport.rect.height - 160
           end
         else
           sprite.x = 320
           sprite.y = 240
         end
       else
         sprite.x = self.x - self.ox + self.src_rect.width / 2
         sprite.y = self.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
       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
       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
 
(Had to retype all of this :()
This script unlike the KGC Multi-Attack and my own Multi-Attack Script just splits up the damage depening upon how you define the animation so.

Heh pretty neat script I had to test this out for myself. You could have used alias on a few of the methods you edited for example Sprite_Battler#initialize this way you will increase compatibility with other CBS's and possibly other scripts. I have SDKed your script and if you allow me I'll post it, since this script is incompatible with the SDK (Sprite_Battler#update was edited)

Though I really wasn't clear on how to setup the animation, sure I'm a good enough scripter to where I can figure out the directions on how to use this script by just looking through your code but if I have to do that then other people who aren't as good should be confused on its uses.
 
This is an awesome script much better than the KGC one, but as always it's not working with my other scripts *sigh*

Anyway, good work!
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top