You will have to make 3 different encounters, for EACH battle you have between the rival... Using Variables will be your friend here.
If you start with Pidgey, $game_variables[x]==1, and have the battle event be:
pbTrainerBattle(PBTrainers::RIVAL,"Ash",_I("Hello!"),false,0,true)
If you start with Machop, $game_variables[x]==2, and have the battle event be:
pbTrainerBattle(PBTrainers::RIVAL,"Ash",_I("Hello!"),false,1,true)
If you start with Chikorita, $game_variables[x]==3, and have the battle event be:
pbTrainerBattle(PBTrainers::RIVAL,"Ash",_I("Hello!"),false,2,true)
This is your trainers class
This is your trainers name
This is what they will say after the battle
This is whether it is a double battle or not
This is the number you will deffinitly need to use...
This is whether you lose or not
As you can see, the Pink wording is what I said you will need, this is what will make you battle your rival with a different Pokémon set in trainers.txt...
RIVAL
Ash
1,POTION
PIKACHU,18
RIVAL
Ash,1
1,POTION
DROWZEE,18
RIVAL
Ash,2
1,POTION
SPEAROW,18
Notice the number after the name, that's what the "0", "1" and "2" will read.