Jump to content
Sign in to follow this  
Robustcolor

configFile >> cfgGroups into an array.

Recommended Posts

Hi, which is the simpliest way to fetch each units from a group into an array using configFile?

 

I'm trying it like this but it's not working.

_enemyUnits = [[configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> "OIA_InfAssault"]];

_group = createGroup [east,true];

_unit = _group createUnit [selectRandom _enemyUnits,getMarkerPos "Marker1",[],0,"CAN_COLLIDE"];

 

Share this post


Link to post
Share on other sites

should be something like:

 

_enemyUnits = getArray (configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> "OIA_InfAssault");

 

 

 

 

Share this post


Link to post
Share on other sites
1 hour ago, gc8 said:

_enemyUnits = getArray (configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> "OIA_InfAssault");

Gives a empty array []. Can't selectRandom _enemyUnits;

Share this post


Link to post
Share on other sites

sorry my bad, it's more like:

 

_groupCfg = configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> "OIA_InfAssault"; 

for "_i" from 0 to 100 do
{
_unitCfg = _groupCfg >> (format["unit%1",_i]);
if(isnull _unitCfg) then { break; };

systemchat format["Unit type: %1", getText (_unitCfg >> "vehicle")];

};

 

  • Like 1

Share this post


Link to post
Share on other sites

another option:
 

Spoiler


_enemyUnits = ("true" configClasses (configfile >> "CfgGroups" >> "East" >> "OPF_F" >> "Infantry" >> "OIA_InfAssault") apply {getText (_x >> "vehicle")});

//systemchat format["Unit type array: %1", _enemyUnits]; remove comment if you want

_group = createGroup [east,true];

_unit = _group createUnit [selectRandom _enemyUnits,getMarkerPos "Marker1",[],0,"CAN_COLLIDE"];

 

 

  • Like 2

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×