Just use the "Unit create units facing angle" action at the position of the building and use the "unit- last created unit" action when ordering them, or spawn units at the center of a reagion that is in front of the building and use the "unit group- order units in (region)" action to give them orders. Or assign the unit to be able to be built from the building, remove it gold/lumber/food requirement and use the "unit- issue upgrade/build order" and have the building train the unit, then use the "unit- last trained unit" action when ordering the build units to do something.
There are many ways. Just explore.
-VGsatomi