If you rather fancy the elegant way:
(I'm using vectors because it's faster)
set vector2 1, object position x(player) - object position x(enemy), object position z(player) - object position z(enemy)
normalize vector2 1
multiply vector2 1, Distance#
position camera object position x(player) + x vector2(1), Height#, object position y(player) + y vector2(1)
point camera object position x(enemy), object position y(enemy), object position z(enemy)
The same applies in 3D:
set vector3 1, object position x(player) - object position x(enemy), object position y(player) - object position y(enemy) + HeightForVisibility#, object position z(player) - object position z(enemy)
normalize vector3 1
multiply vector3 1, Distance#
position camera object position x(player) + x vector3(1), object position y(player) + y vector3(1), object position z(player) + z vector3(1)
point camera object position x(enemy), object position y(enemy), object position z(enemy)
Cheers!
Sven B