Inside a Map - Player followers turn at sides

Hi there, this is ZoroarX here.

Today my question is: How to make the player followers turn a different sides?

Like, when I use the Set Move Route and I make other events and the own player turn left, right, up or down it's easy but what about the Player followers? How do I do it?
$game_player.followers is the array that contains your followers. So if you have a full party, your leader will be $game_player, and your three followers will be $game_player.followers[0], $game_player.followers[1] and $game_player.followers[2]


Each one is a Game_Character just like your $game_player. So you can execute the same movement commands on them. Take a look at the Game_Character class, in the process_move_command method. Those are all the movement commands you could call directly on your follower. So things like this:


$game_player.followers[0].set_direction(4)


$game_player.followers[1].turn_right_90


$game_player.followers[2].turn_away_from_player


$game_player.followers[0].jump(0, 0)


If you want ALL of them to do the same thing, it'd probably be something like this (untested, so syntax may not be quite right):


$game_player.followers.each { |follower| follower.set_direction(6) }


This all assumes you are not using custom scripts that override the followers system. And, naturally, you would probably want to avoid any actual movement commands unless you're doing a cutscene and ensure they all end up in their original positions, otherwise you could make bad things happen to the default follower handling.


You would use these commands inside a Call Script command, or you could even use them in a Script call inside a Set Move Route (even if the move route applies to the player or a different event) - you still have to put the full $game_player.followers[x] because there's nothing in a move route or other event command that will target a specific follower.


Note: Make sure you HAVE the follower before referring to it in the array. If your party consists of only 2 people, $game_player.followers will only have one element [0] - so if you refer to $game_player.followers[2] your game will crash. The first element in the array will be [0] and the last element will be [size - 1] so you could do a check on $game_player.followers.size to make sure it's greater than the element you want to refer to, if there's doubt about how many might be in your party at any point.
Thanks  ZoroarX   

for asking this question.  Once again, Shaz has not only answered a question, but opened up a vast multitude of opportunities for game play for all of us.
@Shaz: Thank you for answering the question. That helped a LOT!

@Dragonduke Okay, you're welcome, Dragonduke.
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/inside-a-map-player-followers-turn-at-sides.15617/