Results 1 to 4 of 4

Thread: Get array of detected targets

  1. #1

    Get array of detected targets

    Is there any way for a group or unit to pass an array of all their detected units?

  2. #2

  3. #3
    Thank you!

    I am assuming this only returns targets the unit actually knows about?

  4. #4
    Sergeant Major SNKMAN's Avatar
    Join Date
    Aug 29 2006
    Location
    Germany ( Lake Constance )
    Posts
    1,616
    Yeah "nearTargets" will return all units in the given range/position friendly and enemy.

    So you would need to do something like:

    Code:
    private ["_unit","_targets","_count","_selectTarget"];
    
    if (isNil "EnemyArray") then
    {
    	EnemyArray = [];
    };
    
    _unit = MyUnit;
    
    _targets = _unit nearTargets 200;
    
    if (count EnemyArray > 0) then
    {
    	_targets = _targets - EnemyArray;
    };
    
    if (count _targets > 0) then
    {
    	_count = 0;
    
    	while { (_count < count _targets) } do
    	{
    		_selectTarget = (_targets select _count);
    
    		if ( (_unit knowsAbout _selectTarget > 0) && (_unit countEnemy [_selectTarget] > 0) ) then
    		{
    			EnemyArray = EnemyArray + [_selectTarget];
    		};
    
    		_count = _count + 1;
    	};
    };

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •