Dangerzone Posted November 1, 2022 Posted November 1, 2022 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
TEMPEST.114 Posted November 1, 2022 Posted November 1, 2022 Doesn’t this do what you need? https://wiki.hoggitworld.com/view/DCS_func_getGroups
cfrag Posted November 1, 2022 Posted November 1, 2022 (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 November 1, 2022 by cfrag
Dangerzone Posted November 1, 2022 Author Posted November 1, 2022 (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 November 1, 2022 by Dangerzone
Recommended Posts