assignedTarget – Talk

From Bohemia Interactive Community
Jump to navigation Jump to search

Does this function return the current target of a unit in all instances? This means does it return the target of a unit whether another unit or scripting assigns it and/or when the unit choses the target by itself.

--Havoc 16:25, 25 December 2006 (CET)


Yes, it seems to. At least in Arma2 1.05. I did a test with an Apache and with a rifleman, using an init-field of
nul = this spawn { while{alive _this} do { sleep 0.2; hintSilent str(assignedTarget _this); }; };
to watch what they were up to, and in both cases once they autonomously targeted an enemy, it was shown in the hint dialog. In the case of the soldier he was the only one in the group, so wasn't assigned a target by a separate leader. Might be interesting to note that they don't immediately target everything they see - I was using switchCamera to show me the AI's POV and the rifleman had a square "lock" indicator come up shifting between two enemies he'd spotted, and it took a while before he actually decided to target one. --nomdeplume 18:14, 31 December 2009 (CET)