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

[Scripting Question] Retrieving Internal Trainer name from Trainer Number

129
Posts
14
Years
    • Seen Sep 4, 2023
    Hello Guys!

    I'm having trouble writing a code that returns a trainer's internal name.
    More specifically, I'm generating a trainer randomly from a list and I want to get his trainer type.
    I'm trying something like this:
    Code:
    #trainers is an array containing many trainer types
    trainer = trainers[rand(trainers.length)]
    #here I get the name of the Trainer type generated
    type = PBTrainers.getName(trainer[0])
    #However this is the displayed trainer's name, as displayed in a battle for instance.
    I wanted to generate the internal name, something like
    Code:
    PBTrainers::NURSE
    The code I use however gives me the name "Nurse" in type instead.
    How do I get the internal name?
    Thanks!
     
    Last edited:
    233
    Posts
    5
    Years
    • Seen Oct 9, 2023
    I assume that trainer[0] returns the integer ID of the trainer. In that case, set type as follows:
    Spoiler:
     
    Back
    Top