This is the code:
Code: Select all
local unit = ScenEdit_AddUnit({type='Facility',guid='EXAMPLE-GUID', name='Radar',dbid=1006, side='RED',latitude=10,longitude=0})
ScenEdit_SetUnitIntermittentEmissionConfig( unit.guid, 'CUSTOM', { UseEmissionInterval=1, EmissionDuration=math.random(2,4)*60, EmissionInterval=math.random(5,10)*60, EmissionIntervalVariation=math.random(5,10)*60, WakeStance_UNFRIENDLY=1 } )
ScenEdit_SwitchUnitIntermittentEmission ( unit.guid, 'CUSTOM', 1 )
Code: Select all
ScenEdit_SwitchUnitIntermittentEmission ( 'EXAMPLE-GUID', 'CUSTOM', 0 ) --to deactivate
ScenEdit_SwitchUnitIntermittentEmission ( 'EXAMPLE-GUID', 'CUSTOM', 1 ) --to activate
Here you have a scen with the red side added,
First you run the first code, the unit is added but no intermittent emissions occur.
Second, you open the EMCON window of the unit and click on the 'Use custom preset only' checkbox and then in continuous mode, the radar starts to emit with the parameters set. If you then go to lua console and run the disable/enable code, it works fine.
Thank you
