Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

switching character on the same map

Jking

Member

i started my game and im wondering is there a way to switch the main character part way through but do the switch on the same map
 

khmp

Sponsor

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
  #--------------------------------------------------------------------------
  # * Add an Actor
  #     actor_id : actor ID
  #--------------------------------------------------------------------------
  def party_leader(actor_id)
    # Get the actor
    actor = $game_actors[actor_id]
    
    # If the actor to become leader is already in the party. Kill him...
    @actors.delete(actor) if @actors.include?(actor)
    
    # Lose the current leader.
    @actors.shift
    # Add new management for less pay.
    @actors.unshift(actor)
    
    # Refresh player
    $game_player.refresh
  end
end

I know its not the scripting forum but I think this will still help you out. Open up your game and then the script editor. F11's the shortcut. On left side, scroll all the way down until you see "Main". Right click "Main" and select insert. Name this section "Game_Party", now paste the code above into the section on the right. Click apply and exit the script editor.

Now inside your game create an event and lets say you want actor 5 to step in for the party leader. Go to the last page of the event commands and select "Script..."

Use this line:
Code:
$game_party.party_leader(5)

This will replace your party leader with actor 5 in the database.

I guess the event command way is to save the party members that aren't the leader to variables than remove everyone than add the new leader and the party members that were saved. But that sounds like too much work for me.

Good luck with it Jking! :thumb:
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top