Page 1 of 1

Lua help

Posted: Sun Jun 09, 2019 10:51 pm
by ddural
I'm trying to learn this code. I am just trying to figure out how to make a radar come on at a certain time. When i try to fill in the blanks, I get a error message that says:

ScenEdit_SetEMCON 0 : ,Unable to identify EMCON subject type! Valid inputs are: Side / Mission /Group / Unit

I am trying to turn on a {name='Radar (Big Bird D [91N6])', guid='683ed749-f8d4-4874-af76-13f9924a186a'}

The side is CHINA

How do I fill in the blanks for below?


ScenEdit_SetEMCON('EMCONSubjectType', 'EMCONSubjectNameOrID', 'EMCONSettings')



RE: Lua help

Posted: Mon Jun 10, 2019 12:14 am
by Whicker
ScenEdit_SetEMCON(['Side' / 'Mission' / 'Group' / 'Unit'], ['Side Name or ID' / 'Mission Name or ID' / 'Group Name or ID' / 'Unit Name or ID'], ['Radar/Sonar/OECM=Active/Passive;' / 'Inherit'])

so I think it would be:

ScenEdit_SetEMCON('unit','Radar (Big Bird D [91N6])','Radar=Active' )

https://commandlua.github.io/index.html ... t_SetEMCON

RE: Lua help

Posted: Mon Jun 10, 2019 10:11 am
by ddural

I typed this: ScenEdit_SetEMCON('unit'radar, '{name='Radar (Big Bird D [91N6])', guid='88e75020-b060-4d21-af5b-2d132a37b125'}', 'Radar=active')

And I got this message: >> ScenEdit_SetEMCON('unit'radar, '{name='Radar (Big Bird D [91N6])', guid='88e75020-b060-4d21-af5b-2d132a37b125'}', 'Radar=active')

ERROR: [string "Console"]:1: ')' expected near 'radar'

RE: Lua help

Posted: Mon Jun 10, 2019 12:39 pm
by Whicker
did you try what I have above?
the name is not a table, just the name in quotes - no guid, no curly brackets.

RE: Lua help

Posted: Mon Jun 10, 2019 1:25 pm
by ddural
Yes I just tried and it worked. Thank you. I will try this for a while, then i will try random on off radars. I just need to fill in the right stuff. Practice, practice.