Heyo, I decided I'd give updating the script to v19 a shot. I managed to get it to a state where the Legendaries with special rules (Latis, Manaphy, Mew/Mewtwo, and Regis) don't crash. To be honest, I haven't tested this beyond that, but it should work ... hopefully.
I'm still a novice with...