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

Default Player Names

Rayd12smitty

Shadow Maker
645
Posts
12
Years
    • Seen Feb 21, 2016
    Sorry guys. i know this is like the fourth question I've posted this week. How do you make a default name for the player. So when you don't enter anything, it will set your name to something specific, in my case Ray for the male, and Kelsey for female.
     

    FL

    Pokémon Island Creator
    2,450
    Posts
    13
    Years
    • Seen yesterday
    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.
     

    Rayd12smitty

    Shadow Maker
    645
    Posts
    12
    Years
    • Seen Feb 21, 2016
    Thanks so much. I looked for over an hour on the wiki and couldn't find it
     

    Maruno

    Lead Dev of Pokémon Essentials
    5,286
    Posts
    16
    Years
    • Seen May 3, 2024
    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.
     

    Rayd12smitty

    Shadow Maker
    645
    Posts
    12
    Years
    • Seen Feb 21, 2016
    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:

    Maruno

    Lead Dev of Pokémon Essentials
    5,286
    Posts
    16
    Years
    • Seen May 3, 2024
    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