Grumpy Old Man 3545 Posted December 14, 2013 Hey folks, absolutely lost and majorly confused here, no clue how to do this. 1.:global array1 has a finite amount of units stored 2.:I need to access each single one of those units and issue them !individual! commands naming local variables like _unit1,_unit2,etc. seems to be too cumbersome is there some way to automate this with a foreach loop? maybe I'm just overcomplicating things, again Cheers Share this post Link to post Share on other sites
Kerc Kasha 102 Posted December 14, 2013 {blah} foreach array1 Share this post Link to post Share on other sites
Grumpy Old Man 3545 Posted December 14, 2013 This won't let me issue individual commands to single units inside the array. Share this post Link to post Share on other sites
bangabob 42 Posted December 14, 2013 This will generate a number foreach unit which can then be retrieved. Not entirely sure what your plan is so more information would be useful _n=0; { _n=_n+1; _localName=format["unit%1",_n]; _x setvariable ["name",_localName]; }foreach array1; Share this post Link to post Share on other sites
fusion13 11 Posted December 14, 2013 Edit bangas looks like what u need Share this post Link to post Share on other sites
Grumpy Old Man 3545 Posted December 14, 2013 Not entirely sure what your plan is so more information would be useful I want to find a way to select a unit from an array, order doesn't really matter, can be ascending or random, then make it accessible to commands like unit1 commandfire target1 just as an example basically I'm looking for a way to make unit1 = array1 select 0; into unit1 without having to refer to array1 select 0 but I'm not really sure how ---------- Post added at 16:20 ---------- Previous post was at 15:51 ---------- looks like I found what I wanted _name = "whatever"; _vehs = nearestObjects [pad1,["2S6M_Tunguska"], 15]; for "_i" from 0 to (count _vehs - 1) do { (_vehs select _i) setVehicleVarName _name+str(_i); missionNamespace setVariable [_name + str(_i),( _vehs select _i)]; }; gonna adapt that Scripting can be one hell of a bad idea if you got no clue what you're doing (like me) Cheers Share this post Link to post Share on other sites
shuko 59 Posted December 15, 2013 { _x commandFire target1; } foreach array1; Share this post Link to post Share on other sites