Battle Animation Reverse 1.1

Battle Animation Reverse

Introduction

Remember the RM2K/2K3 battle animation reverse feature? Now it's back!
This scripts add this feature again to RMXP, it's designed for Sideview Battle Systems though, the demo does have a SVBS(It ISN'T mine, if you know its owner credit him!) included.

Screenshot



Demo

Here
Optional(4shared)

Script

The Script Spoiler
#================================================================
# + Battle Animation Reverse System(This is a Non-RTAB Script)
# = This script is for side-view battle systems only.
# = Requested by DerVVulfman.
# = RPG::Sprite adaptation by hugopkmn.
# = Thanks to Dargor for pointing a site with the [R/r] feature.
#================================================================
# + How to setup an animation?
# = If you want an animation to reverse, the animation's name must
#   have [R] or [r] in its name.
# = Remember that the screen targeted or direct target animations
#   (eg. an arrow) must be directed to the enemy's screen side.
#================================================================

#================================================================
# + Scene_Battle add-on
# = The thing that was missing  ¬Ãƒâ€šÃ‚ ¬
#================================================================
class Scene_Battle
  attr_reader  :active_battler
end

#================================================================
# + RPG::Animation
#================================================================
module RPG
  class Animation
    def initialize
      @id = 0
      @name = ""
      @animation_name = ""
      @animation_hue = 0
      @position = 1
      @frame_max = 1
      @frames = [RPG::Animation::Frame.new]
      @timings = []
      @reversable = false
    end
    attr_accessor :id
    attr_accessor :name
    attr_accessor :animation_name
    attr_accessor :animation_hue
    attr_accessor :position
    attr_accessor :frame_max
    attr_accessor :frames
    attr_accessor :timings
    attr_accessor :reversable
  end
end

#================================================================
# + RPG::Sprite
#================================================================
module RPG
  class Sprite < ::Sprite
    def animation(animation, hit)
      dispose_animation
      @_animation = animation
      return if @_animation == nil
      if(/\[[Rr]\]\z/ =~ @_animation.name)
        @_animation.reversable = true
      else
        @_animation.reversable = false
      end
      @_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)
      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 loop_animation(animation)
      return if animation == @_loop_animation
      dispose_loop_animation
      @_loop_animation = animation
      return if @_loop_animation == nil
      if(/\[[Rr]\]\z/ =~ @_loop_animation.name)
        @_loop_animation.reversable = true
      else
        @_loop_animation.reversable = false
      end
      @_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(self.viewport)
        sprite.bitmap = bitmap
        sprite.visible = false
        @_loop_animation_sprites.push(sprite)
      end
      update_loop_animation
    end
    def dispose_damage
      if @_damage_sprite != nil
        @_damage_sprite.bitmap.dispose
        @_damage_sprite.dispose
        @_damage_sprite = nil
        @_damage_duration = 0
      end
    end
    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
            sprite.x = self.viewport.rect.width / 2
            sprite.y = self.viewport.rect.height - 160
          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
        if $game_temp.in_battle
          @abattler = $scene.active_battler
          if @abattler != nil
            if @abattler.current_action.kind == 0 and @abattler.current_action.basic == 0
              @animation_id = @battler.animation2_id
            else
              @animation_id = $data_skills[@abattler.current_action.skill_id].animation2_id if
              $data_skills[@abattler.current_action.skill_id] != nil
            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 @abattler != nil and @abattler.is_a?(Game_Enemy) and
          $data_animations[@animation_id].reversable
            sprite.x -= cell_data[i, 1] * 2
            @angle_c = 0
            @angle_c -= cell_data[i, 4]
            sprite.angle = @angle_c < 0 ? @angle_c + 360 : @angle_c
            sprite.mirror = (cell_data[i, 5] == 0)
          else
            sprite.angle = cell_data[i, 4]
            sprite.mirror = (cell_data[i, 5] == 1)
          end
        else
          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)
        end
        sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
        sprite.blend_type = cell_data[i, 7]
      end
    end
  end
end
Expand to see the code.


Instructions

Put this between main and your custom scripts.
To setup an animation to reverse, just add [R/r] to the animation's name, for further information, read the script's first few lines.

Compatibility

This script isn't SDK dependant but SDK compatible, this script isn't compatible with RTAB and I won't take RTAB conversion requests, so don't request.
If you are using any other animation related script, this one may cause an error.

Credits and Thanks

