gromit190 Posted September 21, 2016 Posted September 21, 2016 Hi all, What's the best way to get units in a zone? I'm using MIST, btw local zone = trigger.misc.getZone("Some zone") -- Now how to get the units in this zone Can I use the MIST tables for this? I see other people have gound units like this local redVehicles = mist.makeUnitTable({'[red][vehicle]'}) So I could do the same, then iterate through the units and check if they are close enough (i.e. insize the zone). But surely there should be a better way for this basic feature? Cheers Autonomous ground AI project
gromit190 Posted September 21, 2016 Author Posted September 21, 2016 local redVehicles = mist.makeUnitTable({'[blue][vehicle]'}) local redVehiclesInZone = mist.getUnitsInZones(redVehicles, {"Some zone"}) Autonomous ground AI project
Grimes Posted September 22, 2016 Posted September 22, 2016 And just keep in mind that the value returned is a table of unit objects. So if you wan't to know a units name you'd need to iterate the table... for i = 1, #redVehiclesInZone do local uName = Unit.getName(redVehiclesInZone[i]) 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
gromit190 Posted September 22, 2016 Author Posted September 22, 2016 Thank you Autonomous ground AI project
Recommended Posts