Hairdo1-1 Posted May 26, 2022 Posted May 26, 2022 Hi all, I need some assistance, could someone provide me a script to run that would provide me the MGRS of a group (or unit)? I found this but I don't know how get the script to push out the MGRS format ( or LAT/LONG ) would be fine as well I suppose local group = Group.getByName('Group name') local unitPos = nil local units = group:getUnits() if units then unitPos = Unit.getByName(units[1]:getName()):getPosition() end trigger.action.outText("Position X is: "..unitPos.x.z, 5) Thank you in advance!
Kanelbolle Posted May 26, 2022 Posted May 26, 2022 Look here: https://wiki.hoggitworld.com/view/DCS_func_LLtoMGRS WARGAMES Servers: https://forum.dcs.world/topic/301046-wargames-server-pvp-and-pve-campaign-servers/ Scripts: RGC & SPGG https://github.com/AGluttonForPunishment/
Hairdo1-1 Posted May 26, 2022 Author Posted May 26, 2022 @Kanelbollei tried that example script and it gave me an error message unfortunately
cfrag Posted May 26, 2022 Posted May 26, 2022 1 hour ago, Hairdo1-1 said: it gave me an error message unfortunately It would help if you showed us the script that you used and the error that you received. Maybe even posted the .miz so people can take a look at what may be the issue. Since what @Kanelbolle suggests is entirely correct, I'd wager that you are very close at resolving the issue
toutenglisse Posted May 27, 2022 Posted May 27, 2022 On 5/26/2022 at 4:49 AM, Hairdo1-1 said: ...I found this but I don't know how get the script to push out the MGRS format ( or LAT/LONG ) would be fine as well I suppose... If your target group name is : 'Group name' like in your example, and you want MGRS to display in a radio F10 menu (so they display as long as you let the menu open) you can use : Spoiler function EmptyFunction() end if Group.getByName('Group name') and Group.getByName('Group name'):isExist() == true and #Group.getByName('Group name'):getUnits() > 0 then local grid = coord.LLtoMGRS(coord.LOtoLL(Group.getByName('Group name'):getUnit(1):getPoint())) local s = grid.UTMZone .. ' ' .. grid.MGRSDigraph .. ' ' .. grid.Easting .. ' ' .. grid.Northing missionCommands.addCommand('Target group MGRS coordinates : \n'..s, nil, EmptyFunction) trigger.action.outText('Target group coordinates available on radio F10 menu', 10) else trigger.action.outText('Target group does not exist', 10) end
Hairdo1-1 Posted May 29, 2022 Author Posted May 29, 2022 @toutenglisseThis worked! Thank you so much!
Tomcat-Flyer Posted August 25, 2022 Posted August 25, 2022 Hi there, I am new to DCS scripting and would appreciate if someone could take a look at my (non-functioning) script. Somehow I feel stupid th at others have to help me, but it seems to be the only way to run the script. sh-3h.lua
cfrag Posted August 25, 2022 Posted August 25, 2022 Maybe you could start with the essentials: What are you trying to do, how are you dong it (how do you get the script to be executed), what do you expect to see, what are you seeing instead, and why do you think that is wrong. The lua you posted looks like an aircraft definition file to me, which is usually not part of a mission (this is the mission editor part of the forum, and that's how I look at luas posted here), so I'm guessing you are trying to create a mod for an aircraft, not something you'd load into mission editor. In any event, the name "sh-3h" for the table (line 1) is a rather unfortunate choice, as it contains a '-' sign which Lua interprets as a minus operator, so I'm guessing that script won't run at all, no matter how you manage to get it to load. Use an underscore '_' instead. Since I've never created a mod myself, that's as far as I can help you.
Tomcat-Flyer Posted August 26, 2022 Posted August 26, 2022 18 hours ago, cfrag said: this is the mission editor part of the forum [...] you are trying to create a mod for an aircraft Yes, I am trying to create a plane mod and I seem to have landed in the wrong section of the forum.... But thank you anyway for your help! 1
Recommended Posts