nearestObjects with CharacterID

Sandbird

Valued Member!
How can i do :

_getBuilding_objs = nearestObjects [player, ["Gate1_DZ"], 50]; // 50m radius

but only for objects belonging to a specific player ?

I got this so far but as you can see it will put EVERYTHING in _getBuilding_objs and then do the check....
I want to do the check for ownerID and then add all those to _getBuilding_objs.

Code:
_getBuilding_objs = nearestObjects [player, ["Gate1_DZ"], 50];

_findNearestGate = [];
{if (alive _x) then {_findNearestGate set [(count _findNearestGate),_x];};} foreach _getBuilding_objs;
_IsNearGate = count (_findNearestGate);
if(_IsNearGate >= 1) then {
    _nearestGate = _findNearestGate select 0;
    // Find owner
    _ownerID = _nearestGate getVariable["CharacterID","0"];

    if(dayz_playerUID == _ownerID) then {
        // He is the owner of it
         _canOperateGate = true;
    } else {
        _friendlies  = player getVariable ["friendlyTo",[]];
        // check if friendly to owner
        if(_ownerID in _friendlies) then {
          _canOperateGate = true;
        };
    };
}
 
Back
Top