Pokémon Essentials All questions and discussion about Pokémon Essentials, the Pokémon game kit for RPG Maker XP, go in here. Also contains links to the latest downloads and the Essentials Wiki.

TrollandToad.com
Reply
 
Thread Tools
  #1    
Old December 30th, 2013 (6:29 PM).
Jalla199 Jalla199 is offline
     
    Join Date: Dec 2013
    Posts: 12
    Is it possible to change the player character midway through a game?

    Ex: Playing as Red with a Pikachu up to Cerulean City, and then switching to Blue with a different sprite and party of Pokemon.

    I'd like to be able to have two plots going on in one game, changing between the two players at certain points. Is this even possible?
    Reply With Quote

    Relevant Advertising!

      #2    
    Old December 31st, 2013 (2:07 AM).
    linkthehero's Avatar
    linkthehero linkthehero is offline
       
      Join Date: Sep 2012
      Gender: Male
      Posts: 66
      yes it is simple to do this
      you have just add an new charcter
      (go to pbs -metadata-add a new player(like the other two players )
      than you can later change the charkater in the game with this code
      Comment:initializes player 2 (PlayerC)
      script:pbChangePlayer(2)
      sorry for the bad explanation
      if you still don't understand it please ask me common
      Reply With Quote
        #3    
      Old December 31st, 2013 (3:18 AM).
      tImE's Avatar
      tImE tImE is offline
      It's still me, 44tim44 ;)
         
        Join Date: Mar 2007
        Location: Somewhere in Scandinavia...
        Nature: Relaxed
        Posts: 685
        Like the linkthehero said:
        Simply add "pbChangePlayer(x)" as a script command in the event you want to switch characters in, where x is the ID of the 2nd character, as defined in metadata.txt.
        Metadata.txt is also where you change which sprites, backsprites and overworlds a player-character should have and so forth.
        __________________
        Reply With Quote
          #4    
        Old December 31st, 2013 (3:42 AM).
        Maruno's Avatar
        Maruno Maruno is offline
        Lead Dev of Pokémon Essentials
           
          Join Date: Jan 2008
          Location: England
          Posts: 5,180
          Bear in mind that just changing the player's character will not change their money/party/storage boxes/badges/etc. You'll need to alternate between two sets of those things as you alternate between characters.
          __________________
          Go to the Pokémon Essentials Wiki

          | Downloads | Tutorials | Fangames |
          | All Animations Project |

          Follow me on Twitter: @maruno42


          Reply With Quote
            #5    
          Old December 31st, 2013 (7:27 AM).
          Jalla199 Jalla199 is offline
             
            Join Date: Dec 2013
            Posts: 12
            Quote:
            Originally Posted by Maruno View Post
            Bear in mind that just changing the player's character will not change their money/party/storage boxes/badges/etc. You'll need to alternate between two sets of those things as you alternate between characters.
            Hmm, good to know. How would I code that alternation? I could make a "rule" of the game be that you only use certain pokemon as certain characters, but leaving that up to the player doesn't feel very professional...
            Reply With Quote
              #6    
            Old December 31st, 2013 (6:09 PM).
            Dylanrockin's Avatar
            Dylanrockin Dylanrockin is offline
            That guy
               
              Join Date: May 2011
              Age: 22
              Gender: Male
              Nature: Timid
              Posts: 277
              Quote:
              Originally Posted by Jalla199 View Post
              Hmm, good to know. How would I code that alternation? I could make a "rule" of the game be that you only use certain pokemon as certain characters, but leaving that up to the player doesn't feel very professional...
              I have to agree, because in my game, I would like to the player to have the choice to ACTIVELY switch between characters (since my game follows a traditional RPG, rather than a generic Pokemon game) at will, and doing so would also allow them to switch to the other characters current party. Because currently, the only way that you can switch between characters is if you make an event for it, and you just trigger it, I am quite interested in this to be honest. A custom menu option for this should be very useful without relying on events and stuff.
              Reply With Quote
                #7    
              Old January 1st, 2014 (6:17 PM).
              Stochastic's Avatar
              Stochastic Stochastic is offline
                 
                Join Date: Dec 2013
                Gender: Male
                Posts: 110
                I have character switching in my game, but it's temporary (you can't save the game while you're the other character). Here's what I did in my case; I made two methods, one for storing the current player character "state" in a global variable, and another for restoring that state. State meaning party/money/etc. Storing simply means writing the state in the said global variable and restoring reading the state and writing it back in the $Trainer variable.

                Now this only works if the switch is temporary. If you'd like to be able to save the game while you're the other character, you could do something like this.

                Spoiler:
                def store
                id = $Trainer.id
                $game_system.players[id] = ... # assign a copy of $Trainer
                end

                def restore(id)
                $Trainer = $game_system.players[id]
                end


                Here, I put the 'players' array in the Game_System class, because the variable $game_system gets saved automatically when you save the game, meaning that the 'players' array will also get saved. You'll need to extend the Game_System class with this variable.

                Now, say we want to become another character, Blue.

                Spoiler:
                def becomeBlue
                store()
                pbChangePlayer(idBlue)
                $Trainer.party = newParty
                $Trainer.money = newMoney
                # ... and other changes
                end


                That's how you could do it. And, becoming Red again.

                Spoiler:
                def becomeRed
                pbChangePlayer(idRed)
                restore(idRed)
                end


                Hope this helps!
                Reply With Quote
                  #8    
                Old January 1st, 2014 (7:17 PM).
                Dylanrockin's Avatar
                Dylanrockin Dylanrockin is offline
                That guy
                   
                  Join Date: May 2011
                  Age: 22
                  Gender: Male
                  Nature: Timid
                  Posts: 277
                  Quote:
                  Originally Posted by Stochastic View Post
                  I have character switching in my game, but it's temporary (you can't save the game while you're the other character). Here's what I did in my case; I made two methods, one for storing the current player character "state" in a global variable, and another for restoring that state. State meaning party/money/etc. Storing simply means writing the state in the said global variable and restoring reading the state and writing it back in the $Trainer variable.

                  Now this only works if the switch is temporary. If you'd like to be able to save the game while you're the other character, you could do something like this.

                  Spoiler:
                  def store
                  id = $Trainer.id
                  $game_system.players[id] = ... # assign a copy of $Trainer
                  end

                  def restore(id)
                  $Trainer = $game_system.players[id]
                  end


                  Here, I put the 'players' array in the Game_System class, because the variable $game_system gets saved automatically when you save the game, meaning that the 'players' array will also get saved. You'll need to extend the Game_System class with this variable.

                  Now, say we want to become another character, Blue.

                  Spoiler:
                  def becomeBlue
                  store()
                  pbChangePlayer(idBlue)
                  $Trainer.party = newParty
                  $Trainer.money = newMoney
                  # ... and other changes
                  end


                  That's how you could do it. And, becoming Red again.

                  Spoiler:
                  def becomeRed
                  pbChangePlayer(idRed)
                  restore(idRed)
                  end


                  Hope this helps!
                  As helpful as this is, I have one question: where in Game_System would you put it? Would you apply it to a specific line? Or would you just add at the end of script after "end?"
                  Reply With Quote
                    #9    
                  Old January 2nd, 2014 (4:58 AM).
                  Stochastic's Avatar
                  Stochastic Stochastic is offline
                     
                    Join Date: Dec 2013
                    Gender: Male
                    Posts: 110
                    Quote:
                    As helpful as this is, I have one question: where in Game_System would you put it? Would you apply it to a specific line? Or would you just add at the end of script after "end?"
                    So, in the script Game_System, in class Game_System, after the last attr_accessor (line 16) put this

                    attr_accessor :players

                    And in method initialize, wherever you want between the "def initialize" and "end", put this

                    @players = []

                    That should be it.
                    __________________


                    Reply With Quote
                    Reply

                    Quick Reply

                    Join the conversation!

                    Create an account to post a reply in this thread, participate in other discussions, and more!

                    Create a PokéCommunity Account

                    Sponsored Links
                    Thread Tools

                    Posting Rules
                    You may not post new threads
                    You may not post replies
                    You may not post attachments
                    You may not edit your posts

                    BB code is On
                    Smilies are On
                    [IMG] code is On
                    HTML code is Off

                    Forum Jump


                    All times are GMT -8. The time now is 11:10 PM.