I was working on an RPG a while ago, and came up with this trigger. It's for "first-person" view, but if you don't want any of that just use the Lock Camera and the Rotation part of the trigger. You can set it to the unit through variables (if you need help with that too, I can answer that). Feel free to alter this any way you would like:
Code:
Events:
Time - every .20 seconds o' game time
Conditions:
NONE
Actions:
Camera - Apply Camera 1 <gen> for Player 1 (Red) over .20 seconds
Camera - Set Player 1 (Red)'s camera Rotation (Facing of (unit)) over .20 seconds
Camera - Set Player 1 (Red)'s Height offset ((Real((Terrain cliff level at (position of (Last created unit))))) x (90.00 - 50.00)) over 0.00 seconds
Camera - Lock camera target for Player 1 (Red) to (unit), offset by (0.00, 0.00) using Default rotation
Camera - Set Player 1 (Red)'s camera Height offset to 200.00 over 0.00 seconds
Camera - Set Player 1 (Red)'s camera Angle of Attack to 200.00 over 0.00 seconds
Camera - Set Player 1 (Red)'s camera Field of View to 100.00 over 0.00 seconds
EDIT: I'll explain what each part does-
"Camera - Apply Camera 1 <gen> for Player 1 (Red) over .20 seconds" - Applies the camera to the player, and the .20 seconds provides a smooth transition as opposed to instantly jumping to the unit.
"Camera - Set Player 1 (Red)'s camera Rotation (Facing of (unit)) over .20 seconds" - Sets the players camera rotation to the angle of the unit. Once again, .20 adds smoother transition (and looks more appealing than constantly jumping x degrees when the unit moves).
"Camera - Set Player 1 (Red)'s Height offset ((Real((Terrain cliff level at (position of (Last created unit))))) x (90.00 - 50.00)) over 0.00 seconds
Camera - Lock camera target for Player 1 (Red) to (unit), offset by (0.00, 0.00) using Default rotation" - This is mainly for the "first person" aspect. It helps raise the camera as your unit moves up on terrain. Other wise the unit runs off of the camera and the player cannot follow the unit.
"Camera - Set Player 1 (Red)'s camera Height offset to 200.00 over 0.00 seconds" - This makes the camera higher or lower, and I find 100-300 a good value that still keeps the unit on the screen.
"Camera - Set Player 1 (Red)'s camera Angle of Attack to 200.00 over 0.00 seconds" - This is the angle of the camera. 360 is lined up perfectly with the ground. I believe if the value goes below 300-320 (somewhere in there), the camera turns upside down, so watch out for that. This is generally the main part of the view when it comes to the camera.
"Camera - Set Player 1 (Red)'s camera Field of View to 100.00 over 0.00 seconds" - Self explanatory, how much the player sees, I could be wrong though...I never actually fiddled around with this much.
When you make the camera, you can double-click on it and fix it's distance. Distance can be played around with, but it basicly means how far away the camera is from the targeted unit.