This project automates a Pokémon shiny-hunting workflow on the Nintendo Switch by combining Python, OpenCV, and the NXBT library to send button inputs and detect on-screen pixel colors.
The scripts in this repository:
- capture frames from a webcam or virtual camera,
- inspect screen pixels to identify UI states or shiny indicators,
- send button presses to the Switch through NXBT,
- help you tune the pixel-based detection logic for your setup.
The main idea is:
- Capture a frame from your camera or OBS virtual camera.
- Identify the pixel color that represents a specific screen state.
- Edit the script constants so the detection logic matches your game and display.
- Run the automation loop and let the script interact with the Switch.
Pixel matching is highly dependent on your hardware, lighting, display, and camera setup. The scripts are not plug-and-play out of the box.
To make them work well for your setup:
- run the pixel capture helper,
- pick the pixel you care about,
- note the RGB values,
- update the relevant constants in the script (for example the target coordinates and color values),
- test repeatedly until the detection is reliable.
You will need:
- Python 3.10+,
- a webcam or a HDMI video capture card,
- a Nintendo Switch,
- the NXBT Python package,
- OpenCV,
- optionally OBS Studio for a virtual camera setup.
- Install the main dependencies with:
pip install opencv-python nxbtIf your environment requires it, you may also need additional system packages for camera access or Bluetooth support.
- Go in game in front of your starter or in the area you want to hunt
- Make sure the Switch is in the controller pairing mode.
- Setup a virtual camera on OBS so that the switch won't turn off between two screenshots
- Run the script and allow NXBT to create the controller connection.
sudo python3 starter.pyor
sudo python3 random_encounter_reset.py- The random encounter script will ask you if the pokemons encountered are shiny and will adds non-shiny pokemon to a database of pixel colors. Then the script will resume until he encounters a new pokemon with a pixel color he never encountered.
- Install OBS Studio.
- Open OBS and create a scene.
- Add a source such as a display capture, window capture, or a webcam source.
- Start the virtual camera from OBS.
- In your Python script, use the virtual camera source if your system exposes it as a camera device.
The most important part of this project is the pixel matching logic.
- Run the script that captures a frame.
python3 getPixelColorAndCoords.py- Click the pixel you want to monitor.
- Update the constants in the script to match the values you observed.
- starter.py: to shiny hunt the starter pokemon
- random_encounter_reset.py: reset-oriented random encounter script
- random_encounter_flee.py: alternate encounter flow with fleeing logic
- play.py: interactive control script
- getPixelColorAndCoords.py: helper to inspect captured images and retrieve pixel data