• 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.

Multiple Protagonists

NoNoNever

Creator from Pokemon Illuison, Pokemon Arcadia, Po
89
Posts
5
Years
Hello, first I am from Germany please excuse my bad english
I have read the tutorial from pokewiki Tutorial:Multiple_Protagonists and tried unfortunately I have no success, I tested the essentials versions from 16 to 17.2 .. Can someone help me to get it working?

I have done so far: created a new script area and the script of the page purely copied, when I start the game I get directly but a mistake, possibly because of the playerID

What I want to do: I want to set it so that at the beginning of the game is a boy for example trainer markus, then sometime in the game you become a girl, this girl has already pokemon for example, a squirtle, the change is the girl for example, coach Luna , and has a squirtle in team, someday you will return to normal to a boy where you get the pokemon from luna, now you are again trainer for example markus with the team and items from luna

To do that, I have to get the script from the tutorial to run to have a second protagonist, what am I doing wrong?

greetings
 

Attachments

  • Screenshot (88).png
    Screenshot (88).png
    50.3 KB · Views: 18
  • Screenshot (90).png
    Screenshot (90).png
    20.9 KB · Views: 9

Ego13

hollow_ego
311
Posts
6
Years
Do you have a save file?
And if so at what point does the game crash?
And where did you put
Code:
pbSecondTrainerName
?
 

NoNoNever

Creator from Pokemon Illuison, Pokemon Arcadia, Po
89
Posts
5
Years
if you mean save file with a saved score, yes that is available

the error always comes directly at the start of playtest

def pbSecondTrainerName ()
# First, we're gonna need the second trainer's trainer type
# For the sake of this tutorial, we're going to hardcore something
trainertype = 2
# Trainer Type 2 to: POKEMONTRAINER_Brendan in an unmodified Essentials game.

# We need to set the playerID to match the other protagonist, so when we call
# pbEnterPlayerName below, the correct sprite will appear. We need to save the
# old one off for restoration afterwards.
oldid = $ PokemonGlobal.playerID
$ PokemonGlobal.playerID = 2 #Metadata ID of the second character
# Note: I created a PlayerC in the Metadata.txt to correspond with playerID 2

# Let's ask the player for a name for the second player
trname = pbEnterPlayerName (_INTL ("Your brother's name?"), 0.7)
if trname == ""
# If the player does not supply a name
# For right now, we're going to copy this from pbTrainerName
# which gets the name of the player from their computer by default
gender = pbGetTrainerTypeGender (trainer type)
TrName = pbSuggestTrainerName (gender)
end
# Ok, let's create the second trainer!
Trainer2 = PokeBattle_Trainer.new (TrName, trainer type)
bag2 = PokemonBag.new
# Set his trainer id to something other than the first protagonist's
trainer2.setForeignID ($ Trainer)
trainer2.metaID = $ PokemonGlobal.playerID # We'll get to this later
$ PokemonGlobal.playerID = oldid

return [trainer2, bag2]
end

This is the first script of the tutorial

What is strange after inserting the first script (from wiki tutorial) I do not get like in the wiki tutorial after inserting the scripts the window to the name of the second character, the game just runs quite normal ..

I then insert the second part of the tutorial

protag2 = pbSecondTrainerName ()
# Let's fill in some details about our second protagonist
tr = protag2 [0]
# He's got 7 badges in the current region
for i in 0 ... 7
tr.badges = true
end
# He's picked up his pokedex and pokegear
tr.pokedex = true
tr.pokegear = true
# He's seen every pokemon!
for i in 0..PBSpecies.maxValue
tr.setSeen (i)
end
# ... well, except for a couple of pokemon
tr.seen [PBSpecies :: ARCEUS] = false
tr.seen [PBSpecies :: VICTINI] = false
#He's missing a few more pokemon in owned
for i in 0..PBSpecies.maxValue
next if i == PBSpecies :: MEWTWO
next if i> = PBSpecies :: AZELF && i <PBSpecies :: VICTINI
next if i> PBSpecies :: DURANT
tr.setOwned (i)
end
# But he's got enough to cover any pokeball bills, certainly
tr.money = 734350
# Speaking of pokeballs, let's give it some
# Remember, the bag is a separate object:
protag2 [1] .pbStoreItem (ULTRA BALL, 6)
protag2 [1] .pbStoreItem (: GREAT BALL, 20)
protag2 [1] .pbStoreItem (REPEAT BALL, 2)
protag2 [1] .pbStoreItem (: PREMIER BALL, 12)
protag2 [1] .pbStoreItem (MASTER BALL, 1)
# ... etc etc etc ...

# Now he needs a party
PKMN = PokeBattle_Pokemon.new (: Venusaur, 67, tr)
pkmn.name = "Seedmon"
pkmn.exp + = 6790 # Not needed, just making the bar fill a little bit more
pkmn.happiness = 212
pkmn.setItem (: MIRACLESEED)
pkmn.giveRibbon (: REGIONAL CHAMPION)
pkmn.pbLearnMove (: SOLAR BEAM)
pkmn.obtainLevel = 5
pkmn.obtainMap = 4 #Pokemon Lab
pkmn.ev = [105,85,85,65,105,65]
pkmn.calcStats # Need to recalc stats after ev change
tr.party.push (PKMN)
# ... repeat for other mons ...

the error comes when starting playtest

Do I have to create a new section named pbSecondTrainerName between compiler and main? or is it apprenticed in PokeBattle_Trainer

Sorry for my big stupidity and thank you for taking the time and effort to help me

what do you mean by And where did you put
Code:
pbSecondTrainerName

I have to insert this somewhere?, I notice my brain has run away .. sorry for that
 

