Catch dialga ultramoon

I’m playing pokemon ultramoon and I want to capture dialga but it’s from ultra sun, how is the code to make it go wild on any route?