anfo 118 Posted August 6, 2016 Hi all May borrow someone's grey matter to determine how to create an array from a particular command? The command is: {_x enablesimulation true} foreach units group en_1; where en_1 is a single group enabled to move upon a fired trigger. However I'm sure there is a more efficient way (an array) to make many groups move instead of copying the same code over and over for each group? Many thanks Anfo Share this post Link to post Share on other sites
davidoss 552 Posted August 6, 2016 You can join all groups to an single array. _groups = [en_1,en_2,en_3,en_4]; {{_x enableSimulation true} forEach (units _x)} forEach _groups; Share this post Link to post Share on other sites
Grumpy Old Man 3546 Posted August 6, 2016 Your code won't work if en_1 is a group. For multiple groups: { _grp = _x; {_x enablesimulation true} foreach units _grp; } foreach [en_1,en_2,en_3]; Cheers Share this post Link to post Share on other sites
anfo 118 Posted August 6, 2016 Your code won't work if en_1 is a group. For multiple groups: { _grp = _x; {_x enablesimulation true} foreach units _grp; } foreach [en_1,en_2,en_3]; Cheers Thank you Gentlemen Share this post Link to post Share on other sites
MKD3 27 Posted August 7, 2016 Your code won't work if en_1 is a group. Im confused, you literally changed nothing to his code, just made it prettier. Share this post Link to post Share on other sites
killzone_kid 1332 Posted August 7, 2016 Im confused, you literally changed nothing to his code, just made it prettier. He was referring to the OP's code, you could easily see mistake with using group command on a group. 1 Share this post Link to post Share on other sites
MKD3 27 Posted August 7, 2016 He was referring to the OP's code, you could easily see mistake with using group command on a group. Ah, I thought it was for the post above his, fair enough Share this post Link to post Share on other sites