var tDist = 100;
Function doIt()
{
vec_set(temp, vector(tDist, 0, 0));
vec_rotate(temp, my.pan);
if (c_trace(my.x, temp, ignore_me))
{
// Found a wall!
vec_to_angle(my.pan, normal);
ang_rotate(my.pan, vector(180, 0, 0));
//
vec_set(my.x, target);
vec_set(temp, vector(-10, 0 0));
vec_rotate(temp, my.pan);
vec_add(my.x, temp);
}
}
tDist is the range it should trace for a wall. Then just call tDist from your entity's action. If it finds a wall, then it will face it from 10 quants away.