Spoiler:

So many people here use public scripts just copying and pasting them and then take it for granted. I'm just going to share a bit of how this script works so if you want, you can understand what you just changed in your game. I feel if everyone just picks up a little new information it can build up to them actually learning something about scripting. This is how I learned and how I continue to learn. You need to learn little things at a time, and then work at putting together to do something new!



So, the part of the script that we replaced is pretty much just checking the PBS file for trainers to get all of the information for however many pokemon they have. First of all, I added an "if statement" to check if the game should load the data like a normal trainer, or if switch[XXX] is true, load the data for a special 3 pokemon select trainer.



Then the script sets 2 variables. The first is set to a random number between 0 and 19, and then it adds 1 to it so we really get a number between 1 and 20. When there are 6 pokemon, and we need a combination of 3, there are 20 possible combinations. This variable determines which one will be used. The second variable is just saying that the script should check pokemon number 1 first.



Next comes the original script with a few edits. When it says "for poke in trainer[3]" it will run the indented part of the script for every pokemon that comes up in the trainer's PBS file entry. The lines followed by comments are where I figured out if the pokemon should be included or not. I figured out what each of the 20 combinations of 3 would look like, and if the script finds that the pokemon is not part of the randomly selected combination, the pokemon's data is not added to the trainer for the battle, and it moves on to the next pokemon.



The only other change I made is after adding all the pokemon's data, it increases the current pokemon it is checking by one, so the script checks the 2nd pokemon next, and then the 3rd, and so on.



The rest of the script is what happens in the original switch[XXX] is not on. The script will just run like normal.