bobtom 10 Posted January 29, 2012 (edited) Hey, I'm trying to find an array of the nearest triggers to a location. I've tried: _list = nearestObjects [createPos, ["emptyDetector", 1000]; and: _list = createPos nearEntities ["emptyDetector",1000]; I'm assuming I have the type of the trigger wrong. Here is what I'm trying to accomplish: _list = nearestObjects [createPos,["EmptyDetector"],1000]; diag_log _list; {deleteVehicle _x} forEach _list; Any ideas? Thanks Craig Edited January 29, 2012 by bobtom Share this post Link to post Share on other sites
demonized 16 Posted January 30, 2012 Dont think you can locate triggers witout knowing about them, same as you cannot locate markers without knowing about them. Share this post Link to post Share on other sites
Tankbuster 1607 Posted January 30, 2012 Demonized is right. Unfortunately there is no nearestTrigger or nearestMarker command. The work around is to create an invisiblehelipad at the same location as the trigger and look for that. If there's likely to be only one nearby, or you always want the nearest one, use nearestObject, not nearestObjects. :) Share this post Link to post Share on other sites
bobtom 10 Posted January 30, 2012 That's what I thought, thanks anyway. @tankbuster The triggers are dynamically spawned, so there will be more than one. I found a workaround anyway, thanks. Share this post Link to post Share on other sites
Tankbuster 1607 Posted January 30, 2012 What did you do? Share this post Link to post Share on other sites
shuko 46 Posted January 30, 2012 Since you are controlling how and when they are created, you are perfectly capable for keeping track of them with a simple global array variable, no? Share this post Link to post Share on other sites
bobtom 10 Posted January 30, 2012 What did you do? Sorry, I wanted to elaborate, but I was busy at the time. :o My workaround: The triggers spawn people, so I just used the following to delete the ones close to the base as they spawned: _checking = 1; while {_checking == 1} do { _people = nearestObjects [[getpos _hill select 0, getpos _hill select 1,0],["Man"],250]; {if (!isPlayer _x) then {_x setdamage 1};} forEach _people; sleep 1; }; But this was only a quick fix, I wanted to do what Shuko was talking about, just make an array while they spawned and check for the close ones, but I was to lazy at the time to do it. And I had already written out the above code for something else. But since then I've changed it: trigArray = trigArray + [_trig]; and _checking = 1; while {_checking == 1} do { { if ((_x distance _hillPos) < 1000) then {deleteVehicle _x}; } forEach trigArray; }; Yeah, I know I could just use true, but that's just how I like to do it. :) Thanks, Craig Share this post Link to post Share on other sites
jinker 18 Posted April 5, 2015 This works for Arma 3: _list = [_xpos,_ypos] nearObjects ["EmptyDetector", 6000]; Returns an array of all triggers in range. Share this post Link to post Share on other sites