Jump to content

Recommended Posts

Posted

No direct function but anything in the mission file is accessible to the scripting engine as a table env.mission. They are indexed numerically. So you can open a .miz file and then open the mission file in notepad++ to note the formatting. In this case it is:

 

env.mission.triggers.zones = {listOfZones}

 

They are in this format.

           [2] = 
           {
               ["y"] = -1606.310285714,
               ["radius"] = 22.86,
               ["zoneId"] = 58,
               ["x"] = 107906.32142857,
               ["color"] = 
               {
                   [1] = 1,
                   [2] = 1,
                   [3] = 1,
                   [4] = 0.15,
               }, -- end of ["color"]
               ["hidden"] = false,
               ["name"] = "Naval Staff",
           }, -- end of [2]

 

For instance this his how mist creates a DB of the zones

	if env.mission.triggers and env.mission.triggers.zones then
		for zone_ind, zone_data in pairs(env.mission.triggers.zones) do
			if type(zone_data) == 'table' then
				local zone = mist.utils.deepCopy(zone_data)
				zone.point = {}	-- point is used by SSE
				zone.point.x = zone_data.x
				zone.point.y = 0
				zone.point.z = zone_data.y

				mist.DBs.zonesByName[zone_data.name] = zone
				mist.DBs.zonesByNum[#mist.DBs.zonesByNum + 1] = mist.utils.deepCopy(zone)	--[[deepcopy so that the zone in zones_by_name and the zone in
																							zones_by_num se are different objects.. don't want them linked.]]
			end
		end
	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

Posted (edited)

Hi

 

Hey all, is there a way to get get all the zones defined in the ME?

something like getZones()?

 

Thanks for asking.

 

I was about to ask it :smilewink:

 

And thanks Grimes for the answer.

Always there and helpfull :thumbup:

 

 

 

Thans so much

Edited by CougarFFW04
Posted

Hi Grimes,

 

I had sometime to look at this and I was looking for a mist function that would return all DCS zones in a mission. But I didn't find it...

 

Did I miss something or should I code this myself ?

 

Thanks

Posted

https://github.com/mrSkortch/MissionScriptingTools/blob/master/Example%20DBs/mist_DBs_zonesByName.lua

 

Mist saves a table of all of the zones in the mission. It is basically what would be returned via getAllZones() type of function. The following would create red smoke at 0 ASL at the center of each zone.

 

 

for tName, tData in pairs(mist.DBs.zonesByName) do
trigger.action.smoke(tData.point, 1) 
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...