As the previous gentleman stated, building pos will work for you. Look up the building ID in the editor, and the following line of code will work"
this setpos ((position this nearestobject 12345) buildingpos 4);
Substitute 12345 with your tower's building ID. You also have to determine the correct building position. In-game, building positions are shown as 1 through X. But in code, they are 0 to X-1, so adjust your desired buinding pos accordingly.
When using this to put units on top of buildings where there are no guard rails, you might want to use "unit disableAI "TARGET"" command which which prevents him from wanting to engage targets and run off the roof to his death. The unit will still shoot enemies, but he won't run off to ENGAGE. If you want him to not move at all then do this also: "unit disableAI "MOVE"".