Koni 3 Posted November 7, 2011 How do you use a trigger to measure the distance from a unit to a faction side or any group member? I know about unit distance unit <= 10 to measure distance between one unit and another or object but how do you use a faction side and a group member ? Like, distance from unitname to any unit of Blufor faction, or unitname distance to any member of a certain group. Thanks Share this post Link to post Share on other sites
wiggum2 31 Posted November 7, 2011 Try this: {if ((side _x == east) && (_x distance unit <= 10)) then {hint "east unit is near !";}} foreach allunits; Share this post Link to post Share on other sites
twirly 11 Posted November 7, 2011 (edited) Don't know if this might help you...but it is a function I just put together that will return UNITS of a specified SIDE within a specified RADIUS. You can then measure the distance to each unit or whatever. From testing... the first object in the returned list is always the closest object. Works with all things of type "LAND".... so will return units and land vehicles of the specified side. I haven't thought about making it work with a trigger... but will post this anyway and have a further tinkle to see what I come up with. fn_getNearUnits.sqf :- /* Put in init.sqf:- getNearUnits = compile preprocessfile "fn_getNearUnits.sqf"; Call like this:- _nearunits = [object,radius,side_to_check_for] call getNearUnits; Where object is an object, a marker or a position. returns number of units of side_to_check_for within the specified radius of the object */ private ["_inp","_rad","_sid","_pos","_list","_i","_dude","_units"]; _inp = _this select 0; _rad = _this select 1; _sid = _this select 2; switch (typename _inp) do { case "OBJECT": {_pos = getpos _inp}; case "STRING": {_pos = getmarkerpos _inp}; case "ARRAY": {_pos = _inp}; }; _units = []; _list = nearestObjects [_pos,["Land"],_rad]; for "_i" from 0 to ((count _list) - 1) do { _dude = _list select _i; if (_sid == side _dude) then { if (not(_dude in _units)) then {_units set [(count _units),_dude]}; }; }; _units EDIT: Forgot to add that the thing you are scanning from can be an object, a marker or a position. Edited November 7, 2011 by twirly Clarity Share this post Link to post Share on other sites