Jump to content

Recommended Posts

Posted

I could have sworn that I saw a method for this in some documentation, but try as I might, silly me can't find it any more. 

In any event, I'm looking for a method that returns the magnetic declination for any point on the map, similar to land.getHeight(vec). Is there such a thing, or should I simply use a constant per map (which can be quite awkward for maps like SA). 

Thank you so much,

-ch

 

Posted

I've looked at this myself before (probably a few years ago) and didn't find any way of getting the info through the standard lua script API functions.

The data needed is stored in the files in Data\MagVar\TabularData under the Saved Games DCS folder - the data in each of these files covers the whole globe for a given year/month, and the files are created during mission load if there is not already a file for the relevant month.

They are binary files though, so not too easy to read in lua scripts.  I wrote a lua dll file to read them, which works well for my purposes (mostly used via hook scripts).  I could upload it to the user files if you want to give it a try and see whether it does what you want.  I've not done much with mission scripting at all, so don't know how easy it is to include functions from a lua dll in them.

  • Like 1
Posted
13 hours ago, JBDCS said:

I've looked at this myself before (probably a few years ago) and didn't find any way of getting the info

Thank you so much - I'll post a wish, in the hopes that ED notice and make it an item in their backlog. For big dynamic missions in other maps than Caucasus this would be a great help.

Posted

Thanks funkyfranky and Chump - the magvar library described in the thread linked to by funkyfranky does exactly the same as my own dll, so there's no need for mine any more.

If there's a problem using require to include it in mission scripts, I think the same problem would be there with my own dll, since you'd need to use require to include that too.  So hopefully there's a way round that.

I've just tested the magvar library out from a hook script, and it works fine that way (and, I'm glad to say, gives the same results as my own dll does).

Note: as well as the get_mag_decl (lat, long) function in the magvar library, there's also get_mag_incl (lat, long) to get the magnetic inclination if that is needed for anything (probably not).

  • Recently Browsing   0 members

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