LUA Script to automate EMCON when ELINT satellites are near

All discussions & material related to Command's Lua interface

Moderators: angster, RoryAndersonCDT, michaelm75au, MOD_Command

Post Reply
LettuceTurnipTheBeet
Posts: 10
Joined: Sat Dec 18, 2021 12:09 pm

LUA Script to automate EMCON when ELINT satellites are near

Post by LettuceTurnipTheBeet »

I wrote a script to automate EMCON control when an ELINT sat approaches. Found it useful in scenarios with a lot of satellites, like "A Helping Hand 1979". Turns off radar if a satellite is within a specified range and turns it back on if it leaves said range. Had to loop through units and filter out satellites because UnitEntersArea does not appear to work for sats.

Just extract the script and load it from the LUA console window, adjust a few variables according to your needs and run.

Let me know if any problems arise.
Attachments
emcon_control.zip
(1.15 KiB) Downloaded 45 times
Parel803
Posts: 972
Joined: Thu Oct 10, 2019 3:39 pm

RE: LUA Script to automate EMCON when ELINT satellites are near

Post by Parel803 »

Lettuce,
This is nice, going to try it out.
Not fully undertand the lua but understand the feature
regards GJ

Works great. A question if I may. I tried to put in a table with the name/guids of my TG but cannot get that to work. Not sure how to make the correct loop so they all swith rdr on/off.

KnightHawk75
Posts: 1850
Joined: Thu Nov 15, 2018 7:24 pm

RE: LUA Script to automate EMCON when ELINT satellites are near

Post by KnightHawk75 »

ORIGINAL: Parel803

Lettuce,
This is nice, going to try it out.
Not fully undertand the lua but understand the feature
regards GJ

Works great. A question if I may. I tried to put in a table with the name/guids of my TG but cannot get that to work. Not sure how to make the correct loop so they all swith rdr on/off.

It's really good for one unit, one side.

But if you need something that supports:
+ multiple units via table entries
+ multiple sides included in what sats to scan
+ per-unit-entry control of min_range, flipping radar and|or also flipping oecm, temporary disabling entries.
+ overcome some issues with 'groups' due to the group objects location often being the 'lead' or cases where it can be invalid (0,0) on hidden groups as demonstrated in the sample.


Then you could try the attached. I took the basic concept and reworked and extended it to support the above for myself. Built and tested with build 1147.41.
att: SatRangeMonitor.zip

zip contents:
TestRig_SatRangeMonitor.scen -- A sample scene with everything already applied to it.
TestRig_SatRangeMonitor-noEventsYet.scen -- Same sample scene without the events installed yet.
Lua\SatRangeMonitorSetup.lua -- Setup Script, change and then copy & paste and run in Lua Console to install events into a scene. Scroll down about ~70 or so lines for where you change the unit table,sides, and other defaults.
Lua\SatRangeMonitor_nosetup.lua -- This 99% of the code (ie all the global functions) in a file with formatting for easier editing.
Lua\SatRangeMonitor_changelog.txt -- simple change log.

Hope it helps.
Attachments
SatRangeMonitor.zip
(76.66 KiB) Downloaded 31 times
Parel803
Posts: 972
Joined: Thu Oct 10, 2019 3:39 pm

RE: LUA Script to automate EMCON when ELINT satellites are near

Post by Parel803 »

thank you for your time and help,
Going to look tomorrow
regards GJ

Works nice, played it. not tried to make for own scen.
Thanks both
regards GJ
Post Reply

Return to “Lua Legion”