exil Posted February 8, 2021 Posted February 8, 2021 Hey guys, i'm trying to find a way to deactivate all my current red air units with one trigger. I stumbled accros the following function from MIST: mist.makeUnitTable so i thought about something like: redair = mist.makeUnitTable({"[red][plane]"}) But now i don't know how to use the table that i just generated and deactivate the units from this table. I'm really sorry, if there is maybe a lot of stupidity in what i'm writing. I'm really not good with lua and till now basically just copy and paste codes and do trail and error. I would appriciate it if someone could help me out here. GeForce RTX 4090 Founders Edition - AMD Ryzen 7 5800X3D - 64Gb RAM - Win11 - HP Reverb G1 - Thrustmaster Warthog HOTAS (40cm extension) - VKB Sim T-Rudder MKIV Pedals
toutenglisse Posted February 8, 2021 Posted February 8, 2021 The "deactivateGroup" function only works with groups, and your table is a unit table. You should use this (for all red airplanes to deactivate, 1 is red coalition and 0 is airplanes) : for i, gp in pairs(coalition.getGroups(1, 0)) do targetGroup = Group.getByName(Group.getName(gp)) trigger.action.deactivateGroup(targetGroup) end
exil Posted February 8, 2021 Author Posted February 8, 2021 Excellent! I'll test this tomorrow as soon as I get back from work. I knew that I was basically working with a unit function but didn't find a way to deactivate them (since there is none). Thanks a lot! GeForce RTX 4090 Founders Edition - AMD Ryzen 7 5800X3D - 64Gb RAM - Win11 - HP Reverb G1 - Thrustmaster Warthog HOTAS (40cm extension) - VKB Sim T-Rudder MKIV Pedals
exil Posted February 9, 2021 Author Posted February 9, 2021 Works like a charm! Thank you very much again! 1 GeForce RTX 4090 Founders Edition - AMD Ryzen 7 5800X3D - 64Gb RAM - Win11 - HP Reverb G1 - Thrustmaster Warthog HOTAS (40cm extension) - VKB Sim T-Rudder MKIV Pedals
Recommended Posts