Just make them allied to the respective players.
As mentioned by wcity, you go to the Player Properties settings:
Terrain Editor -> Scenario -> Player Properties...
and there you make the players allied to their teammates ánd their computer palyer who controls their structures, minions, etc.
As Dr. Super Good mentioned:
"For example in a 5v5 AoS you would have Player(5) own towers for team Player(0-4) and Player(11) own the towers for team Player(6-10)."
Note that Player(0) = Player 1 (red), Player(1) = Player 2 (blue), etc.
When you have chosen how big the teams should be, then you go to the player settings and make those people allied and set the computers to computer controlled.
Also do not forget to go to another tab in that window which is about Forces.
There you have an option to "Use Custom Forces" and "Fixed Player Settings".
Both should be true.
About the attacks themselves...
You can simply use normal attacks like the turrets in WC3 do.
Just base your turret building of from a regular turret and it will attack already.
Also, I would suggest you to take a look about how Priority works.
It will help you create more player friendly turrets in WC3.
(I thought that if you do not change priority, the turrets will attack heroes over minions.
In almost every MOBA that I have seen... turrets will attack minions over heroes until those heroes attack their own heroes in range.)