EMCOM Issue

All discussions & material related to Command's Lua interface

Moderators: angster, RoryAndersonCDT, michaelm75au, MOD_Command

Post Reply
User avatar
vettim89
Posts: 3668
Joined: Fri Jul 13, 2007 11:38 pm
Location: Toledo, Ohio

EMCOM Issue

Post 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
"We have met the enemy and they are ours" - Commodore O.H. Perry
BDukes
Posts: 2694
Joined: Wed Dec 27, 2017 12:59 pm

RE: EMCOM Issue

Post 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.
Don't call it a comeback...
User avatar
vettim89
Posts: 3668
Joined: Fri Jul 13, 2007 11:38 pm
Location: Toledo, Ohio

RE: EMCOM Issue

Post 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
"We have met the enemy and they are ours" - Commodore O.H. Perry
KnightHawk75
Posts: 1850
Joined: Thu Nov 15, 2018 7:24 pm

RE: EMCOM Issue

Post 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.

Post Reply

Return to “Lua Legion”