Here's how to get Shedinja in those games:
1. Catch a Nincada: You can find Nincada in the grass in various locations, including the Petalburg Woods.
2. Level it up to level 20: Once Nincada reaches level 20, it will evolve into Ninjask.
3. Have a free slot in your party: Before Nincada evolves, make sure you have an empty slot in your party. This is crucial for getting Shedinja.
4. Level up Nincada to level 20: When Nincada levels up, it will evolve into Ninjask and Shedinja will be automatically added to your party in the free slot.
Note: This method only works once per game. You can only get one Shedinja per game cartridge.