Jump to content
Sign in to follow this  
nalesnik

spy-type tracking

Recommended Posts

Small, pretty straightforward script... unit spying unit just like in old-good bond movies. Come close, move away etc. Perhaps someone will do sth usefull with

this. Comments, flames welcome :)

--- cut here ---

; [leader, follower, max, min, frequency]exec "scriptname.sqs"

; Comments, flames to Kichu <kgb@skydive.poznan.pl>

_leader = _this select 0

_follower = _this select 1

_max = _this select 2

_min = _this select 3

_freq = _this select 4

break = 0

#vrfy

; titleText[ format["RANGE: %1", _follower distance _leader], "plain"]

? (break == 1) : goto "exit_logic"

? (not (alive _follower)) : goto "exit_dead"

? ((_follower distance _leader) > _max) : goto "move_closer"

? ((_follower distance _leader) < _min) : goto "move_farther"

~_freq

goto "vrfy"

#move_closer

_posL = getpos _leader

_posF = getpos _follower

_Ax = _posL select 0

_Ay = _posL select 1

_Bx = _posF select 0

_By = _posF select 1

_Cx = _Bx + (_Ax - _Bx) / 4

_Cy = _By + (_Ay - _By) / 4

_follower move [_Cx, _Cy]

~3

goto "vrfy"

#move_farther

_posL = getpos _leader

_posF = getpos _follower

_Ax = _posL select 0

_Ay = _posL select 1

_Bx = _posF select 0

_By = _posF select 1

_Cx = _Bx - (_Ax - _Bx)

_Cy = _By - (_Ay - _By)

_follower move [_Cx, _Cy]

~3

goto "vrfy"

#exit_dead

exit

#exit_logic

exit

--- cut here ---

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×