Jump to content

Recommended Posts

Posted

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

Posted

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 ServerScripting Wiki

Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread)

 SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum

  • Recently Browsing   0 members

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