New account registration is temporarily disabled.

[RMVX ACE] HOW TO CHANGE THE DISTANCE BETWEEN FOLLOWERS?

Posts

Pages: 1
I'm looking for a method that will allow me to change the distance between followers in-game with a variable. I'm not sure what the code would be for this.

My project has a style change that happens to fit with different moods in the game, and I'd like to change the follower distance so they're not so close together.

Style 1


Style 2



I'm using the default script for handling followers. Thank you for any help.
Marrend
Guardian of the Description Thread
21806
My initial guess as to how followers normally move would be the `Game_Follower.chase_preceding_character` function.

class Game_Follower < Game_Character
  def chase_preceding_character
    unless moving?
      sx = distance_x_from(@preceding_character.x)
      sy = distance_y_from(@preceding_character.y)
      if sx != 0 && sy != 0
        move_diagonal(sx > 0 ? 4 : 6, sy > 0 ? 8 : 2)
      elsif sx != 0
        move_straight(sx > 0 ? 4 : 6)
      elsif sy != 0
        move_straight(sy > 0 ? 8 : 2)
      end
    end
  end
end

So, it kinda looks like a follower starts to move when the distance between said follower, and the preceding character's distance is not 0 from any direction. My other guess is that it could measure that distance in tiles, but, it's certainly possible it measures that distance in pixels.

For followers to be further apart, what I might try first is to alter the conditionals to be something like...

if (sx > 1 || sx < -1) && (sy > 1 || sy < -1)
  move_diagonal(sx > 0 ? 4 : 6, sy > 0 ? 8 : 2)
  elsif sx > 1 || sx < -1
    move_straight(sx > 0 ? 4 : 6)
  elsif sy > 1 || sy < -1
    move_straight(sy > 0 ? 8 : 2)
  end
end
...that? Definitely put the edit into a separate code-page!

My general theory here is test how sensitive the system is to smaller changes. If the distance is measured in tiles, it should be fairly apparent. If it's measured in pixels, you might not be able to make an observable change.
Marrend
Guardian of the Description Thread
21806
Alternate hack: have an actor with no graphic, and slide it it between each actual follower.

class Game_Follower < Game_Character
  #--------------------------------------------------------------------------
  # * Get Corresponding Actor
  #--------------------------------------------------------------------------
  def actor
    if @member_index
      $game_party.battle_members[@member_index]
    else
      $game_actors[11]
    end
  end
end

class Game_Followers
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     leader:  Lead character
  #--------------------------------------------------------------------------
  def initialize(leader)
    @visible = $data_system.opt_followers
    @gathering = false                    # Gathering processing underway flag
    @data = []
    @data.push(Game_Follower.new(nil, leader))
    @data.push(Game_Follower.new(1, @data[-1]))
    (2...$game_party.max_battle_members*2).each do |index|
      @data.push(Game_Follower.new(nil, @data[-1]))
      @data.push(Game_Follower.new(index, @data[-1]))
    end
  end
end

This one I tested with in a new/empty project/map, and the results were looking pretty good.
Pages: 1