Hello, I have a problem with Essentials Starter Kit.
From the moment I get the third Badge in the game, the Pokémon of each trainer begin to appear in random order, running away from that was set for them, keeping only the level.
I use the Essentials V15 with the Elite Battle system.
The game only chooses the team members. The trainer's AI chooses what order to send them out in based on your current Pokemon. You are experiencing expected behavior. The only thing you as the game developer can control without editing the scripts is which Pokemon their lead is.