• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Changing Player Character

12
Posts
10
Years
  • Age 28
  • Seen Dec 31, 2013
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?
 
63
Posts
11
Years
  • Seen Mar 17, 2015
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
 

tImE

It's still me, 44tim44 ;)
673
Posts
17
Years
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.
 

Maruno

Lead Dev of Pokémon Essentials
5,285
Posts
16
Years
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.
 
12
Posts
10
Years
  • Age 28
  • Seen Dec 31, 2013
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...
 

Dylanrockin

That guy
276
Posts
12
Years
  • Age 28
  • Seen Jun 9, 2016
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.
 
453
Posts
10
Years
  • Age 32
  • Seen Apr 17, 2024
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:


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:


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

Spoiler:


Hope this helps!
 

Dylanrockin

That guy
276
Posts
12
Years
  • Age 28
  • Seen Jun 9, 2016
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:


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:


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

Spoiler:


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?"
 
453
Posts
10
Years
  • Age 32
  • Seen Apr 17, 2024
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.
 
Back
Top