add_sensor

All discussions & material related to Command's Lua interface

Moderators: RoryAndersonCDT, michaelm75au, angster, MOD_Command

Post Reply
User avatar
wqc12345
Posts: 176
Joined: Mon Dec 07, 2015 2:56 pm
Location: San Francisco, CA

add_sensor

Post by wqc12345 »

Hi All,

I'm getting a lua casting error on an add_sensor parameter? I'm sure I'm not doing this add right, but here is my code:

Code: Select all

local u = ScenEdit_GetUnit({ side = 'RAF' , name = 'Rainbow #1' })
 print(u)
 local a = ScenEdit_GetLoadout({ side = 'RAF' , name = 'Rainbow #1' })
 ScenEdit_UpdateUnit({guid=u.guid,mode='add_sensor',dbid=1815, arc_detect=360})
 ScenEdit_SetEMCON("unit", "Rainbow #1",'Radar=Passive;OECM=Active')

I'm getting the following back:

Code: Select all

 guid = 'BLESCZ-0HM0NI69IEBQJ', 
  class = 'Valiant B.(ECM).1', 
  proficiency = 'Ace', 
  latitude = '-17.923802463545', 
  longitude = '31.0944265038748', 
  altitude = '1873.731', 
  heading = '21.29999', 
  speed = '251.3471', 
  throttle = 'Full', 
  autodetectable = 'False', 
  base = 'Salisbury Air Force Base (RAF)', 
  mission = 'RAF Nairobi Strike Ammo Pads', 
  mounts = '2', 
  magazines = '2', 
  unitstate = 'RTB_MissionOver', 
  fuelstate = 'None', 
  weaponstate = 'None', 
 }
 ERROR: Unable to cast object of type 'System.Int64' to type 'NLua.LuaTable'.

Ultimately, what I'm trying to do is add another OECM Advanced to the available sensors on the Valiant ECM variant. Now, this might not be possible and allowed, but it's what I was trying to do. I also tried adding it as a weapon mount, and I couldn't get that to work either..

Any help here would be appreciated.
KnightHawk75
Posts: 1850
Joined: Thu Nov 15, 2018 7:24 pm

RE: add_sensor

Post by KnightHawk75 »

It's possible and allowed.

Code: Select all

 local arcT={'PB1','PB2','SB1','SB2','SMF1','SMF2','SMA1','SMA2','SS1','SS2','PS1','PS2','PMA1','PMA2','PMF1','PMF2'};
 local arcD={'PB1','PB2','SB1','SB2','SMF1','SMF2','SMA1','SMA2','SS1','SS2','PS1','PS2','PMA1','PMA2','PMF1','PMF2'};
 local arc360 = {'360'}
 ScenEdit_UpdateUnit({guid=u.guid, mode='add_sensor', dbid=2648, arc_detect=arcD, arc_track=arcT}) --specific entries
 ScenEdit_UpdateUnit({guid=u.guid, mode='add_sensor', dbid=2648, arc_detect=arc360, arc_track=arc360}) --360 version

Though the {'360'} should work too, just submit it in table form. may want to include arc_track as well.
A mount is different and will require arc_mount= as well, though like you said it's not what you're trying to do.

Also sensor 1815 is not an OECM Advanced sensor, I think it's a sonar.
cwdb
----
2648 Generic OECM [Advanced] 1980s

db3k
----
1046 Generic OECM [Simple] 1970s, CW Jamming
1048 Generic OECM [Average] 1970s
1050 Generic OECM [Advanced] 1980s
5921 Generic OECM [Advanced] 1990s
5922 Generic OECM [Advanced] 2000s
5923 Generic OECM [Advanced] 2010s
5924 Generic OECM [Advanced] 2020s

Post Reply

Return to “Lua Legion”