Jump to content

How to find which map is being used for the mission?


Recommended Posts

Posted

Is there a lua scripting function that will return which map is being used for the mission (Caucasus, Nevada, Normandy)?

 

About the only I can see to do it so far is maybe use the getAirbases function and search through the table it returns for particular airbases, one from each of the three maps. I was hoping there might be a more elegant (easy) solution.

Posted (edited)

Hi,

 

You can open the MIZ (= zip) with e.g. 7-Zip

Open mission with Notepad++ or ìn this case with the Editor (search only !!!)

Find theatre

 

Theatre : Caucasus, Nevada, Normandy

Edited by Blech
Posted

Thanks! I was actually looking for something I could use in a lua script while the mission was running. But what you showed started me looking at some things, and ended up writing this little getTheatre() function that seems to work. It wasn't nearly as hard as I originally thought it was going to be.

 

I even spelled theater "wrong", since that's the way it is in the game. :D

 

function getTheatre()

local theatre = ""

if Airbase.getByName("Batumi") ~= nil then
	theatre = "Caucasus"
elseif Airbase.getByName("Nellis AFB") ~= nil then
	theatre = "Nevada"
elseif Airbase.getByName("Evreux") ~= nil then
	theatre = "Normandy"
end

return theatre
end

Posted (edited)
...

I even spelled theater "wrong", since that's the way it is in the game...

:) FWIW, both spellings are correct. The US tends to use "theater", while the rest of the English-speaking world uses "theatre".

Edited by Ironhand

YouTube Channel: https://www.youtube.com/channel/UCU1...CR6IZ7crfdZxDg

 

_____

Win 11 Pro x64, Asrock Z790 Steel Legend MoBo, Intel i7-13700K, MSI RKT 4070 Super 12GB, Corsair Dominator DDR5 RAM 32GB.

Posted
:) FWIW, both spellings are correct. The US tends to use "theater", while the rest of the English-speaking world uses "theatre".

 

I know that. I was just being silly. :)

 

I guess it didn't come across well. Sorry about that.

Posted
Thanks! I was actually looking for something I could use in a lua script while the mission was running. But what you showed started me looking at some things, and ended up writing this little getTheatre() function that seems to work. It wasn't nearly as hard as I originally thought it was going to be.

 

I even spelled theater "wrong", since that's the way it is in the game. :D

 

Anything stored in the mission file is accessible by the scripting engine via the "env.mission" table.

 

Thus:

local theatre = env.mission.theatre

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
Anything stored in the mission file is accessible by the scripting engine via the "env.mission" table.

 

Thus:

local theatre = env.mission.theatre

 

 

Well...it doesn't get much easier than that! Thanks!

  • 4 years later...
Posted

I would like to point out that env.mission.theatre is only available in the Mission editor environment.

If you need that in a hook, you have to get the mission table with DCS.getCurrentMission() at first.

That brings up the mission file as a table.

If you need the map, you may do

map = (DCS.getCurrentMission().mission.theatre)

Took me a while to realize that the first level of the table is mission. 

  • Thanks 1
  • Recently Browsing   0 members

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