Jump to content

Mission Editor GPS List


lazerwolf

Recommended Posts

Greetings Pilots!

Is there any way to have the coordinates displayed in the unit list or extract them from a file? Is there a mod that can do this?

I want to put them in the kneeboard for my mission but don't want to manually add 60+ unit coordinates.

 

Thanks and happy hunting.

Link to comment
Share on other sites

Using the scripting engine it is pretty straight forward by using getPoint to find out the x, y, z a unit is at and then converting it via LOtoLL to get those values. So for instance if you knew the name of the groups for objects you want to find:

 

Paste this into a do script call in the triggers for a mission.

local groups = {'gp1', 'gp2', 'gp3'}
for i = 1, #groups do
   if Group.getByName(groups[i]) then 
       local point = Group.getByName(groups[i]):getUnit(1):getPoint()
       local lat, lon = coord.LOtoLL(point)
       env.info(groups[i] .. '  LAT: ' .. lat .. '   LON: ' .. lon)
   end
end

 

That code will iterate through the table named "groups" for groups named "gp1", etc. If it finds the group it will get the location of the first unit in the group. It will then convert that to lat lon coordinates, and finally it will print it to your DCS.log in the format of "groupname LAT: xyz LON: xyz"

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

Link to comment
Share on other sites

A couple more questions please.

1. is there any way to have it report in degrees? My whole purpose here is to use the info to program guided munitions.

2. Instead of have to list every single group eg. gp #001, gp#002, gp#003, etc, is there a way to have it do a partial name search such as "gp" without the rest and report everything with a prefix of "gp"?

Thanks!

Link to comment
Share on other sites

1. It is degrees, its just not formatted the same way as you would expect. You use the digits behind the decimal point to convert to minutes and again to seconds. For converting it some of this code might give you an idea: https://github.com/mrSkortch/MissionScriptingTools/blob/master/mist.lua#L1576

2. Yes. This assumes you want to get ground groups for the red coalition.

 

local groups = coalition.getGroups(coalition.side.RED, Group.Category.Ground) 
for i = 1, #groups do
   if string.find(Group.getName(groups[i]), 'gp') == 1 and Group.getSize(groups[i]) > 0 then 
       local point = Group.getByName(groups[i]):getUnit(1):getPoint()
       local lat, lon = coord.LOtoLL(point)
       env.info(groups[i] .. '  LAT: ' .. lat .. '   LON: ' .. lon)
   end
end


Edited by Grimes

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

Link to comment
Share on other sites

Got an error. Spent and hour trying to figure it out but wasn't obvious to me. I tried! :)

 

ERROR DCS: Mission script error: : [string "local groups = coalition.getGroups(coalition.side.RED, Group.Ca..."]:3: unexpected symbol near '['

Link to comment
Share on other sites

Man, after spending almost 2 days trying my hand at coding this to no avail, I'm just going to put every single unit in that top script then cut and past each returned decimal to a website that will convert it to degrees. Thanks for getting me that far with the first script, it gives me something to work with. I wish I was decent enough at coding to get exactly what I need to save me tons of time and cutting and pasting. I need to learn 2LUA lol.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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