Ego13

hollow_ego
311
Posts
6
Years
Alright,

show me all places where this occurs: pbSecondTrainerName
Please use [ CODE] and [ /CODE] (without the spaces) in your reply to mark it as good. This way it's easier to read and see

Also you said you get this error at the beginning of the playtest. But wha is the beginning of playtest for you? Right after you hit "Run" or after the loading screen?
 

NoNoNever

Creator from Pokemon Illuison, Pokemon Arcadia, Po
89
Posts
5
Years
Hey, I figured it would be easier and more comfortable for both of us when I record what I'm doing / show how to insert the scripts intro is the standart intro of essentials nothing was changed, hope that makes everything easier
 

Ego13

hollow_ego
311
Posts
6
Years
Hey that was a good idea :)
I see what you did wrong. The secon part of the script is not to be just placed in your script sections, as it will try to execute the code right at the start. However this part is more meant to be an example of how to change things about your second protagonist.

Okay, let's say for now you just want your second protagonist be just like in the tutorial.
Right before
Code:
protag2 = pbSecondTrainerName()
add this
Code:
def setUpSecondProtagonist
and right after
Code:
# ...repeat for other mons...
add
Code:
end

Now this turns the whole code into a method which will be executed on call.
To use this add a script into your event and insert
Code:
setUpSecondProtagonist
Make sure to store the info as mentioned in the tutorial
 

NoNoNever

Creator from Pokemon Illuison, Pokemon Arcadia, Po
89
Posts
5
Years
Very good we have made a lot :) the selection of the second protagonist comes, now we hang at the next point

Screenshot94.png.html


I don't know whats to do with $PokemonGlobal.otherPlayerCharacter = protag2

._. but the rest works so far: 3 thanks for that
 

Ego13

hollow_ego
311
Posts
6
Years
Put this
Code:
$PokemonGlobal.otherPlayerCharacter = protag2
between
Code:
# ...repeat for other mons...
and
Code:
end
 

NoNoNever

Creator from Pokemon Illuison, Pokemon Arcadia, Po
89
Posts
5
Years
okay works, Adding Managing PCs also works, no more errors when starting the game, the only thing that is still broken or better not want to run is this phone event

Exception: RuntimeError
Message: Script error within event 5, map 177 (PALLET TOWN H2):
Exception: NoMethodError
Message: (eval):1:in `pbExecuteScript'undefined method `otherPlayerCharacter' for #<PokemonGlobalMetadata:0xc8e8818>
***Full script:
pbSet(3,$PokemonGlobal.otherPlayerCharacter[0].name)

Interpreter:243:in `pbExecuteScript'
Interpreter:1606:in `eval'
Interpreter:243:in `pbExecuteScript'
Interpreter:1606:in `command_355'
Interpreter:494:in `execute_command'
Interpreter:193:in `update'
Interpreter:106:in `loop'
Interpreter:198:in `update'
Scene_Map:103:in `update'
Scene_Map:101:in `loop'

Interpreter:276:in `pbExecuteScript'
Interpreter:1606:in `command_355'
Interpreter:494:in `execute_command'
Interpreter:193:in `update'
Interpreter:106:in `loop'
Interpreter:198:in `update'
Scene_Map:103:in `update'
Scene_Map:101:in `loop'
Scene_Map:114:in `update'
Scene_Map:68:in `main'
 

NoNoNever

Creator from Pokemon Illuison, Pokemon Arcadia, Po
89
Posts
5
Years
omg and now comes this error after you have chosen the name of the second protagonist oo

but nothing was changed overnight :o

Exception: RuntimeError
Message: Script error within event 1, map 1 (Intro):
Exception: NoMethodError
Message: Section113:84:in `setUpSecondProtagonist'undefined method `otherPlayerCharacter=' for #<PokemonGlobalMetadata:0xc86a600>
***Full script:
setUpSecondProtagonist

Interpreter:243:in `pbExecuteScript'
(eval):1:in `pbExecuteScript'
Interpreter:1606:in `eval'
Interpreter:243:in `pbExecuteScript'
Interpreter:1606:in `command_355'
Interpreter:494:in `execute_command'
Interpreter:193:in `update'
Interpreter:106:in `loop'
Interpreter:198:in `update'
Scene_Map:103:in `update'

Interpreter:276:in `pbExecuteScript'
Interpreter:1606:in `command_355'
Interpreter:494:in `execute_command'
Interpreter:193:in `update'
Interpreter:106:in `loop'
Interpreter:198:in `update'
Scene_Map:103:in `update'
Scene_Map:101:in `loop'
Scene_Map:114:in `update'
Scene_Map:68:in `main'
 

NoNoNever

Creator from Pokemon Illuison, Pokemon Arcadia, Po
89
Posts
5
Years
works now looks as if everything now works as it should thank you for your help, you will be included in the credits :)
 

NoNoNever

Creator from Pokemon Illuison, Pokemon Arcadia, Po
89
Posts
5
Years
I have only one last question is it possible to set it so that the second protagonist already has a fixed name, for example, luna, and you can not choose a name?
 

Ego13

hollow_ego
311
Posts
6
Years
Yup. It is.
just replace this:

Code:
trname = pbEnterPlayerName(_INTL("Your brother's name?"),0,7)
  if trname==""
    # If the player doesn't supply a name, feel free to provide a default
    # For right now, we're going to copy this from pbTrainerName
    # which gets the name of the player from their computer by default
    gender=pbGetTrainerTypeGender(trainertype) 
    trname=pbSuggestTrainerName(gender)
  end

with:
Code:
trname="Luna"
gender=1
1 is female and 0 is male
 
Last edited:
Back
Top