Save-Point
Is there a script to make train actors face the same way as the player? - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Games Development (https://www.save-point.org/forum-4.html)
+--- Forum: Code Support (https://www.save-point.org/forum-20.html)
+--- Thread: Is there a script to make train actors face the same way as the player? (/thread-13442.html)

Pages: 1 2


RE: Is there a script to make train actors face the same way as the player? - kyonides - 04-03-2026

Well, Dog Wulfo already provided you with this:

Code:
#==============================================================================
# ** Game_Party
#------------------------------------------------------------------------------
# This class handles the party. It includes information on amount of gold
# and items. Refer to "$game_party" for the instance of this class.
#==============================================================================
class Game_Party
  #--------------------------------------------------------------------------
  # * Move Left
  # id: party member ID
  #--------------------------------------------------------------------------
  def make_me_move_left(id)
    character = @characters[id]
    character.move_left
  end

  def members_turn_down
    @characters.each{|c| c.turn_down }
  end

  def members_turn_left
    @characters.each{|c| c.turn_left }
  end

  def members_turn_right
    @characters.each{|c| c.turn_right }
  end

  def members_turn_up
    @characters.each{|c| c.turn_up }
  end
end

You'd still need to make the lead character turn left or anywhere else manually. Happy with a sweat

Or use this extended patch instead. Grinning

Code:
#==============================================================================
# ** Game_Party
#------------------------------------------------------------------------------
# This class handles the party. It includes information on amount of gold
# and items. Refer to "$game_party" for the instance of this class.
#==============================================================================
class Game_Party
  #--------------------------------------------------------------------------
  # * Move Left
  # id: party member ID
  #--------------------------------------------------------------------------
  def make_me_move_left(id)
    character = @characters[id]
    character.move_left
  end

  def members_turn_down
    $game_player.turn_down
    @characters.each{|c| c.turn_down }
  end

  def members_turn_left
    $game_player.turn_left
    @characters.each{|c| c.turn_left }
  end

  def members_turn_right
    $game_player.turn_right
    @characters.each{|c| c.turn_right }
  end

  def members_turn_up
    $game_player.turn_up
    @characters.each{|c| c.turn_up }
  end
end

EDIT:

Here's the script call:

$game_party.members_turn_left


RE: Is there a script to make train actors face the same way as the player? - DerVVulfman - 04-04-2026

For a lark, here is an example script that makes all the following party members face the same direction as the player no matter what direction they are moving.

Code:
#==============================================================================
# ** Game_Party
#------------------------------------------------------------------------------
#  This class handles the party. It includes information on amount of gold
#  and items. Refer to "$game_party" for the instance of this class.
#==============================================================================

class Game_Party

  #--------------------------------------------------------------------------
  # * Face Down
  #    id: party member ID
  #--------------------------------------------------------------------------
  def face_down(id)
    #
    character = @characters[id]                   # Get the train 'actor' by ID
    character.turn_down                           # Use Game_Character turn cmd
    #
  end

  #--------------------------------------------------------------------------
  # * Face Left
  #    id: party member ID
  #--------------------------------------------------------------------------
  def face_left(id)
    #
    character = @characters[id]                   # Get the train 'actor' by ID
    character.turn_left                           # Use Game_Character turn cmd
    #
  end

  #--------------------------------------------------------------------------
  # * Face Right
  #    id: party member ID
  #--------------------------------------------------------------------------
  def face_right(id)
    #
    character = @characters[id]                   # Get the train 'actor' by ID
    character.turn_right                          # Use Game_Character turn cmd
    #
  end

  #--------------------------------------------------------------------------
  # * Face Up
  #    id: party member ID
  #--------------------------------------------------------------------------
  def face_up(id)
    #
    character = @characters[id]                   # Get the train 'actor' by ID
    character.turn_up                             # Use Game_Character turn cmd
    #
  end  

end



#==============================================================================
# ** Game_Character
#------------------------------------------------------------------------------
#  This class deals with characters. It's used as a superclass for the
#  Game_Player and Game_Event classes.
#==============================================================================

class Game_Character
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  alias game_char_all_party_faces update
  
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    #
    if self.is_a?(Game_Player)                    # If testing the player
      change_facing(@direction)                   # Change facing on player dir
    end
    game_char_all_party_faces                     # Perform the original call
    #
  end
  
  #--------------------------------------------------------------------------
  # * Change facing direction of party members
  #     facing : player facing direction
  #--------------------------------------------------------------------------
  def change_facing(facing)
    #
    for actor in 0..2                             # Cycle through followers
      case facing                                 # Branch on player direction
      when 2 ; $game_party.face_down(actor)       # Run face down for actor
      when 4 ; $game_party.face_left(actor)       # Run face left for actor
      when 6 ; $game_party.face_right(actor)      # Run face right for actor
      when 8 ; $game_party.face_up(actor)         # Run face up for actor
      end
    end
    #
  end
  
end



RE: Is there a script to make train actors face the same way as the player? - Ace_V - 04-07-2026

Thanks for the help, kyonides and DerVVulfman!

I realized I could use the previous make_me_turn script call and put those in a common event with conditional branches that checked the player's direction.  Happy with a sweat That solved it

There are some instances in the game where you could approach story-related NPCs from various directions, and so I couldn't just use make_me_turn_right or any specific direction because I would not know where the player would approach the NPC from. Only realized today that I could use conditional branches to find out.  Laughing