Chad,
It looks to be a matter of streamlining....
Mine does pretty much exactly what yours does, just with less calculations methinks?
#ut
player sidechat "Checking LOS"
_orig=u1
_targ=u2
_dist=_orig distance _targ
;player sidechat format ["_dist:%1",_dist]
_aslt=[_targ] call getASLheight
_aslo=[_orig] call getASLheight
?(_aslt>_aslo):goto "targhigh"
;orighigh
_h=(_aslo-_aslt)+.5
_lowunit=_targ
_highunit=_orig
_luh=(_aslt+.5)
goto "skiptarghigh"
#targhigh
_h=(_aslt-_aslo)+.5
_lowunit=_orig
_highunit=_targ
_luh=(_aslo+.5)
#skiptarghigh
;player sidechat format ["_lowunit:%1,_highunit:%2",_lowunit,_highunit]
lup setpos getpos _lowunit
hup setpos getpos _highunit
_dir=[lup,hup] call dirtoobj
lup setdir _dir
_lupos=getpos _lowunit
_lx=_lupos select 0
_ly=_lupos select 1
_ratio=(_h/_dist)
;player sidechat format ["_h: %1, _ratio:%2",_h,_ratio]
;;;;;;;;;LOS resolution in meters (1=check los at one meter intervals);;;;;;;;
_r=1
_di=1
#chklos
.1
_di=_di+_r
_nlx=_lx+(_di*(sin(_dir)))
_nly=_ly+(_di*(cos(_dir)))
checkheight setpos [_nlx,_nly]
drop ["cl_fire", "", "Billboard", 1,3, [0,0,0], [0, 0, 0], 0, 1.275, 1, 0, [.1,.1],[[1,1,1,1],[1,1,1,0]],[0],0,0,"","",checkheight]
_chasl=[checkheight] call getASLheight
;player sidechat format ["Checkheight ASL:%1",_chasl]
_losheight=(_luh+.5)+(_di*_ratio)
drop ["cl_fire", "", "Billboard", 1,3, [0,_di,(_di*_ratio)+.5], [0, 0, 0], 0, 1.275, 1, 0, [.1,.1],[[0,1,0,1],[0,1,0,0]],[0],0,0,"","",lup]
;player sidechat format ["LOS ASL:%1, _di:%2",_losheight,_di]
?(_chasl>_losheight):goto "nolos"
_cld=checkheight distance hup
;player sidechat format ["_cld:%1",_cld]
?(_cld>_r):goto "chklos"
player sidechat "LOS is clear"
~1
goto "ut"
#nolos
player sidechat "No clear LOS"
drop ["cl_fire", "", "Billboard", 1,30, [0,0,.5], [0, 0, 0], 0, 1.275, 1, 0, [1,1],[[1,1,1,1],[1,1,1,0]],[0],0,0,"","",checkheight]
exit
It's not commented very well (I'll fix that tonight) but there you go.
Here is a demo mission, I yanked it out without setting default units, so tou need BAS ranger/Delta (for no reason other that I was in a big hurry and forgot to clean up the mission .sqm, sorry-will fix with updated code)
-Grendel