• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • 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.

Default Player Names

The wikia haven't the answer. In current system you can only put a default random name OR put a default name without option to change it. Untested solution: In PokemonUtilities change
Code:
def pbTrainerName(name=nil)
 if $PokemonGlobal.playerID<0
  pbChangePlayer(0)
 end
 trainertype=pbGetPlayerTrainerType
 trname=name
 if trname==nil
  trname=pbEnterText("Your name?",0,7)
  gender=pbGetTrainerTypeGender(trainertype) 
  if trname==""
   trname=getRandomNameEx(gender,nil,1,7)
  end
 end
 $Trainer=PokeBattle_Trainer.new(trname,trainertype)
 $PokemonBag=PokemonBag.new
 $PokemonTemp.begunNewGame=true
end
to
Code:
def pbTrainerName(name=nil, force=true)
 if $PokemonGlobal.playerID<0
  pbChangePlayer(0)
 end
 trainertype=pbGetPlayerTrainerType
 trname=name
 if trname==nil || !force
  minlength=(force) ? 1 : 0
  trname=pbEnterText("Your name?",minlength,7)
  gender=pbGetTrainerTypeGender(trainertype) 
  if trname==""
   trname= (trname!=nil && !force) ? name : getRandomNameEx(gender,nil,1,7) 
  end
 end
 $Trainer=PokeBattle_Trainer.new(trname,trainertype)
 $PokemonBag=PokemonBag.new
 $PokemonTemp.begunNewGame=true
end
Call pbTrainerName("Ray",false) or pbTrainerName("Kelsey",false) based on player gender.
With this change, if you just call 'pbTrainerName' it can't be cancelled and gives you a random name. If you wish the old pbTrainerName call, just use 'pbTrainerName(nil,false)'.
I sugest Maruno to put this on next release.
 
I think the question is better interpreted as: "How does one change what the default names are for the player?" - that is, how can you set the name to something in particular rather than have it use the player's username on their computer (or a random jumble of letters)? It's a slight but important difference.

The answer is to use the following script lines in the Intro event:

Code:
pbTrainerName(_I("Ray"))
[/COLOR][COLOR=Black]newname=pbEnterText(_I("Your name?"),0,7[COLOR=Red],$Trainer.name[/COLOR])
[/COLOR][COLOR=Black]$Trainer.name=newname if newname && newname!=""[/COLOR]
This sets the default name, and then lets the player edit it (the default name is shown to start with - to show blankness to start with, delete the red part). If they input a blank name, it remains as the default name.

If you keep the red part of the code, this is pretty much exactly what FL's answer does, but without needing any script changes.
 
I think the question is better interpreted as: "How does one change what the default names are for the player?" - that is, how can you set the name to something in particular rather than have it use the player's username on their computer (or a random jumble of letters)? It's a slight but important difference.

The answer is to use the following script lines in the Intro event:

Code:
pbTrainerName(_I("Ray"))
[/COLOR][COLOR=Black]newname=pbEnterText(_I("Your name?"),0,7[COLOR=Red],$Trainer.name[/COLOR])
[/COLOR][COLOR=Black]$Trainer.name=newname if newname && newname!=""[/COLOR]
This sets the default name, and then lets the player edit it (the default name is shown to start with - to show blankness to start with, delete the red part). If they input a blank name, it remains as the default name.

If you keep the red part of the code, this is pretty much exactly what FL's answer does, but without needing any script changes.


Ok, thank you. This does seem easier. I haven't had time to try either way yet, but if it is coming from you I'm sure it will work. Thanks

The wikia haven't the answer. In current system you can only put a default random name OR put a default name without option to change it. Untested solution: In PokemonUtilities change
Code:
def pbTrainerName(name=nil)
 if $PokemonGlobal.playerID<0
  pbChangePlayer(0)
 end
 trainertype=pbGetPlayerTrainerType
 trname=name
 if trname==nil
  trname=pbEnterText("Your name?",0,7)
  gender=pbGetTrainerTypeGender(trainertype) 
  if trname==""
   trname=getRandomNameEx(gender,nil,1,7)
  end
 end
 $Trainer=PokeBattle_Trainer.new(trname,trainertype)
 $PokemonBag=PokemonBag.new
 $PokemonTemp.begunNewGame=true
end
to
Code:
def pbTrainerName(name=nil, force=true)
 if $PokemonGlobal.playerID<0
  pbChangePlayer(0)
 end
 trainertype=pbGetPlayerTrainerType
 trname=name
 if trname==nil || !force
  minlength=(force) ? 1 : 0
  trname=pbEnterText("Your name?",minlength,7)
  gender=pbGetTrainerTypeGender(trainertype) 
  if trname==""
   trname= (trname!=nil && !force) ? name : getRandomNameEx(gender,nil,1,7) 
  end
 end
 $Trainer=PokeBattle_Trainer.new(trname,trainertype)
 $PokemonBag=PokemonBag.new
 $PokemonTemp.begunNewGame=true
end
Call pbTrainerName("Ray",false) or pbTrainerName("Kelsey",false) based on player gender.
With this change, if you just call 'pbTrainerName' it can't be cancelled and gives you a random name. If you wish the old pbTrainerName call, just use 'pbTrainerName(nil,false)'.
I sugest Maruno to put this on next release.

Thank you. I just tried this method first and it worked great. I'm sorry for being so unknowing but how do I make a conditional branch based on your characters gender. I know this was probably stupid but i tried a conditional branch based on $Trainer.gender=0 and it just got an error. Sorry and thanks a head of time
 
Last edited:
A single equals sign makes the first thing have the value of the second thing. Double equals signs checks whether the first thing is the same as the second thing.

Use $Trainer.gender==0 as the argument of your Conditional Branch.
 
Back
Top