_player = _this select 0

_x = (getpos scud select 0) + ((sin (getdir scud ))*3)
_y = (getpos scud select 1) + ((cos (getdir scud ))*3)

_xpold = (getpos scud select 0)
_ypold = (getpos scud select 1)
_distold = ( sqrt((_xpold - _x)^2 + (_ypold - _y)^2))

_check=0

#loop

_xp= (getpos scud select 0)
_yp =(getpos scud select 1)

_x = (getpos scud select 0) + ((sin (getdir scud ))*3)
_y = (getpos scud select 1) + ((cos (getdir scud ))*3)

_distnew = ( sqrt((_xp - _x)^2 + (_yp - _y)^2))

_distchange=SCUDDIST

?_check > 0: _check=_check+1
?_check==3: _check=0

?((_distold - _distnew) > .04 && _check==0): SCUDDIST=SCUDDIST + (_distold - _distnew)*(SCUDDIST/10); _check=1
?((_distold - _distnew) < -.03 && _check==0): SCUDDIST=SCUDDIST + (_distold - _distnew)*(SCUDDIST/10); _check=1

?(SCUDDIST > 5000):SCUDDIST=500
?(SCUDDIST < 500): SCUDDIST=5000

?(_distchange != SCUDDIST):hint format["Set distance: %1",SCUDDIST]

scud setpos [_xpold,_ypold,0]
;_arti setpos [_x,_y,0]

_xpold = (getpos scud select 0)
_ypold = (getpos scud select 1)
_distold = ( sqrt((_xpold - _x)^2 + (_ypold - _y)^2))

~0.05

?(movemode2==0):goto "loop"

movemode = 0
movemode2 = 0
exit
