Bake to Texture doesn't support all the vray render elements I want (e.g. cryptomatte) I was hoping to get around this with scripts, I've seen it is possible and some people have managed to bake vray maps not included in the Bake to Texture options:
render:#bakeselected crashes 3DSMAX when using Vray however. Even if I only have a cube with no custom render elements.
Solved my own issue.
Vray has a VrayExtraTexMap in the Bake to Texture options, which lets you plug in any 3DSMAX Map. I guess they did it this way because VRAY bypasses the default render system.
Confirmed working with Vray Dirt, Vertex Color, Material ID
Wow, I didn't know that old piece of crappy code could help somebody! I'm sorry that it didn't work from the beginning for you. But then again, good job for making it work!