iV - Ghost 50 Posted January 21, 2018 How can I check if vehicles from a defined type (O_APC_Tracked_02_AA_F) are inside a radius around a position? This should be a condition for a waitUntil loop. Share this post Link to post Share on other sites
Tankbuster 1747 Posted January 21, 2018 https://community.bistudio.com/wiki/inAreaArray Share this post Link to post Share on other sites
iV - Ghost 50 Posted January 21, 2018 But I don't have a area because my position is a icon marker with no radius. I could use a area marker and inArea but a icon marker look better in this case. And with nearestObject I can only detect one vehicle. Share this post Link to post Share on other sites
Tankbuster 1747 Posted January 21, 2018 You're going to have to be a little clearer. Do you know the radius you want to check around the position? Share this post Link to post Share on other sites
iV - Ghost 50 Posted January 21, 2018 The radius could be 50m. But it is not important. This is a working way for detecting only 1 vehicle: // TRIGGER END waitUntil { sleep 1; !alive (getMarkerPos "AA_Mike26_1" nearestObject "O_APC_Tracked_02_AA_F"); }; But I need to detect all of the given kind. EDIT Maybe something like this: (getMarkerPos "AA_Mike26_1" nearSupplies 50 select {_x isKindOf "O_APC_Tracked_02_AA_F"}) count vehicle == 0; Share this post Link to post Share on other sites
Tankbuster 1747 Posted January 21, 2018 vehicles inAreaArray [getmarkerpos "myiconmarker", 50, 50, 0, false, -1] select {(typeOf _x) isEqualto "O_APC_Tracked_02_AA_F"}; Will return all the Tigrii (little known fact, plural of Tigris) within 50 of your marker. Adjust the marker name to what yours is. Share this post Link to post Share on other sites
Tankbuster 1747 Posted January 21, 2018 In a waitUntil. waitUntil {count (vehicles inAreaArray [getmarkerpos "myiconmarker", 50, 50, 0, false, -1] select {(typeOf _x) isEqualto "O_APC_Tracked_02_AA_F") > 0}; 1 Share this post Link to post Share on other sites
iV - Ghost 50 Posted January 22, 2018 OK. Small syntax fail in your version. Should be: count (vehicles inAreaArray [getmarkerpos "AA_Mike26_1", 50, 50, 0, false, -1] select {(typeOf _x) isEqualto "O_APC_Tracked_02_AA_F"}) == 0; But this detected all "O_APC_Tracked_02_AA_F" in the area. How can I select only the alive ones? Share this post Link to post Share on other sites
Schatten 290 Posted January 22, 2018 @iV - Ghost, use nearEntities command. Share this post Link to post Share on other sites
Tankbuster 1747 Posted January 22, 2018 10 minutes ago, iV - Ghost said: OK. Small syntax fail in your version. Should be: count (vehicles inAreaArray [getmarkerpos "AA_Mike26_1", 50, 50, 0, false, -1] select {(typeOf _x) isEqualto "O_APC_Tracked_02_AA_F"}) == 0; But this detected all "O_APC_Tracked_02_AA_F" in the area. How can I select only the alive ones? count (vehicles inAreaArray [getmarkerpos "AA_Mike26_1", 50, 50, 0, false, -1] select {((typeOf _x) isEqualto "O_APC_Tracked_02_AA_F") and alive _x} == 0; Share this post Link to post Share on other sites
iV - Ghost 50 Posted January 22, 2018 count (vehicles inAreaArray [getmarkerpos "AA_Mike26_1", 50, 50, 0, false, -1] select {(typeOf _x) isEqualto "O_APC_Tracked_02_AA_F"} and alive _x) == 0; Error: No defined variable in _x Share this post Link to post Share on other sites
Schatten 290 Posted January 22, 2018 (getMarkerPos "AA_Mike26_1") nearEntities ["O_APC_Tracked_02_AA_F", 50]; vehicles inAreaArray [getMarkerPos "AA_Mike26_1", 50, 50] select {(alive _x) and {(typeOf _x) == "O_APC_Tracked_02_AA_F"}}; Share this post Link to post Share on other sites
davidoss 552 Posted January 22, 2018 count (vehicles inAreaArray [getmarkerpos "AA_Mike26_1", 50, 50, 0, false, -1] select {((typeOf _x) isEqualto "O_APC_Tracked_02_AA_F") && {alive _x}}) != 0 But like Schatten already says nearEntities gives you better approach 1 Share this post Link to post Share on other sites
davidoss 552 Posted January 22, 2018 !(((entities [["O_APC_Tracked_02_AA_F"], [], false, true]) inAreaArray "AA_Mike26_1") isEqualTo []) you can also like this if the marker has any shape Share this post Link to post Share on other sites
iV - Ghost 50 Posted January 22, 2018 OK thx a lot. How would the syntax for a waitUntil condition look? Something like this? count (getmarkerpos "AA_Mike26_1" nearEntities ["O_APC_Tracked_02_AA_F", 50]) == 0; Share this post Link to post Share on other sites
Schatten 290 Posted January 22, 2018 @iV - Ghost, just delete semicolon: waitUntil { (count ((getMarkerPos "AA_Mike26_1") nearEntities ["O_APC_Tracked_02_AA_F", 50])) == 0 }; Share this post Link to post Share on other sites
iV - Ghost 50 Posted January 22, 2018 Why you put it in brackets and let the "== 0" outside of it? Should it not be: waitUntil { sleep 1; count (getmarkerpos "AA_Mike26_1" nearEntities ["O_APC_Tracked_02_AA_F", 50]) == 0; }; Share this post Link to post Share on other sites
davidoss 552 Posted January 22, 2018 As the post thema says it schould be opposite of Share this post Link to post Share on other sites
Schatten 290 Posted January 22, 2018 3 minutes ago, iV - Ghost said: Why you put it in brackets and let the "== 0" outside of it? It's for better perception. 3 minutes ago, davidoss said: As the post thema says it schould be opposite of Yea, waitUntil { (count ((getMarkerPos "AA_Mike26_1") nearEntities ["O_APC_Tracked_02_AA_F", 50])) > 0 }; Share this post Link to post Share on other sites
iV - Ghost 50 Posted January 22, 2018 Perception? Better for the work of the engine? Or for my personal perception? Share this post Link to post Share on other sites
davidoss 552 Posted January 22, 2018 You guys are making this thread red. 2 + 2 > 2 (2 + 2) > 2 1 Share this post Link to post Share on other sites
Schatten 290 Posted January 22, 2018 4 minutes ago, iV - Ghost said: Better for the work of the engine? Or for my personal perception? The engine doesn't care about extra brackets. It's just for convenience of human perception. 1 1 Share this post Link to post Share on other sites
iV - Ghost 50 Posted January 22, 2018 OK. Sorry for the crazy questions. I try to learn and startet few weeks ago. I have a lot of stuff to catch up. Thx to all for the help and the explanations! Share this post Link to post Share on other sites
Grumpy Old Man 3549 Posted January 22, 2018 3 minutes ago, Schatten said: The engine doesn't care about extra brackets. It's just for convenience of human perception. Not entirely true, few commands demand following parameters to be in brackets, like this: systemchat str ["oy","vey"] select 1;//prints: ["oy","vey"] systemchat str (["oy","vey"] select 1);//prints: vey Cheers 1 Share this post Link to post Share on other sites
Schatten 290 Posted January 22, 2018 @Grumpy Old Man, another advantage of using extra brackets! Share this post Link to post Share on other sites