Skip to content

Repository files navigation

ShinyHuntSwitch

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.

What this project does

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:

  1. Capture a frame from your camera or OBS virtual camera.
  2. Identify the pixel color that represents a specific screen state.
  3. Edit the script constants so the detection logic matches your game and display.
  4. Run the automation loop and let the script interact with the Switch.

Important note about pixel detection

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.

Prerequisites

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.

Get Started

  1. Install the main dependencies with:
pip install opencv-python nxbt

If your environment requires it, you may also need additional system packages for camera access or Bluetooth support.

  1. Go in game in front of your starter or in the area you want to hunt
  2. Make sure the Switch is in the controller pairing mode.
  3. Setup a virtual camera on OBS so that the switch won't turn off between two screenshots
  4. Run the script and allow NXBT to create the controller connection.
sudo python3 starter.py

or

sudo python3 random_encounter_reset.py
  1. 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.

OBS setup

  1. Install OBS Studio.
  2. Open OBS and create a scene.
  3. Add a source such as a display capture, window capture, or a webcam source.
  4. Start the virtual camera from OBS.
  5. In your Python script, use the virtual camera source if your system exposes it as a camera device.

How to calibrate pixel detection

The most important part of this project is the pixel matching logic.

Recommended process

  1. Run the script that captures a frame.
python3 getPixelColorAndCoords.py
  1. Click the pixel you want to monitor.
  2. Update the constants in the script to match the values you observed.

Project layout

  • 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

About

Python scripts to hunt shiny pokemon on the Switch

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages