tebbbs 33 Posted August 12, 2020 I want to loop over all vehicles and add an action to it (also those vehicles, that i spawn with Zeus) how do i do that? Share this post Link to post Share on other sites
Von Quest 1163 Posted August 12, 2020 https://community.bistudio.com/wiki/forEach 1 Share this post Link to post Share on other sites
Harzach 2517 Posted August 12, 2020 Also: https://forums.bohemia.net/forums/forum/154-arma-3-mission-editing-scripting/ 1 Share this post Link to post Share on other sites
tebbbs 33 Posted August 13, 2020 i know what a foreach loop is.. but arma 3 is a pita when its about locality.. thats the main issue i had in the past and before i start over again, i though someone knows exactly in which file and where i have to put it.. On 8/12/2020 at 2:06 PM, Harzach said: Also: https://forums.bohemia.net/forums/forum/154-arma-3-mission-editing-scripting/ i dont think so.. this will be part of a small mod Share this post Link to post Share on other sites
Harzach 2517 Posted August 13, 2020 24 minutes ago, tebbbs said: i know what a foreach loop is.. but arma 3 is a pita when its about locality.. thats the main issue i had in the past and before i start over again, i though someone knows exactly in which file and where i have to put it.. i dont think so.. this will be part of a small mod Then start a topic for the development of your mod. As it is, this is a scripting topic. I'm not rules-lawyering, though it is indeed a forum rule. The point is that putting your topic in the wrong subforum can result in fewer eyes on it. 1 Share this post Link to post Share on other sites
laxemann 1673 Posted August 14, 2020 On 8/12/2020 at 11:26 AM, tebbbs said: I want to loop over all vehicles and add an action to it (also those vehicles, that i spawn with Zeus) how do i do that? So your key issue is that you want to add actions to every spawned vehicle? In this case, a loop would be a very inefficient solution. You can use init Eventhandlers in the vehicle's config: https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Init 1 Share this post Link to post Share on other sites
snkman 351 Posted August 14, 2020 5 sec. loop: private "_vehicles"; private _array = []; while { (True) } do { _vehicles = (vehicles - _array); if (True) then { if (_vehicles isEqualTo [] ) exitWith {}; _array append _vehicles; {_x addAction ["Your action here!", {} ]; } forEach _vehicles; }; sleep 5; }; 1 Share this post Link to post Share on other sites
haleks 8212 Posted August 15, 2020 Better yet : instead of creating numerous actions, add one single action that works for all vehicles to the player itself. Share this post Link to post Share on other sites