Jump to content
Sign in to follow this  
NakedSquirrel

Changing large numbers of units/objects

Recommended Posts

Is there a way to change the init or skill level of entire groups of units? It is time consuming to click on each unit to change the same init property.

For instance: if I want to change all of the OPFOR to a lower skill level, I have to click on every unit in the group and click on the skill level bar manually.

Another thing I often want to change is their gear so I can remove grenades or change their kits

I had hoped I could go into the misssion.sqm file and just add things, but you have to get in and add a couple of lines to each unit, but it isn't quite as simple as copy and paste because the init line isn't automatically there, you have to add it. (Long story short, it takes as much clicking of the mouse as manually clicking on every unit.)

Anyhow, does anyone know any tricks I can use to make mass changes? My Left mouse button is getting worn out lol

Share this post


Link to post
Share on other sites

As long as you have each group leader named, you can put something into your init sqf such as

_myGroupLdrs = [ldrGrp, ldrGrp_1, ldrGrp_2, . . . , ldrGrp_n];
{{_x setSkill (0.3 + random 0.5);} forEach units group _x} forEach _myGroupLdrs;

There are also commands to return all groups on a given side if you look into it, I don't really know offhand but I'm sure you could use some neat tricks with that to automate a lot of things like you describe.

Share this post


Link to post
Share on other sites

I think this will work:

_eastunits = [];
{
if (side _x == east) then
{
  _eastunits = _eastunits + [_x];
};
} forEach allUnits;

{_x setSkill 0.2347157} forEach _eastunits;

The key is the reserved variable allUnits.

Edited by RKDmitriyev
argh

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  

×