vec_set(viewname.X,entitypointer.X);
This has to be done in an endless loop and of course there has to be a pointer to the entity it shall follow. Simply as that, and if you want to set the view to a certain position at the entities body, you have to calculate the difference between its origin and add this after the vec_set.