• 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!
  • It's time to vote for your favorite Pokémon Battle Revolution protagonist in our new weekly protagonist poll! Click here to cast your vote and let us know which PBR protagonist you like most.
  • 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.

Rival Randomizer

Zeak6464

Zeak #3205 - Discord
  • 1,101
    Posts
    12
    Years
    This script allows the Rival to be Randomized and have the same team throughout the playthrough.
    If you want the Rivals pokemon to evolve use this script https://www.pokecommunity.com/threads/409828

    Code:
    RIVAL_TEAM_LIST = [
      :RIVAL,
    ]
    
    Events.onTrainerPartyLoad+=proc {|sender,e|
       if e[0] # Trainer data should exist to be loaded, but may not exist somehow
         trainer=e[0][0] # A PokeBattle_Trainer object of the loaded trainer
         items=e[0][1]   # An array of the trainer's items they can use
         party=e[0][2]   # An array of the trainer's Pokémon
         ids=RIVAL_TEAM_LIST
         balance=false
         ids.each{|item|balance|=isConst?(trainer.trainertype,PBTrainers,item)
         }
         # 1 Pokemon
         if balance && $game_switches && $game_switches[999]
           party.each{|poke|
            level=pbBalancedLevel($Trainer.party)
            party[0].species=1+ rand(151)
            party[0].level=level
            party[0].name=PBSpecies.getName(poke.species)
            party[0].resetMoves
            party[0].calcStats
            $game_variables[999] = party[0].species
            $game_variables[998] = party[0].name
             }
          # 2 Pokemon
           elsif balance && $game_switches && $game_switches[998]
            party.each{|poke| 
             level=pbBalancedLevel($Trainer.party)
             party[0].level=level
             party[0].species = $game_variables[999]
             party[0].name = $game_variables[998]
             party[0].resetMoves
             party[0].calcStats
             party[1].species=1+ rand(151)
             party[1].level=level
             party[1].name=PBSpecies.getName(poke.species)
             party[1].resetMoves
             party[1].calcStats
             $game_variables[997] = party[1].species
             $game_variables[996] = party[1].name
             }
          # 3 Pokemon
           elsif balance && $game_switches && $game_switches[997]
            party.each{|poke| 
             level=pbBalancedLevel($Trainer.party)
             party[0].level=level
             party[0].species = $game_variables[999]
             party[0].name = $game_variables[998]
             party[0].resetMoves
             party[0].calcStats
             party[1].level=level
             party[1].species = $game_variables[997]
             party[1].name = $game_variables[996]
             party[1].resetMoves
             party[1].calcStats
             party[2].species=1+ rand(151)
             party[2].level=level
             party[2].name=PBSpecies.getName(poke.species)
             party[2].resetMoves
             party[2].calcStats
             $game_variables[995] = party[2].species
             $game_variables[994] = party[2].name
             }
             # 4 Pokemon
           elsif balance && $game_switches && $game_switches[996]
            party.each{|poke| 
             level=pbBalancedLevel($Trainer.party)
             party[0].level=level
             party[0].species = $game_variables[999]
             party[0].name = $game_variables[998]
             party[0].resetMoves
             party[0].calcStats
             party[1].level=level
             party[1].species = $game_variables[997]
             party[1].name = $game_variables[996]
             party[1].resetMoves
             party[1].calcStats
             party[2].species=party[2].species
             party[2].level=level
             party[2].name=party[2].name
             party[2].resetMoves
             party[2].calcStats
             party[3].species=1+ rand(151)
             party[3].level=level
             party[3].name=PBSpecies.getName(poke.species)
             party[3].resetMoves
             party[3].calcStats
             $game_variables[993] = party[3].species
             $game_variables[992] = party[3].name
             }
            # 5 Pokemon
           elsif balance && $game_switches && $game_switches[995]
            party.each{|poke| 
             level=pbBalancedLevel($Trainer.party)
             party[0].level=level
             party[0].species = $game_variables[999]
             party[0].name = $game_variables[998]
             party[0].resetMoves
             party[0].calcStats
             party[1].level=level
             party[1].species = $game_variables[997]
             party[1].name = $game_variables[996]
             party[1].resetMoves
             party[1].calcStats
             party[2].species=party[2].species
             party[2].level=level
             party[2].name=party[2].name
             party[2].resetMoves
             party[2].calcStats
             party[3].species=party[3].species
             party[3].level=level
             party[3].name=party[3].name
             party[3].resetMoves
             party[3].calcStats
             party[4].species=1+ rand(151)
             party[4].level=level
             party[4].name=PBSpecies.getName(poke.species)
             party[4].resetMoves
             party[4].calcStats
             $game_variables[991] = party[4].species
             $game_variables[990] = party[4].name
             }
            # 6 Pokemon
           elsif balance && $game_switches && $game_switches[994]
            party.each{|poke| 
             level=pbBalancedLevel($Trainer.party)
             party[0].level=level
             party[0].species = $game_variables[999]
             party[0].name = $game_variables[998]
             party[0].resetMoves
             party[0].calcStats
             party[1].level=level
             party[1].species = $game_variables[997]
             party[1].name = $game_variables[996]
             party[1].resetMoves
             party[1].calcStats
             party[2].species=party[2].species
             party[2].level=level
             party[2].name=party[2].name
             party[2].resetMoves
             party[2].calcStats
             party[3].species=party[3].species
             party[3].level=level
             party[3].name=party[3].name
             party[3].resetMoves
             party[3].calcStats
             party[4].species=party[4].species
             party[4].level=level
             party[4].name=party[4].name
             party[4].resetMoves
             party[4].calcStats
             party[5].species=1+ rand(151)
             party[5].level=level
             party[5].name=PBSpecies.getName(poke.species)
             party[5].resetMoves
             party[5].calcStats
             $game_variables[989] = party[5].species
             $game_variables[988] = party[5].name
             }
           # Full Team Pokemon
           elsif balance && $game_switches && $game_switches[993]
            party.each{|poke| 
             level=pbBalancedLevel($Trainer.party)
             party[0].level=level
             party[0].species = $game_variables[999]
             party[0].name = $game_variables[998]
             party[0].resetMoves
             party[0].calcStats
             party[1].level=level
             party[1].species = $game_variables[997]
             party[1].name = $game_variables[996]
             party[1].resetMoves
             party[1].calcStats
             party[2].species=party[2].species
             party[2].level=level
             party[2].name=party[2].name
             party[2].resetMoves
             party[2].calcStats
             party[3].species=party[3].species
             party[3].level=level
             party[3].name=party[3].name
             party[3].resetMoves
             party[3].calcStats
             party[4].species=party[4].species
             party[4].level=level
             party[4].name=party[4].name
             party[4].resetMoves
             party[4].calcStats
             party[5].species=party[5].species
             party[5].level=level
             party[5].name=party[5].name
             party[5].resetMoves
             party[5].calcStats
             }
         end
       end
    }
     
    Last edited:
    Back
    Top