This code will allows the player to Randomize Opponent Trainer Pokemon based on TrainerType
This script is plug&play !
Credit goes to :
Zeak6464
Vendily
Umbra
This script is plug&play !
Credit goes to :
Zeak6464
Vendily
Umbra
Code:
EVIL_TEAM_LIST = [
:TEAMROCKET_Male,
:TEAMROCKET_Female,
:TEAMROCKET_f,
:TEAMROCKET_m,
:TEAMROCKET_JJ
]
def generatePokemon(level)
species = rand(PBSpecies.maxValue) + 1
species = pbGetBabySpecies(species) # revert to the first evolution
item = 0
loop do
nl = level + 5
nl = MAXIMUMLEVEL if nl > MAXIMUMLEVEL
pkmn = PokeBattle_Pokemon.new(species, nl)
cevo = Kernel.pbCheckEvolution(pkmn)
evo = pbGetEvolvedFormData(species)
if evo
evo = evo[rand(evo.length - 1)]
# evolve the species if we can't evolve and there is an evolution
# and a bit of randomness passes as well as the evolution type cannot
# be by level
if evo && cevo < 1 && rand(MAXIMUMLEVEL) <= level
species = evo[2] if evo[0] != 4 && rand(MAXIMUMLEVEL) <= level
end
end
if cevo == -1 || (rand(MAXIMUMLEVEL) > level && level < 60)
# ^ Only break the loop if there is no more evolutions or some randomness
# applies and the level is under 60
break
else
species = evo[2]
end
end
return species
end
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=EVIL_TEAM_LIST
balance=false
ids.each{|item|
balance|=isConst?(trainer.trainertype,PBTrainers,item)
}
if balance
party.each{|poke|
level=pbBalancedLevel($Trainer.party)- 4
poke.species=generatePokemon(level)
poke.level=level
poke.name=PBSpecies.getName(poke.species)
poke.calcStats
poke.resetMoves
}
end
end
}
Last edited: