Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

Adding Satellites via Lua

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua Legion >> Adding Satellites via Lua Page: [1]
Login
Message << Older Topic   Newer Topic >>
Adding Satellites via Lua - 12/2/2019 3:28:06 AM   
TheKracken

 

Posts: 2
Joined: 11/17/2019
Status: offline

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)

Post #: 1
RE: Adding Satellites via Lua - 12/2/2019 2:16:14 PM   
KnightHawk75

 

Posts: 592
Joined: 11/15/2018
Status: offline
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�

Attachment (1)

< Message edited by KnightHawk75 -- 4/17/2020 8:12:24 PM >

(in reply to TheKracken)
Post #: 2
RE: Adding Satellites via Lua - 12/11/2019 2:31:14 AM   
TheKracken

 

Posts: 2
Joined: 11/17/2019
Status: offline
Fantastic info !

Will give it a try. Much thanks.

(in reply to KnightHawk75)
Post #: 3
Page:   [1]
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua Legion >> Adding Satellites via Lua Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

0.109