thetrooper 10 Posted February 21, 2016 Hi all. I'm trying to set a enemy unit to look in the direction of the closest bluefor unit.If a different unit appraches closer to him he will then look in that direction. Any ideas? Share this post Link to post Share on other sites
NeoArmageddon 957 Posted February 21, 2016 params["_unit"]; private _target = objNull; while{alive _unit} do { private _nearest = _unit findNearestEnemy _unit; if((!isNull _nearest && (_nearest distance _unit < _target distance _unit)) || (isNull _target && !isNull _nearest)) then { _target = _nearest; _unit lookAt _target; }; sleep 1; }; Untested and without warranty ;) Maybe you need an additional check for _target being null at the beginning if something distance objNull produces an error. Share this post Link to post Share on other sites