Edded Posted November 24, 2021 Posted November 24, 2021 Hello, I'm looking for a way to apply a specific option (Altitude restriction max for AAA) to all AAA units on a map. There is around 100 / 120 AAA groups without this option, and i'd like to apply a script/trigger that set this option with a specific altitude at mission start, without editing each group individualy. I've used the same name prefix in group name for all the groups if that is of any use (REDAAA for red and BLUEAAA for blue).
Grimes Posted November 24, 2021 Posted November 24, 2021 Should work with: https://wiki.hoggitworld.com/view/DCS_option_altitudeRestrictionMax I haven't actually tested those settings yet and it is missing from the main AI enumerator table, which may or may not matter. Assuming it does work then something like this would set the max engage altitude to 4000 meters. for i = 1, 2 do local allGroups = coalition.getGroups(i, 2) for j = 1, #allGroups do if string.find(allGroups[j]:getName(), 'AAA') then allGroups[j]:getController:setOption(29, 4000) end end end The right man in the wrong place makes all the difference in the world. Current Projects: Grayflag Server, Scripting Wiki Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread) SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum
Edded Posted November 27, 2021 Author Posted November 27, 2021 Thanks for the help. I couldn't get this to work. But I did not check to see why already. I've also figured that there are units like SA8 or SA9 with 'AAA' in the group name. Couldn't figure if it matter or not tho...
toutenglisse Posted November 27, 2021 Posted November 27, 2021 On 11/25/2021 at 12:04 AM, Grimes said: Should work with: https://wiki.hoggitworld.com/view/DCS_option_altitudeRestrictionMax I haven't actually tested those settings yet and it is missing from the main AI enumerator table, which may or may not matter. Assuming it does work then something like this would set the max engage altitude to 4000 meters. for i = 1, 2 do local allGroups = coalition.getGroups(i, 2) for j = 1, #allGroups do if string.find(allGroups[j]:getName(), 'AAA') then allGroups[j]:getController:setOption(29, 4000) end end end The only issue is lacking parenthesis line 5 : allGroups[j]:getController():setOption(29, 4000) Then it works normally (no matters if in a AAA group there is SAM only air def). 54 minutes ago, Edded said: Thanks for the help. I couldn't get this to work. But I did not check to see why already. I've also figured that there are units like SA8 or SA9 with 'AAA' in the group name. Couldn't figure if it matter or not tho...
Recommended Posts