If you make a trainer have more than one pokemon in any trainer editing tool and try to script a battle while having one pokemon yourself, the game will initiate the battle and duplicate your pokemon while battling the trainer. The original games avoided this happening by not letting you battle these trainers unless you have 2 or more pokemon.
To script this properly you can do something like this:
#org @start
lock
faceplayer
countpokemon '--------------- This command counts the number of pokemon in your party
compare LASTRESULT 0x2 '--------------- Here we are checking the number of pokemon (in this case checking for at least 2)
if 0x0 goto @NotEnoughPokemon '--------------- If you don't have any, trainer skips the battle and tells you to get more pokemon
trainerbattle 0x0 0x1 0x0 @Challenge @Defeat '--------------- If you do have at least 2 pokemon, the battle starts
msgbox @After 0x6
release
end
#org @NotEnoughPokemon '--------------- Here is the part of the code which executes if you don't have enough pokemon
msgbox @ComeBackLater
release
end
'----------------------------------------
#org @Challenge
= It's time to battle!
#org @Defeat
= I lost...
#org @After
= Cool team!
#org @ComeBackLater
= Sorry, but you cannot battle me if you don't have more than one pokemon.