It was difficult to work out what to do with your advice as the (ENTITY* target) part seemed to me to say the ENTITY pointer had nominated the name target as an entity.
I'm not sure whether I understand you. "ENTITY* target" normally marks only the place where you have to insert the pointer of your entity. As far as I understood this.
action player_walk_around
{
player = me;
chase_camera(player);
while(1)
{
my.pan += key_cul-key_cur;
my.x += key_cuu-key_cud;
wait(1);
}
}
Before that action you have to insert the function, I replaced target with "ent_for_cam":
function chase_camera(ENTITY* ent_for_cam)
{
// calculate the camera view's direction angle to the ent_for_cam
var cam_dist[3] = {-200,-100,-100}; // xyz distance vector from the camera to the ent_for_cam
var cam_ang[3]; // direction angle of the camera to the ent_for_cam.
vec_to_angle(cam_ang,cam_dist);
cam_ang.roll = 0; // roll didn't change vec_to_angle
// permanently updating the camera's position and angle
while (1)
{
// place the camera at the right position to the target
vec_diff(camera.x,nullvector,cam_dist);
vec_rotate(camera.x,ent_for_cam.pan);
vec_add(camera.x,ent_for_cam.x);
// Set the camera angles to the camera view direction
vec_set(camera.pan,cam_ang);
// and rotate it about the ent_for_cam angle
ang_add(camera.pan,ent_for_cam.pan);
wait(1);
}
}