Chaos Project

RPG Maker => RPG Maker Scripts => Script Requests => Topic started by: Stray on September 16, 2012, 06:11:10 pm

Title: Raising the frequence of character animations while running
Post by: Stray on September 16, 2012, 06:11:10 pm
I want to set the default speed of my hero "4: fast" to the default speed for running in Blizz ABS.
But the sequence of the sprites are not played fast enough for the running animation.

So he should have the same speed, but a faster changing of the sprite.

(I'm sorry for my weird english, I hope it's understandable)
Title: Re: Raising the frequence of character animations while running
Post by: KK20 on September 16, 2012, 08:43:06 pm
The frequency of how quickly the character's sprite changes is based on this formula located within Game_Character 2:
if @anime_count > 18 - @move_speed * 2
@anime_count increases by 1 for each frame the character is moving. It resets to zero when it is greater than the value on the right.

You didn't really specify how fast you want the sprites to change, so I cannot provide help. My suggestion is to change the 18 in that equation until it fits perfectly with your running animation and then report back here for further help.
Title: Re: Raising the frequence of character animations while running
Post by: Stray on September 17, 2012, 11:58:23 am
This was a good help. Thank you. Just between 2 and 3 frames less were enough. :]
Title: Re: Raising the frequence of character animations while running
Post by: KK20 on September 17, 2012, 10:37:37 pm
Paste below BABS and be sure to configure it.
Spoiler: ShowHide
module CharaSprites
 
  def self.frames(filename)
    case filename
  #===========================================================================
  # - CharaSprites.frames
  #     Set the number of frames that the sprite should run through before
  #   updating to the next image frame.
  #
  #     When setting names, be sure to use the image's filename as it appears
  #   in the folder 'Graphics\Characters'
  #
  #     Also note that the old equation remains: 18 - @move_speed * 2
  #   However, with this script, it allows you to change the '18' into whatever
  #   you want it to be.
  #===========================================================================
    when 'Aluxes_run' then return 15
    #when 'name' then return x
  #===========================================================================
  #
  # E N D   C O N F I G U R A T I O N
  #
  #===========================================================================
    else
      # Returns the default 18
      return 18
    end
  end
end

class Game_Character
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Branch with jumping, moving, and stopping
    if jumping?
      update_jump
    elsif moving?
      update_move
    else
      update_stop
    end
    # If animation count exceeds maximum value
    # * Maximum value is move speed * 1 taken from basic value 18
    if @anime_count > CharaSprites.frames(@character_name) - @move_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
    # If waiting
    if @wait_count > 0
      # Reduce wait count
      @wait_count -= 1
      return
    end
    # If move route is forced
    if @move_route_forcing
      # Custom move
      move_type_custom
      return
    end
    # When waiting for event execution or locked
    if @starting or lock?
      # Not moving by self
      return
    end
    # If stop count exceeds a certain value (computed from move frequency)
    if @stop_count > (40 - @move_frequency * 2) * (6 - @move_frequency)
      # Branch by move type
      case @move_type
      when 1  # Random
        move_type_random
      when 2  # Approach
        move_type_toward_player
      when 3  # Custom
        move_type_custom
      end
    end
  end
end
Title: Re: Raising the frequence of character animations while running
Post by: Stray on September 18, 2012, 12:27:32 pm
Thank you very much for telling how to shorten the running animation from the BABS, too.
That will be useful for sure!