- Joined
- Jun 21, 2015
- Messages
- 1,441
- Reaction score
- 680
- First Language
- Polish
- Primarily Uses
- Other
Hello everybody!
I'd like to ask when the followers move?
In game, they move along with Player, but I want to deconstruct that, because I have 2 players and I need to bind the second follower to second player.
I tried many things, but with no use, so I replaced the default chase method with two new, that are forced manually in update method:
And it works:
But their AI is kinda, well not perfect. I mean it's okay, I can program their movement properly, because the current one is just for testing, but I'd like to ask if this workaround is okay or if there's a better way to do this.
I really can't get where followers' movement is forced by default.
Any suggestions? Thank you in advance.
I'd like to ask when the followers move?
In game, they move along with Player, but I want to deconstruct that, because I have 2 players and I need to bind the second follower to second player.
I tried many things, but with no use, so I replaced the default chase method with two new, that are forced manually in update method:
#==============================================================================# ** Game_Follower#------------------------------------------------------------------------------# This class handles followers. A follower is an allied character, other than# the front character, displayed in the party. It is referenced within the# Game_Followers class.#==============================================================================class Game_Follower < Game_Character #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize(member_index, preceding_character) super() @member_index = member_index #@preceding_character = preceding_character @transparent = $data_system.opt_transparent @through = true end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh @character_name = visible? ? actor.character_name : "" @character_index = visible? ? actor.character_index : 0 end #-------------------------------------------------------------------------- # * Get Corresponding Actor #-------------------------------------------------------------------------- def actor $game_party.battle_members[@member_index] end #-------------------------------------------------------------------------- # * Determine Visibility #-------------------------------------------------------------------------- def visible? actor && $game_player.followers.visible end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update case @member_index when 2 @move_speed = $game_player.real_move_speed @transparent = $game_player.transparent @walk_anime = $game_player.walk_anime @step_anime = $game_player.step_anime @direction_fix = $game_player.direction_fix @opacity = $game_player.opacity @blend_type = $game_player.blend_type when 3 @move_speed = $game_player2.real_move_speed @transparent = $game_player2.transparent @walk_anime = $game_player2.walk_anime @step_anime = $game_player2.step_anime @direction_fix = $game_player2.direction_fix @opacity = $game_player2.opacity @blend_type = $game_player2.blend_type end super #HERE their movement is forced when there's a correct distance. chase_player_1 if distance_x_from($game_player.x) == 2 || distance_x_from($game_player.x) == -2 || distance_y_from($game_player.y) == 2 || distance_y_from($game_player.y) == -2 chase_player_2 if distance_x_from($game_player2.x) == 2 || distance_x_from($game_player2.x) == -2 || distance_y_from($game_player2.y) == 2 || distance_y_from($game_player2.y) == -2 end #-------------------------------------------------------------------------- # * Pursue Preceding Character #-------------------------------------------------------------------------- def chase_preceding_character end def chase_player_1 if @member_index == 2 unless moving? #~ sx = distance_x_from(@preceding_character.x)#~ sy = distance_y_from(@preceding_character.y)#~ case @member_index#~ when 2#~ sx = distance_x_from($game_player.x)#~ sy = distance_y_from($game_player.y)#~ when 3#~ sx = distance_x_from($game_player2.x)#~ sy = distance_y_from($game_player2.y)#~ end sx = distance_x_from($game_player.x) sy = distance_y_from($game_player.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 def chase_player_2 if @member_index == 3 unless moving? #~ sx = distance_x_from(@preceding_character.x)#~ sy = distance_y_from(@preceding_character.y) sx = distance_x_from($game_player2.x) sy = distance_y_from($game_player2.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 #-------------------------------------------------------------------------- # * Determine if at Same Position as Preceding Character #-------------------------------------------------------------------------- def gather? case @member_index when 2 !moving? && pos?($game_player.x, $game_player.y) when 3 !moving? && pos?($game_player2.x, $game_player2.y) end endend
I really can't get where followers' movement is forced by default.
Any suggestions? Thank you in advance.
Last edited by a moderator:

