Jump to content

Scripting: How can I get a list of all groups in mission (including ones marked late activate). MOOSE/MIST/PURE/I Don't Care?


Recommended Posts

Posted

Hi,

As title mentions, I want to build a list of all units that are currently in a map - but must including all late activated units

All my efforts so far have failed. I have only been able to get a list of ACTIVE units - ones not yet active in a mission don't appear.

Does anyone know if this is possible, and if so - how to go about it?

Thanks

DZ

 

Posted (edited)

There are multiple sides to this issue:

  • All units that are defined by the mission (active, inanctive, dead)
  • All units that have spawned dynamically by script

Now, one way to get all units in your mission that were defined by Mission Editor (i.e. all except those that spawned dynamically), is that you can iterate env.mission.coalition to collect all groups and their units. If you do that, you end up with a table of all units (ships, planes, helos, static, vehicles) that were defined. You then need to separate out those who are dead (but not those who have not yet activated)

Then, you iterate all coalitions returned with coalition.getGroups() and check those against the table you previously got from the mission. Those units that aren't in that table are units that have spawned dynamically and need to be added.

 

Edited by cfrag
Posted (edited)

Thanks for the replies. 

I'll check out getGroups but I fear it won't do it in all instances.  I see however with cfrag's post that I may need to do a few different calls to get all units both in the ME plus those that have been spawned dynamically later. 

If I'm successful and can create a new function that does all this in one, I'll post the function back here. 

Thanks again for your help and responses!

Edited by Dangerzone
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...