Sounds like your 24 VAC power supply can’t output enough power for the 3 valves and Pi. Ray suggests at least 500 mA. What does your supply say it can do? It may be that you need more than 500 mA.
Here’s a simple test: unplug the 3-wire cable and instead power the Pi with an AC to USB mini adapter that can supply at least 700 mA. If the lock ups go away then you’ll need to keep powering the Pi with it’s own AC to mini USB adapter or get a bigger 24 VAC power supply.