Mission Editor GPS List - ED Forums
 


Notices

Reply
 
Thread Tools Display Modes
Old 07-14-2019, 09:11 PM   #1
lazerwolf
Junior Member
 
Join Date: Jul 2017
Posts: 19
Default Mission Editor GPS List

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.
lazerwolf is offline   Reply With Quote
Old 07-15-2019, 09:01 AM   #2
lazerwolf
Junior Member
 
Join Date: Jul 2017
Posts: 19
Default

I've found XY values like these below for each unit but not sure how to convert them to GPS coords.
["y"] = -123573.25864029,
["x"] = -31965.966372327,
lazerwolf is offline   Reply With Quote
Old 07-16-2019, 02:40 AM   #3
Grimes
ED Testers Team
 
Grimes's Avatar
 
Join Date: Jan 2006
Location: Black Mesa
Posts: 7,975
Default

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.
Code:
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"
__________________
You can only tie the world record for lowest flight.
Current Projects: Scripting Wiki, Something...
Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread), SLMOD for DCS 1.5/2.0, IADScript, Mission Editing Wiki!, Mission Building Forum
Grimes is offline   Reply With Quote
Old 07-17-2019, 10:00 PM   #4
lazerwolf
Junior Member
 
Join Date: Jul 2017
Posts: 19
Default

Oh wow, THANK YOU!!!
lazerwolf is offline   Reply With Quote
Old 07-17-2019, 11:54 PM   #5
lazerwolf
Junior Member
 
Join Date: Jul 2017
Posts: 19
Default

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!
lazerwolf is offline   Reply With Quote
Old 07-18-2019, 03:47 AM   #6
Grimes
ED Testers Team
 
Grimes's Avatar
 
Join Date: Jan 2006
Location: Black Mesa
Posts: 7,975
Default

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/Mission...mist.lua#L1576
2. Yes. This assumes you want to get ground groups for the red coalition.

Code:
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
__________________
You can only tie the world record for lowest flight.
Current Projects: Scripting Wiki, Something...
Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread), SLMOD for DCS 1.5/2.0, IADScript, Mission Editing Wiki!, Mission Building Forum

Last edited by Grimes; 07-18-2019 at 07:10 AM.
Grimes is offline   Reply With Quote
Old 07-18-2019, 06:29 AM   #7
lazerwolf
Junior Member
 
Join Date: Jul 2017
Posts: 19
Default

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 '['
lazerwolf is offline   Reply With Quote
Old 07-18-2019, 07:25 AM   #8
Grimes
ED Testers Team
 
Grimes's Avatar
 
Join Date: Jan 2006
Location: Black Mesa
Posts: 7,975
Default

Fixed maybe.
__________________
You can only tie the world record for lowest flight.
Current Projects: Scripting Wiki, Something...
Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread), SLMOD for DCS 1.5/2.0, IADScript, Mission Editing Wiki!, Mission Building Forum
Grimes is offline   Reply With Quote
Old 07-18-2019, 09:24 AM   #9
lazerwolf
Junior Member
 
Join Date: Jul 2017
Posts: 19
Default

No more script errors but it's not reporting the expected information to the log.
lazerwolf is offline   Reply With Quote
Old 07-20-2019, 03:10 AM   #10
lazerwolf
Junior Member
 
Join Date: Jul 2017
Posts: 19
Default

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.
lazerwolf is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 12:03 AM. vBulletin Skin by ForumMonkeys. Powered by vBulletin®.
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.