Page 1 of 1

EMCOM Issue

Posted: Mon Sep 06, 2021 3:40 pm
by vettim89
I have what I thought was a simple event that does not seem to be working

The Trigger is 'unit is detected with the specification of platform being an aircraft'

The event action is supposed to have the select SAM site activate its radars with the following code

ScenEdit_SetUnit({side='Cuba', guid='fed83872-a7b5-41ed-ace0-1e91eb1cb722', obeyEMCOM=false})
ScenEdit_SetEMCON('unit', 'fed83872-a7b5-41ed-ace0-1e91eb1cb722', 'Radar=Active')

When I run the above code the "unit obeys EMCOM" button remains checked and the radars remain off. I feel like I am missing something really simple here

RE: EMCOM Issue

Posted: Mon Sep 06, 2021 8:07 pm
by BDukes
Mine was like this

ScenEdit_SetUnit({side='Cuba', guid='1T8G9D-0HMBHGG8ARV1L', obeyEMCOM=false})
ScenEdit_SetEMCON('Unit','SiteX','Radar=Active')

Started the game clock and the radar went active. It doesn't happen when the game isn't running.

I'd start by starting the game to see if your code works.

RE: EMCOM Issue

Posted: Mon Sep 06, 2021 8:19 pm
by vettim89
ORIGINAL: BDukes

Mine was like this

ScenEdit_SetUnit({side='Cuba', guid='1T8G9D-0HMBHGG8ARV1L', obeyEMCOM=false})
ScenEdit_SetEMCON('Unit','SiteX','Radar=Active')

Started the game clock and the radar went active. It doesn't happen when the game isn't running.

I'd start by starting the game to see if your code works.

thank you - you are correct I did not run the game

RE: EMCOM Issue

Posted: Mon Sep 06, 2021 8:34 pm
by KnightHawk75
If I follow correctly you want all the radars on right? So really you don't need the unit obey's EMCON.

Code: Select all

   ScenEdit_SetEMCON('Unit','fed83872-a7b5-41ed-ace0-1e91eb1cb722', 'Radar=Active'); 
 
Now if you wanted only a specific radar sensor on the unit then you would need to turn off unit obeys emcon.

Code: Select all

   local u = ScenEdit_GetUnit({guid='fed83872-a7b5-41ed-ace0-1e91eb1cb722'});
   u.obeyEMCON=false <-- spelling (I make the con\com mistake all the time too.
   --(now feed a singular table of what you want changed to the setter for each item you want changed.)
   u.sensors = {sensor_guid="TheguidOfTheSensorEntryToChangehere",sensor_isactive=true}; 
   u.sensors = {sensor_guid="TheguidOfTheSensorEntry#2ToChangehere",sensor_isactive=true}; --'sensor_status' is also available if needed to change.
 

And yes, click off the unit and back onto it in the editor to see the change if not advancing time.