[VX Ace] Main character/followers change sprite when dashing

Hi everyone,

I’ve semi-successfully found a script that simply changes the player/followers sprites when they are dashing. However, it seems if you hold shift pre-emptively, the script will crash the game. Otherwise, it does exactly what I wanted it to do. It’s a fairly old script, and the original page containing it is lost, so I have attached it to this post.

I am aware of Galv’s character animations and Victor engine’s character control. Galv’s script seems to conflict with one of his own scripts, and Victor’s scripts also conflict with some of my own. Doing this through common events also conflicts with some of the game’s other common events. Modern Algebra wrote a near-identical script, but it's for VX. If possible, it’d be great if someone were able to fix up this small but otherwise perfect script to prevent this error.

Ruby:
#==============================================================================
# ** Sprite_Character
#------------------------------------------------------------------------------
#  This sprite is used to display characters. It observes an instance of the
# Game_Character class and automatically changes sprite state.
#==============================================================================
class Game_Follower < Game_Character
  def dash?
    $game_player.dash?
  end
  def real_move_speed
    $game_player.real_move_speed
  end
end

class Sprite_Character < Sprite_Base
  #--------------------------------------------------------------------------
  # * OVERWRITE Update Transfer Origin Bitmap
  # Still "works" if this was aliased instead but the sprite graphic
  # would flash, since it would change to the default/non prefixed graphic
  # then back to the the one with the prefix.
  #--------------------------------------------------------------------------
  def update_bitmap
    update_dash
    if graphic_changed?
      @tile_id = @character.tile_id
      @character_name = @character.character_name if [email protected]?
      @character_index = @character.character_index
      if @tile_id > 0
        set_tile_bitmap
      else
        set_character_bitmap
      end
    end
  end



  #--------------------------------------------------------------------------
  # * Adds "_dash" prefix to sprite if dashing
  #--------------------------------------------------------------------------
  def update_dash
    return unless @character.moving?
    return unless @character.dash?
    @character_name = @character.character_name + "_dash"
  end
end
When exactly does it crash?
While in the normal walking animation? Or the dashing animation?
Here what I mean is that we gotta define what's the actual stage that fails in your game.
That would tell us if there's no dashing or walking charset available at that point. Or when a normal "string" becomes nil aka nothing.
When exactly does it crash?
While in the normal walking animation? Or the dashing animation?
Here what I mean is that we gotta define what's the actual stage that fails in your game.
That would tell us if there's no dashing or walking charset available at that point. Or when a normal "string" becomes nil aka nothing.

Whoops, should have explained that a little more. It crashes during any map transition where shift is held. This includes going from the title screen into any map. I think the issue is probably caused by the script trying to call a charset that hasn't been loaded in yet.
Nah, it can load that charset on demand. Have you made sure none of your heroes have a non existing charset still assigned to them on the Actors tab? Or you added a previously deleted hero to the party...
I've made sure, the issue seems to be with the script since I've also tested the script within a blank, unmodified project and it crashes in an identical way. I'm not attached to the script itself, though. If someone were to write a script that does the same thing (changes the charset of party members when dashing) I'd greatly appreciate it.
Incomplete Version

Ruby:
# * Character's Dash Animation * #
#   Scripter : Kyonides Arkanthes
#   2024-04-06

# 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 = @character.dash? && Input.dir4 > 0
    if graphic_changed? or dashing != @last_dashing
      @last_dashing = dashing
      @tile_id = @character.tile_id
      @character_name = @character.character_name
      @character_name += DASH_SUFFIX if @last_dashing
      @character_index = @character.character_index
      if @tile_id > 0
        set_tile_bitmap
      else
        set_character_bitmap
      end
    end
  end
end
Big thanks for making this, exactly what I was looking for.
Is it possible you could add a switch to turn the script's functionality on/off like in the VX script I originally linked? I have some scenes where the player has a different sprite that will not require a dash animation.

The party members also do not seem to be changing their sprites when they dash like the player does.
Allegedly the Final Version

Spoiler: Old Stable Version
Ruby:
# * Character's Dash Animation * #
#   Scripter : Kyonides Arkanthes
#   2024-04-06

# 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 FINAL VERSION

Go to Character's Dash Animation ACE thread to find it.
Thanks again, much appreciated.

Original thread: https://forums.rpgmakerweb.com/threads/vx-ace-main-character-followers-change-sprite-when-dashing.167519/