Thanks Jason!
A big problem I was having was that the script uses the terrains bounding box and origin to get its size and XY center. If the origin is off, it gets messed up. I fixed this by changing the function to use the terrains corner vertices instead.
Also the script is made for HMP's and not MDL's such as I neeeded, so I hade to remove "ignore_models" a c_trace function was using .
An interesting note for anyone else using this script, The uv mapping has to
be in the correct orientation. It was drawing the shadows in the wrong places for me until I rotated the mapping 90 degress CCW in MED
I got more realistic shadows (IMO), by keeping the "suns" position at the same relative position (offset) to each pixel checked rather than all the traces coming from the same point. This probably looks better because the real sun is so far away it seems to cast somewhat parallel shadows.
I added the wiki "TGA write" script to this too, it works great! Load the terrain, press enter and out comes the tga shadow map! (well, almost that easy!

).