Adding Satellites via Lua (Full Version)

All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua Legion



Message


TheKracken -> Adding Satellites via Lua (12/2/2019 3:28:06 AM)


Anyone know a source or explanation for this parameter:

NewUnit
New unit selector.
... lists minimum fields required. Other fields from Unit may be included.
orbit number Orbit index (applicable to SATELLITE)





KnightHawk75 -> RE: Adding Satellites via Lua (12/2/2019 2:16:14 PM)

I believe the orbit index relates to the ComponentNum field in the DataSatelliteOrbit table in the database for a given base Sat dbid. They appear to be the different orbits available per baseline Satellite unit, so like say you have gps sat, its for selecting which of say the 24 or however many orbits you want the one you're spawning to use.

Also and I don't know if this was ever fixed but when it says add orbit='x' in the doc, you also had to duplicate it again by sending the GUID= parameter where guid=orbitindex matched or you'd get an error, conversely if you left both out it would sit stationary at the log\lat where it was spawned.

ScenEdit_AddUnit({side='a',name='mysat',type='Satellite',dbid=81,orbit='15',guid='15',Latitude='23',Longitude='112'})
or
ScenEdit_AddUnit({side='a',name='mysat2',type='Satellite',dbid=81,orbit='16',guid='16',Latitude='23',Longitude='112'})

^ ok acts normal

ScenEdit_AddUnit({side='a',name='mysat2',type='Satellite',dbid=81,Latitude='23',Longitude='112'})
^ stationary - and if I recall gets an altitude of 0?


Also if you want to change an orbit after adding one to your own custom one you'll need to do the following snipped from 1.15.2 release notes:
quote:


* Lua: Added method "updateorbit" to ActiveUnit_SE wrapper object. This allows updating a satellite's orbit (by feeding fresh TLE data) without having to go through the database. Usage example:

theSat = ScenEdit_GetUnit({guid='56f830c1-d0e2-430a-985e-0e301cc01eff'})
theTLE = 'Resurs P1\n1 39186U 13030A 17013.12537468 .00000446 00000-0 16942-4 0 9992\n2 39186 97.3847 79.3911 0015157 247.7411 195.8488 15.31966970198820'
theSat:updateorbit({TLE=theTLE})

^ Important gotcha: line breaks on the TLE text are performed using '\n', Lua's standard for line breaks. Also no extra spaces! The TLE format (and its parsers) is very specific on spaces between characters.


IDK if it's useful to you but attached is the lastest basic dump from that table if you want to easily lookup what indexes are available for given Sat dbid. (second field (ComponentNumberOrbitIndex) in the dump, first is baseline Sat's matching dbid)

older related thread
https://www.matrixgames.com/forums/tm.asp?m=4634407&mpage=1&key=satellite�




TheKracken -> RE: Adding Satellites via Lua (12/11/2019 2:31:14 AM)

Fantastic info !

Will give it a try. Much thanks.




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.0234375