I guess something like this: if(c_scan(my.x,my.pan,vector(120,0,200),IGNORE_ME|SCAN_ENTS) != 0) { if(you!=NULL) { c_trace(you.x,my.x,IGNORE_ME|USE_BOX); if(trace_hit){see_player = 0;}else{see_player = 1;} } } Not sure that this will work (I can't think properly with my sick head ), but you can catch an idea...