How can I get this kind of code to work with multiple ForEach-commands? The problem is 2 _x´s in (_x distance _x)
{if (({_x distance _x > 300;} count (units group player)) > 0) then {deletevehicle _x;_tableAnimal = _tableAnimal - [_x]; _countAnimal = _countAnimal - 1;};} foreach _tableAnimal; It says something about _forEachIndex in here, but I dont understand it yet:
http://community.bistudio.com/wiki/forEachI would need a single line to check distances between objects in two dynamic size arrays.
Edit: I scripted it in another way, but if foreach inside foreach is possible, let me know:
_closestU = (units group player) select 0;
_disU = _closestU distance _center;
{if(_x distance _center < _disU) then {_disU = _closestU distance _center; _closestU= _x;};} foreach (units group player);
{if (_closestU distance _x > 300) then {deletevehicle _x;_tableAnimal = _tableAnimal - [_x]; _countAnimal = _countAnimal - 1;};} foreach _tableAnimal;