Galv's Character Animations Edit issue

Some months ago, I asked in this topic on how to edit a dash graphic change script, and while I managed to edit Galv's script to my use, I ended up noticing a bug only now...
Specifically, its related to those lines:
Code:
        $game_party.members.each { |m| m.set_g(2) } if c = 0
        $game_party.members.each { |m| m.set_g(6) } if c = 4

        $game_party.members.each { |m| m.set_g(0) } if c = 2
        $game_party.members.each { |m| m.set_g(4) } if c = 6
Basically, the script only works the way intended for the characters in index 4 (or the characters in index 0, if you invert the line order), because for some reason it seems to ignore the "if c =" part I've put and considers only the last line as... "absolute"?
I tried putting those two lines in case and if conditions, but even then, this happens:

Spoiler
nbJIXoi.gif

(Notice how Eric doesn't change back to Eric and changes to Ernest even if he didn't start dashing)

Here's the full method:

Code:
def move_anim
    c = $game_party.leader.character_index
    if $game_player.dash?
      if c != [2,6]
        $game_party.members.each { |m| m.set_g(2) } if c = 0
        $game_party.members.each { |m| m.set_g(6) } if c = 4
        $game_player.refresh
      end
    else
      if c != [0,4]
        $game_party.members.each { |m| m.set_g(0) } if c = 2
        $game_party.members.each { |m| m.set_g(4) } if c = 6
        $game_player.refresh
      end
    end
    @idletime = 0
end
It should be 'if c == 0' rather than 'if c = 0'. The latter just sets c to 0.
It corrected the change of graphic when walking first instead of running, but the problem returns when you dash :/
Looking at it properly now, the reason is because Galv's script is set up so that for each character set, index 0 is the idle animation, index 1 is the walking animation and index 2 is the dashing animation. Why don't you just set up your characters in separate sheets like the script says?

EDIT: Okay, I whipped something up that should work. It's mostly based on Galv's script, but you shouldn't use both of them together. Let me know if you have any issues.
Spoiler
Code:
class Game_CharacterBase
  attr_reader :og_character_index, :dash_character_index
 
  alias amn_dash_gamecharabase_initpubmems  init_public_members
  def init_public_members
    amn_dash_gamecharabase_initpubmems
    @og_character_index = @character_index
    @dash_character_index = [@character_index + 2, 7].min
  end
 
  alias amn_dash_gamecharabase_setgraphic  set_graphic
  def set_graphic(character_name, character_index)
    amn_dash_gamecharabase_setgraphic(character_name, character_index)
    @og_character_index = character_index
    @dash_character_index = [character_index + 2, 7].min
  end

  def update_chara_index(index)
    @character_index = index
  end
 
end

class Game_Player < Game_Character
 
  alias amn_dash_gameplayer_refresh refresh
  def refresh
    unless dash?
      @og_character_index = actor.character_index
      @dash_character_index = [actor.character_index + 2, 7].min
    end
    amn_dash_gameplayer_refresh
  end

end

class Game_Follower < Game_Character
 
  alias amn_dash_gamefollower_refresh refresh
  def refresh
    unless $game_player.dash?
      @og_character_index = actor.character_index
      @dash_character_index = [actor.character_index + 2, 7].min
    end
    amn_dash_gamefollower_refresh
  end

end

class Sprite_Character < Sprite_Base

  alias amn_dash_spritechara_update  update
  def update
    amn_dash_spritechara_update
    if @character.is_a?(Game_Player) || @character.is_a?(Game_Follower)
      update_dash_anim if $game_player.moving? && $game_player.dash?
      update_nondash_anim if !$game_player.moving? && !$game_player.dash?
    end
  end
 
  def update_nondash_anim
    if @character.character_index != @character.og_character_index
      @character.update_chara_index(@character.og_character_index)
    end
  end
 
  def update_dash_anim
    if @character.character_index != @character.dash_character_index
      @character.update_chara_index(@character.dash_character_index)
    end
  end

end
I can't use it as is because I'm also using Eight Directional Movement (it jumps an index to select the diagonal charset)...

Anyway, your script works great, but for some reason, it gives off an error if it's not pasted in a fresh new project:
5HfQzj5.png

What's strange is that, even if I remove ALL the custom scripts from the project, it still gives off this error :s
Hmm, give this one a try:
Spoiler
Code:
class Game_CharacterBase
  attr_reader :og_character_index, :dash_character_index
 
  alias amn_dash_gamecharabase_initpubmems  init_public_members
  def init_public_members
    amn_dash_gamecharabase_initpubmems
    @og_character_index = @character_index
    @dash_character_index = [@character_index + 2, 7].min
  end
 
  alias amn_dash_gamecharabase_setgraphic  set_graphic
  def set_graphic(character_name, character_index)
    amn_dash_gamecharabase_setgraphic(character_name, character_index)
    @og_character_index = character_index
    @dash_character_index = [character_index + 2, 7].min
  end

  def update_chara_index(index)
    @character_index = index
  end
 
end

class Game_Player < Game_Character
 
  alias amn_dash_gameplayer_refresh refresh
  def refresh
    if actor && !dash?
      @og_character_index = actor.character_index
      @dash_character_index = [actor.character_index + 2, 7].min
    end
    amn_dash_gameplayer_refresh
  end

end

class Game_Follower < Game_Character
 
  alias amn_dash_gamefollower_refresh refresh
  def refresh
    if visible? && !$game_player.dash?
      @og_character_index = actor.character_index
      @dash_character_index = [actor.character_index + 2, 7].min
    end
    amn_dash_gamefollower_refresh
  end

end

class Sprite_Character < Sprite_Base

  alias amn_dash_spritechara_update  update
  def update
    amn_dash_spritechara_update
    if @character.is_a?(Game_Player) || @character.is_a?(Game_Follower)
      update_dash_anim if $game_player.moving? && $game_player.dash?
      update_nondash_anim if !$game_player.moving? && !$game_player.dash?
    end
  end
 
  def update_nondash_anim
    if @character.character_index != @character.og_character_index
      @character.update_chara_index(@character.og_character_index)
    end
  end
 
  def update_dash_anim
    if @character.character_index != @character.dash_character_index
      @character.update_chara_index(@character.dash_character_index)
    end
  end

end
It works perfectly!
It even solved an issue with other script so thank you so much 😀
Thread closed IgnoreMe

Original thread: https://forums.rpgmakerweb.com/threads/galvs-character-animations-edit-issue.116175/