Help editing Animation Resizer
#1
I found this script that can resize animations at runtime. I want to use it to make Skill animations smaller when they are applied on Actor battlers (they are several times smaller than Enemy battlers) but I am not sure where to make the change.

Could someone more familiar with RPG Maker XP's battle/animation systems assist?

The script:
Code:
#===============================================================================
# Animation Resizer
# Author game_guy
# Version 1.0
#-------------------------------------------------------------------------------
# Intro:
# Want to reduce or increase the size of certain animations? Don't wanna go
# through all the tedious work to do it in the database? This script
# can resize any animation for you.
#
# Features:
# Increase animation size
# Decrease animation size
# Use only on specific animations
# Use custom size value
#
# Instructions:
# Note the animations also resize on events.
# Go down to config below.
# Default_Increase - This is the default amount that is used to resize an
#   animation that isn't configured.
# Configure Sizes - This is the config for setting up sizes for specific
#   animations only. If an animation isn't defined here then it uses
#   Default_Increase
#
# Don't want an animation resized on events? Simply use the following
# $game_system.anim_event = false
# Set it to true to have animations resized on events.
#
# Compatibility:
# Not tested with SDK.
# Should work where ever an animation is used.
#
# Credits:
# game_guy ~ For making it
# Jek ~ For requesting it
#===============================================================================
module GGHAN
  #==============================================
  # Config
  #==============================================
  # Default animation increase/decrease
  # Positive values = increase
  # Negative values = decrease
  Default_Increase = 0
  def self.zoom(id)
    case id
    #========================
    # Configure Sizes
    # Do:
    # when animation_id then return resize_amount_in_percent
    # Example:
    # when 67 then return 300
    # It increases the animation by 300 percent
    # Use negative values to decrease an animation.
    #
    # Note: When decreasing an animation size it can
    # only decrease it as much as possible before making
    # the animation dissappear.
    #========================
    when 67 then return 300
    when 1 then return -90
    end
    return 0
  end
  #==============================================
  # End Config
  #==============================================
end
class Game_System
  attr_accessor :anim_event
  attr_accessor :is_event
  alias gg_init_anim_resize_lat initialize
  def initialize
    @anim_event = true
    @is_event = false
    gg_init_anim_resize_lat
  end
end
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
            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
        sprite.x += cell_data[i, 1]
        sprite.y += cell_data[i, 2]
        sprite.z = 2000
        sprite.ox = 96
        sprite.oy = 96
        if $scene.is_a?(Scene_Map) && $game_system.anim_event
          zoom = GGHAN.zoom(@_animation.id)
          if zoom < 0
            c = -zoom
            if cell_data[i, 3] <= c
              c = cell_data[i, 3] - 1
              cc = cell_data[i, 3] - c
              #p cc.to_s + " IF " + cell_data[i, 3].to_s
            else
              cc = cell_data[i, 3] - c
              #p cc.to_s + " ELSE " + cell_data[i, 3].to_s
            end
          else
            cc = cell_data[i, 3] + zoom
          end
          sprite.zoom_x = cc / 100.0
          sprite.zoom_y = cc / 100.0
        elsif $scene.is_a?(Scene_Map) && !$game_system.anim_event
          cc = cell_data[i, 3]
          sprite.zoom_x = cc / 100.0
          sprite.zoom_y = cc / 100.0
        elsif $scene.is_a?(Scene_Battle)
          zoom = GGHAN.zoom(@_animation.id)
          cc = cell_data[i, 3] + zoom
          sprite.zoom_x = cc / 100.0
          sprite.zoom_y = cc / 100.0
        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
Reply }
#2
Well, what I think that I understood about the inner working of this script is that it is supposed to work like this:

GGHAN.zoom(animation_id)

In order to include as many animations as you may need to increase or to decrease, you need to edit the case statement

case id
when 67 then return 300
when 1 then return -90
### another when ID then return (+ / -) percentage
end

But as you may have already noticed after a few attempts to get the script work the way you want, the script doesn't include such a feature and might need to be (partially or entirely) rewritten before it allows you to change the animations size while being focused on any event. So be patient and check every so often in case that any scripter may have posted some specific solution for your scripting issue.
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9

Maranatha!

The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.

[Image: SP1-Scripter.png]
[Image: SP1-Writer.png]
[Image: SP1-Poet.png]
[Image: SP1-PixelArtist.png]
[Image: SP1-Reporter.png]

My Original Stories (available in English and Spanish)

List of Compiled Binary Executables I have published...
HiddenChest & Roole

Give me a free copy of your completed game if you include at least 3 of my scripts! Laughing + Tongue sticking out

Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE
Reply }
#3
I understand how the script works, I am just not sure how to tell if an animation is being applied to an Actor and not an Enemy. Once I figure that out it is a simple change;
from:
elsif $scene.is_a?(Scene_Battle)
to :
elsif $scene.is_a?(Scene_Battle) && (sprite is on top of Actor)
Reply }
#4
I figured it out! Using Battle Animation 'Flip' Control http://save-point.org/thread-2584.html as a base, one can simply edit the flip effect into a zoom effect.
Reply }


Possibly Related Threads…
Thread Author Replies Views Last Post
   Animation Action justpassingby 16 18,185 11-06-2017, 01:59 AM
Last Post: justpassingby
   Atoa Custom Battle System CTB animation while cast Noctis 6 10,940 01-04-2016, 03:05 PM
Last Post: Noctis
  Help editing a script Iqus 3 5,569 02-17-2014, 08:33 PM
Last Post: JayRay
   Auto-play Character animation Taylor 0 3,115 05-30-2012, 11:56 AM
Last Post: Taylor
   Changing the walking animation shadow040 8 11,386 01-30-2010, 04:20 PM
Last Post: shadow040



Users browsing this thread: 1 Guest(s)