Credits goes for me if you are using this script and thanks goes to DerVVulfman(for requesting it), Dargor(for pointing Dust Wind's website), SephirothSpawn(for pointing the RPG::Sprite as the responsible class) and Dust Wind(for a small feature).
This is rad. Rad rad RAD!

Thankyou for the rad script.
You love that word a lot Kururu!XD
That's cool. :p

I guess we are now 3 scripters working on the same thing, your script is pretty cool! I wonder how DerVVulfmen's script looks like.
So my link has helped?XD

I'll release mine with a future version of my FFVI SDK.

Excellent work hugopkmn!:thumb:
I don't know wth rad stands for but I'm taking it as a praise xD
Yep Dargor, it has really helped me and DeVVulfman too, but as I said, that script gives a 3D's z coord aspect to some animations, not of much use anyways, good luck with ur SDK and keep up ur good work too ^^
Edit: just noticed that the file still in mod queue, can some1 see that?
This is nice, only thing is, that means you still have to create 2 seperate animations one for enemys and one for heros right?
I can't get this to work on animations that aren't on the entire screen

And yes, Neonyo, you would...but it's alot easier to copy and paste and add [r] to the title then to redo the animation.
@Neonyo, just add the [R/r] to the animation's name, there's no need to copy/paste the animation.
@kaze950, gotta take a look on it.
Edit: Ok, found it and fixed the bug, editing the first post.
Edit2: Edited and reuploaded the demo
Yeah, but if you add [r] to the animation name that animation will only be good for enemies, so you'll still have to copy/paste the animation, right?
No, the script checks if the user is an actor or an enemy and reverse it if needed, in this case, if it's an enemy it will reverse.
According to my demo, the enemy's side of the field is the left one.
Oh, for some reason I never noticed that

Well, that makes this script even better :D
I love this script so much. It will be perfect for my fangame, kupo.

Wait... I already thanked you. Oh well. Now, WHERE'S THAT THANKYOU BUTTON!?!!?!

Hee hee...
OH! Now I remember! The demo.

"Kururu, you do not have permission to access this page. This could be due to one of several reasons:

Your user account may not have sufficient privileges to access this page. Are you trying to edit someone else's post, access administrative features or some other privileged system?
If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation. "

That comes up when I try to download. Ku...
Myself! wrote:
Edit: just noticed that the file still in mod queue, can some1 see that?

Use the posted script in the first page
Kupo. Understood. Now I wanna go home and use this...
ok cool, that works great then.
Edit: DUH! Non RTAB...damn lol hurry up Devvulfman :D
Hmm.. Almost the same as DerVV's... But great job as well!
We were combining efforts, though he did a lot of the headwork, and the finding of Dust Wind's script. That and he posted it first while I was still working on mine. Kudos.
Just noticed somehting.

If you enter battle with any state inflicted (for example, venom), line 151 will get an error message.
ehm how do you make the bar things empty faster when damage is taken? mine just seem to take like a minute to move each time an enemy is hit @_@
@kaze950, I'm going to look over it later cuz I'm too exausted rite now, tomorrow I'll post the new demo and script here don't worry.
@Roosterkin, I don't support the battle system cuz it isn't mine, so please don't ask for it, I'll try to remove those bars, but nothing 100% sure.
Any other questions I'll surely answer them tomorrow.

Edit: I recommend to do not use [R] in state animations cuz it will be really buggy, I'll try to fix it, but again nothing 100% sure.

Edit2: Version 1.1 is out! Unfortunately the states animation cannot be reversed by this script properly, so it won't reverse states animations for a while until I find a way to do it.
Anyways, a state animation is just a fancy looping animation though.
Thanks, not what I was expecting but I'd rather use this :3
so i tried to use that svbs and whenever i do my character just ends up running in place... whats up with that? how do i fix it?
Uh... One question How do you Get the graphics Of battlers Sideways for the script? Because I am clueless on how to add the graphics for battle sideways.......
I love this script -- but one question. Is it possible to fit larger enemies into the screen? it seems there is a limit to how large the battlers can be without cutting off the graphic.

I was using a huge dragon, but obviously it got cut off.

Is there any way to fix this?

Thanks!
This is amazing.
Its by far my favorite sideview battler.
Good job.
My favorite (And only :P) side-view system. Good someone started with this. You have my thanks. But it seems like it get some trouble with some SDK script. Like, I can't choose which enemy to attack. Newer versions of SDK cuts of dead animasion and life bar animations. Lot's of other scripts I have requires SDK MALC, so, that's the reason. Again, love your side-view system.

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=17382