Page 1 of 1

Query Unit OutofComms

Posted: Sat Sep 22, 2018 2:49 pm
by TitaniumTrout
I can set a unit out of comms using :

Code: Select all

ScenEdit_SetUnit({unitname="USS Barry", OutOfComms="True"})

This works and the unit is out of comms.

Is there a way to use Lua to query if a unit is outofcomms?

I've tried

Code: Select all

 local unit = ScenEdit_GetUnit({side="OPFOR", unitname="USS Barry"})
 print(unit.outofcomms)
 

This returns a bunch of errors including "unable to load one or more of the requested types.".


RE: Query Unit OutofComms

Posted: Sun Sep 23, 2018 4:42 pm
by Whicker
hmmm. I figured it would be in the unit wrapper some where but I don't see it.

local a = ScenEdit_GetUnit({side="OPFOR", unitname="USS Barry"})
for k,v in pairs(a.fields) do
if string.find(k,'property_') ~= nil then
local t = string.find(v," , ") -- location of first ,
print("\r\n[object] = " .. string.sub(v,2,t-1) ) -- property name
print( a[string.sub(v,2,t-1)] ) -- value of property
end
end

that will return all kinds of stuff, but I don't see anything about comms. Sometimes things are in a table and not directly accessible like you tried to do, but in this case it just looks like it doesn't exist.

RE: Query Unit OutofComms

Posted: Mon Sep 24, 2018 5:47 am
by michaelm75au
Looks like I never added anything to show the state of Comms Network

RE: Query Unit OutofComms

Posted: Mon Sep 24, 2018 8:23 am
by TitaniumTrout
Cool, thanks for the info guys. I'll bust my through an alternate method.