After seeing the tutorial Weighted Egg Generator made by GReusch on Essentials Wiki, I decided to put in my game a system of random starter. This far everything is ok. The problem started after I put that even the rival receives his starter randomly according to the type supereffective on your. What can be the problem in the script put below (the numbers represent the number of the type in the file types.txt)
def Random_Rival_Supereffective
if $Trainer.pokemonParty[0].type1==PBTypes::NORMAL
Rival=[1]
elsif $Trainer.pokemonParty[0].type1==PBTypes::FIGHTING
Rival=[2, 14, 18]
elsif $Trainer.pokemonParty[0].type1==PBTypes::FLYING
Rival=[5, 13, 15]
elsif $Trainer.pokemonParty[0].type1==PBTypes::POISON
Rival=[4, 14]
elsif $Trainer.pokemonParty[0].type1==PBTypes::GROUND
Rival=[11, 12, 15]
elsif $Trainer.pokemonParty[0].type1==PBTypes::ROCK
Rival=[1, 4, 8, 11, 12]
elsif $Trainer.pokemonParty[0].type1==PBTypes::BUG
Rival=[2, 5, 10]
elsif $Trainer.pokemonParty[0].type1==PBTypes::GHOST
Rival=[7, 17]
elsif $Trainer.pokemonParty[0].type1==PBTypes::STEEL
Rival=[1, 4, 10]
elsif $Trainer.pokemonParty[0].type1==PBTypes::FIRE
Rival=[4, 5, 11]
elsif $Trainer.pokemonParty[0].type1==PBTypes::WATER
Rival=[12, 13]
elsif $Trainer.pokemonParty[0].type1==PBTypes::GRASS
Rival=[2, 3, 6, 10, 15]
elsif $Trainer.pokemonParty[0].type1==PBTypes::ELECTRIC
Rival=[4]
elsif $Trainer.pokemonParty[0].type1==PBTypes::PSYCHIC
Rival=[6, 7, 17]
elsif $Trainer.pokemonParty[0].type1==PBTypes::ICE
Rival=[1, 5, 7, 10]
elsif $Trainer.pokemonParty[0].type1==PBTypes::DRAGON
Rival=[15, 16, 18]
elsif $Trainer.pokemonParty[0].type1==PBTypes::DARK
Rival=[1, 6, 18]
elsif $Trainer.pokemonParty[0].type1==PBTypes::FAIRY
Rival=[3, 8]
end
$game_variables[26]=Rival[rand(Rival.length)]
end
def Random_Rival_Supereffective
if $Trainer.pokemonParty[0].type1==PBTypes::NORMAL
Rival=[1]
elsif $Trainer.pokemonParty[0].type1==PBTypes::FIGHTING
Rival=[2, 14, 18]
elsif $Trainer.pokemonParty[0].type1==PBTypes::FLYING
Rival=[5, 13, 15]
elsif $Trainer.pokemonParty[0].type1==PBTypes::POISON
Rival=[4, 14]
elsif $Trainer.pokemonParty[0].type1==PBTypes::GROUND
Rival=[11, 12, 15]
elsif $Trainer.pokemonParty[0].type1==PBTypes::ROCK
Rival=[1, 4, 8, 11, 12]
elsif $Trainer.pokemonParty[0].type1==PBTypes::BUG
Rival=[2, 5, 10]
elsif $Trainer.pokemonParty[0].type1==PBTypes::GHOST
Rival=[7, 17]
elsif $Trainer.pokemonParty[0].type1==PBTypes::STEEL
Rival=[1, 4, 10]
elsif $Trainer.pokemonParty[0].type1==PBTypes::FIRE
Rival=[4, 5, 11]
elsif $Trainer.pokemonParty[0].type1==PBTypes::WATER
Rival=[12, 13]
elsif $Trainer.pokemonParty[0].type1==PBTypes::GRASS
Rival=[2, 3, 6, 10, 15]
elsif $Trainer.pokemonParty[0].type1==PBTypes::ELECTRIC
Rival=[4]
elsif $Trainer.pokemonParty[0].type1==PBTypes::PSYCHIC
Rival=[6, 7, 17]
elsif $Trainer.pokemonParty[0].type1==PBTypes::ICE
Rival=[1, 5, 7, 10]
elsif $Trainer.pokemonParty[0].type1==PBTypes::DRAGON
Rival=[15, 16, 18]
elsif $Trainer.pokemonParty[0].type1==PBTypes::DARK
Rival=[1, 6, 18]
elsif $Trainer.pokemonParty[0].type1==PBTypes::FAIRY
Rival=[3, 8]
end
$game_variables[26]=Rival[rand(Rival.length)]
end