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

[Scripting Question] Random starter

AskipLudo

The Masked Guy
  • 159
    Posts
    8
    Years
    Hello, I've watch a video on youtube about making random starter from script array everything is going great until taking the starter:

    [PokeCommunity.com] Random starter


    and the script:

    [PokeCommunity.com] Random starter


    So i don't know what's happening
     
    I actually had a random starter code in one of my test games.
    Code:
    def pbRandomStarter
      r = rand(898) #Make sure this number matches the amount of pokemon in your national dex.
      pbAddToParty(r + 1,5)
    end

    Edit:
    If you want to control which Pokemon can be randomized, use this instead.
    Code:
    RANDOM_STARTER={1=>:BULBASAUR,2=>:CHARMANDER,3=>:SQUIRTLE,4=>:PIKACHU,5=>:EEVEE}
    def pbRandomStarterPkmn
      r = rand(5) + 1
      pbAddToParty(RANDOM_STARTER.fetch(r),5)
    end
     
    Last edited:
    Taht's because of this :

    [PokeCommunity.com] Random starter


    It worked for the guy in his video :(

    You didn't follow his instructions correctly. You're not supposed to use "pbGetRandomPokemon" AND "pbGrantRandomPokemon" in the same event, because that is just redundant. What you actually need to do in your event is replace the line:
    Code:
    pbGrantRandomPokemon(pbGet(47), 5)
    with:
    Code:
    pbAddPokemon(pbGet(47), 5)
    Because the line with "pbGetRandomPokemon" is ALREADY generating the random Pokemon in the conditional branch above, so all you need to do is add it.
     
    Back
    Top