Character's Dash Animation

Character's Dash Animation
2 Versions

by Kyonides​

Introduction

This is pretty much a plug & play script that will allow you to change the dash animation of the whole party. You must have an extra character spritesheet and name it something like "original_sheet1_dash.png", being "original_sheet1" the actual filename of the original actor spriteset. Then the script will switch from one to another in no time depending on the Dash button and any arrow key or its equivalent.

The Original Script - Updated

Spoiler
Ruby:
# * Character's Dash Animation * #
#   Scripter : Kyonides Arkanthes
#   2025-07-16

# You will need some extra character spritesheets to make it work.
# Their filenames should include the _dash suffix or they will be ignored.
# It will crash if you never move them in the Graphics/Characters directory.
 
class Game_Character
  def actor?
    false
  end
end

class Game_Player
  def actor?
    true
  end
end

class Game_Follower
  def actor?
    true
  end
end

class Sprite_Character
  DASH_SUFFIX = "_dash"
  alias :kyon_char_dash_anime_sprt_char_up_bit :update_bitmap
  def initialize(viewport, character=nil)
    super(viewport)
    @character = character
    @party_member = character.actor?
    @balloon_duration = 0
    update
  end

  def update_bitmap
    if @party_member
      bitmap_update
    else
      kyon_char_dash_anime_sprt_char_up_bit
    end
  end

  def bitmap_update
    dashing = ($game_player.dash? && Input.dir4 > 0)
    if graphic_changed? or dashing != @dashing
      @dashing = dashing
      @tile_id = @character.tile_id
      @character_name = @character.character_name
      @character_name += DASH_SUFFIX if !@character_name.empty? && @dashing
      @character_index = @character.character_index
      if @tile_id > 0
        set_tile_bitmap
      else
        set_character_bitmap
      end
    end
  end
end

The Editable Map Dash Add-On
It lets you alter a map's dashing feature without altering the original map data.
Spoiler: Add-On
Ruby:
# * Character's Dash Animation - Editable Dash Add-On * #
#   Scripter : Kyonides Arkanthes
#   2025-07-16

# * Script Calls * #
# To Disable Dashing:
#   $game_map.disable_dashing = true
# To Use the Usual Map Dashing Setup:
#   $game_map.disable_dashing = nil

class Game_Map
  attr_accessor :disable_dashing
  def disable_dash?
    @disable_dashing || @map.disable_dashing
  end
end

The Omega Orca Edition
Basically, the only new feature it includes is that it lets you add 1 or more horizontal frames to a given character's spritesheet, and adds the new pattern_max variable so it never skips any of the extra frames while updating the animation.
Now it also affects all window classes by overwriting the draw_character method.

Spoiler
Ruby:
# * Character's Dash Animation * #
# - Omega Orca Edition - #
#   Scripter : Kyonides Arkanthes
#   v0.5.0 - 2025-03-15

# You will need some extra character spritesheets to make it work.
# Their filenames should include the _dash suffix or they will be ignored.
# It will crash if you never move them in the Graphics/Characters directory.

# Overwritten Methods:
# Window_Base#draw_character
# Sprite_Character#set_character_bitmap and #update_src_rect

module DashCharSetup
  WIDTH_MAX_FRAMES = 4
  DASH_SUFFIX = "_dash"
end

class Game_CharacterBase
  alias :kyon_char_dash_anime_gm_charbs_init_pub_mbrs :init_public_members
  def init_public_members
    kyon_char_dash_anime_gm_charbs_init_pub_mbrs
    @pattern_max = DashCharSetup::WIDTH_MAX_FRAMES + 1
  end

  def update_anime_pattern
    if !@step_anime && @stop_count > 0
      @pattern = @original_pattern
    else
      @pattern = (@pattern + 1) % @pattern_max
    end
  end
  attr_reader :pattern_max
end

class Game_Character
  def actor?
    false
  end
end

class Game_Player
  def actor?
    true
  end
end

class Game_Follower
  def actor?
    true
  end
end

class Window_Base
  def draw_character(character_name, character_index, x, y)
    return unless character_name
    @width_frames ||= DashCharSetup::WIDTH_MAX_FRAMES
    bitmap = Cache.character(character_name)
    sign = character_name[/^[\!\$]./]
    if sign && sign.include?('$')
      cw = bitmap.width / @width_frames
      ch = bitmap.height / 4
    else
      cw = bitmap.width / @width_frames * 4
      ch = bitmap.height / 8
    end
    n = character_index
    cx = (n % 4 * @width_frames + 1) * cw
    cy = (n / 4 * 4) * ch
    src_rect = Rect.new(cx, @width_frames, cw, ch)
    contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
  end
end

class Sprite_Character
  include DashCharSetup
  alias :kyon_char_dash_anime_sprt_char_up_bit :update_bitmap
  def initialize(viewport, character=nil)
    super(viewport)
    @character = character
    @party_member = character.actor?
    @balloon_duration = 0
    @width_frames = WIDTH_MAX_FRAMES
    update
  end

  def update_bitmap
    if @party_member
      bitmap_update
    else
      kyon_char_dash_anime_sprt_char_up_bit
    end
  end

  def bitmap_update
    dashing = ($game_player.dash? && Input.dir4 > 0)
    if graphic_changed? or dashing != @dashing
      @dashing = dashing
      @tile_id = @character.tile_id
      @character_name = @character.character_name
      @character_name += DASH_SUFFIX if !@character_name.empty? && @dashing
      @character_index = @character.character_index
      if @tile_id > 0
        set_tile_bitmap
      else
        set_character_bitmap
      end
    end
  end

  def set_character_bitmap
    self.bitmap = Cache.character(@character_name)
    sign = @character_name[/^[\!\$]./]
    if sign && sign.include?('$')
      @cw = bitmap.width / @width_frames
      @ch = bitmap.height / 4
    else
      @cw = bitmap.width / @width_frames * 4
      @ch = bitmap.height / 8
    end
    self.ox = @cw / 2
    self.oy = @ch
  end

  def update_src_rect
    return if @tile_id != 0
    index = @character.character_index
    pattern = @character.pattern < @width_frames ? @character.pattern : 1
    sx = (index % 4 * @width_frames + pattern) * @cw
    sy = (index / 4 * 4 + (@character.direction - 2) / 2) * @ch
    self.src_rect.set(sx, sy, @cw, @ch)
  end
end

Terms & Conditions

Free for use in ANY game.
Due credit is mandatory.
Miss the eclipse on April 8th. [Yes, it's a joke.]
That's it! 😛
Is it possible to combine with the VE - Multi Frames script?
I am trying to make your script and the above mentioned script work equally, however, the dash animation shows corrupted, even though I have made room for 4 frames per character.
Script Update!​

Well, I didn't really do anything about other people's multi-frames scripts, but the new The Omega Orca Edition now lets you predefine how many columns your character spritesheet should have, just in case you didn't stick to the default RMVX ACE 3x4 frames format at all. :ewink:
Minor Updates Available Now!​

From now on you can find the Editable Map Dash Add-On on the main post. It will let you alter a map's dashing feature at will without altering the original map data, but please read the embedded comments first.

The original script also got a minor update. I simply included some parentheses in the bitmap_update method just in case someone's engine was only getting a result from an incomplete boolean test. That should not ever happen, but I still added them just in case.

Original thread: https://forums.rpgmakerweb.com/threads/characters-dash-animation.167574/