Author Topic: [XP] Heretic's Animation Speed  (Read 2697 times)

Offline Heretic86

  • Astral Trancist
  • *****
  • Posts: 776
  • LV: 34
    • View Profile
[XP] Heretic's Animation Speed
« on: January 14, 2014, 04:16:57 AM »
Heretic's Animation Speed
Authors: Heretic
Version: 1.0
Type: Event Animation Add On
Key Term: Movement Add-on

Introduction

Animation Speed for Events is tied to Move Speed.  Not any more.

This script allows you to set the Animation Speed independent of Move Speed.  This allows for a Fairy or Flying Creature that flaps its wings very quickly while moving slowly.  Watch a child walk next to an adult.  The child will have to take many more steps to keep up with the adult, even if they move at the same speed.  This script allows you to control how quickly each character can step.

This script is also set up to allow you to control the Animation Speed PER PAGE.

Features

  • Control Animation Speed independant of Move Speed
  • Animation is set Per Event Page
  • You got your Chocolate in my Peanut Butter
  • Compatible with or without SDK

Screenshots

Its an Animation so still screenshots don't show the effect.

Demo

No demo, yet.


Script

Place just below the SDK if you use it.  Otherwise, try to place it below Scene_Debug.


(click to show/hide)

Instructions

To use this script, make a One Line Comment that says "anime_speed = x"

X is a Number that was originally a character's Move Speed.  Thus, 1 is a very slow Animation Speed while 6 is a very fast Animation Speed.  You can use Decimals if you wish.  There is also no limit on an Animation Speed so you can set the Animation Speed to something ridiculusly high, like 10!

You can set the Animation Speed in a Move Route Script by simply setting @anime_speed = X

You can set the Animation Speed "remotely" by a Script with $game_map.events[event_id].anime_speed = x or $game_player.anime_speed = x.

Notes:  When ever an Event changes Pages, it will initially clear any "remotely" assigned Animation Speeds.  These speeds will need to be Reassigned.  If an Event Page does NOT have a Comment on that Page, when that Event Page will use Move Speed over any previously assigned Animation Speeds. 

Player will retain Animation Speeds until it is cleared.

To CLEAR an Animation Speed, either do not put a Comment in on that Event Page, or set @anime_speed to NIL.  When @anime_speed is NIL, it will use @move_speed to control the Speed of Animations (default).

Compatibility

Not Compatible with Ketchup and Mustard without Relish.

This script overwrites the update method for Game_Character.  It needs to be above all other Scripts except the SDK.  If another Script overwrites (not alias) the Update method, this script wont be compatible, but is actually quite easy to get it working with the other incompatible script.

The Game_Event refresh method was also aliased.  It is what allows checking for Comments to control Animation Speed.  If another script overwrites the Game_Event refresh method, the Page Comment functionality will be lost, but this is also relatively easy to fix by simply grabbing that section and placing it in a New Script below the Redefining Scripts.

It will most likely be fully compatible with any other script that just aliases Game_Character update and Game_Event refresh methods.

It may not be compatible with Scripts that use a Non Default Sprite Sheet.  Animation Enhancers that allow adding more Frames of Animation to a Character will conflict with this script.  If you have one that needs to be made compatible, let me know and I'll see if I can combine them.


Credits and Thanks

  • I'd like to thank the Academy...
  • I'd also like to thank the creators of Bottled Ketchup for creating a Non Neutonian Fluid because Ketchup is actually a Solid and Liquid, and have decided to make Ketchup remain in a Solid State when pouring and thus unpourable when in a Non Squeezable Bottle where it refuses to be poured out without excessive shaking or something to stick into the bottle.
  • I'd like to thank the creators of Clam Shell Packaging for creating packages that are impossible to open for items that do not need an impossible to open package.

Author's Notes

I did not place any arbitrary limits on the Comments.  You can use Spaces or No Spaces when putting "anime_speed = X" into a Comment on an Event Page.  That Configuration Comment does NOT need to be at the Top of the Event Page, but does need to be within the first ten Commands in the List of Event Commands.  This is a balance between Performance and Compatability.  Some scripts were set up so they require a Comment as the First Command on an Event Page.  You can place "anime_speed = X" below that and it will still work.
Current Scripts:
Heretic's Moving Platforms

Current Demos:
Collection of Art and 100% Compatible Scripts

(Script Demos are all still available in the Collection link above.  I lost some individual demos due to a server crash.)

Offline Zexion

  • Addicted to LoL
  • Chaos User
  • ******
  • Posts: 1519
  • LV: 69
  • Gender: Male
  • My anaconda don't...jk it does
    • View Profile
Re: [XP] Heretic's Animation Speed
« Reply #1 on: January 14, 2014, 04:37:42 AM »
very nice script. i've always hated this fact and i will probably use this haha.

Offline LiTTleDRAgo

  • Astral Trancist
  • *****
  • Posts: 851
  • LV: 517
  • Gender: Male
    • View Profile
    • ~
Re: [XP] Heretic's Animation Speed
« Reply #2 on: January 14, 2014, 10:06:38 AM »
another way without override update method

Code: [Select]
#==============================================================================
# ** Game_Character
#------------------------------------------------------------------------------
#  This class deals with characters. It's used as a superclass for the
#  Game_Player and Game_Event classes.
#==============================================================================
class Game_Character
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #-------------------------------------------------------------------------- 
  attr_accessor        :anime_speed   # Overrides Move Speed for Animations
  #--------------------------------------------------------------------------
  # * Update Jump, Update Move, Update Stop, Frame Update
  #--------------------------------------------------------------------------
  [:update_jump,:update_move,:update_stop,:update].each do |method|
    _alias = :"heretic_anim_speed_#{method}"
    method_defined?(_alias) || alias_method(_alias, method)
    define_method(method) do |*args|
      result = send(_alias, *args)
      if @anime_speed.is_a?(Numeric)
        move   = @heretic_anim_move_speed
        method.eql?(:update) ? move && (@move_speed = move) : anime_speed_update
      end
      result
    end
  end
  #--------------------------------------------------------------------------
  # * Animation Speed Update for Game Character
  #
  #   * Used by both SDK and Non SDK
  #
  #   * This is called when @anime_speed for a Character is set.  It uses
  #     the Animation Speed over the Move Speed so that Animation Speed is
  #     independant of a Character's Move Speed
  #--------------------------------------------------------------------------
  def anime_speed_update
    # If animation count exceeds maximum value
    # * Maximum value is move speed * 1 taken from basic value 18
    #if @anime_count > 18 - @move_speed * 2         # Original Code
    if @anime_count > 18 - @anime_speed * 2
      # If stop animation is OFF when stopping
      if not @step_anime and @stop_count > 0
        # Return to original pattern
        @pattern = @original_pattern
      # If stop animation is ON when moving
      else
        # Update pattern
        @pattern = (@pattern + 1) % 4
      end
      # Clear animation count
      @anime_count = 0
    end
    @heretic_anim_move_speed = @move_speed          # Added
    @move_speed = -99                               # Added
  end 
end # End Game Character Class
« Last Edit: January 14, 2014, 10:24:45 AM by LiTTleDRAgo »