Not saving SAR Enabled true value?
Posted: Fri Nov 25, 2022 12:45 pm
Help appreciated as I suspect this is a key store value issue which I have never got my head round:
So the SAR Script I have cobbled together using other people's script is triggered when an aircraft is shot down as follows:
local Mu=ScenEdit_UnitX()
local MuC= Mu.crew
print (MuC)
local elevation = World_GetElevation({latitude=Mu.latitude, longitude=Mu.longitude})
print (elevation)
if elevation < 0 then do
local i= 1, Mu.crew
for planes = 1, Mu.crew, 1 do
local SurvivorsS =
ScenEdit_AddUnit({
type='ship',
dbid=3725,
side='Aircrew',
name=Mu.name .. " " .. "Aircrew".." "..planes,
guid=Mu.guid .." ".."Aircrew".." "..planes,
latitude=Mu.latitude,
longitude=Mu.longitude})
SurvivorsS.SAR_enabled=true
end
end
elseif elevation > 0 then do
local i= 1, Mu.crew
for planes = 1, Mu.crew, 1 do
local SurvivorsL =
ScenEdit_AddUnit({
type='facility',
dbid=2046,
side='Aircrew',
name=Mu.name .. " " .. "Aircrew".." "..planes,
guid=Mu.guid .." ".."Aircrew".." "..planes,
latitude=Mu.latitude,
longitude=Mu.longitude})
SurvivorsL.SAR_enabled=true
end
end
end
It produces a downed aircrew on sea or land etc with one survivor for each crew member which when you check the wrapper is as follows the created unit is:
[object] = SAR_enabled
'Yes'
BUT....
When I save the game in the editor and reload in edit mode it the same downed aircrew(s) is/are then SAR_enabled = 'No'
Any help in what I am missing on how to preserve the values would be much appreciated. I am using this to self teach as I appreciate there are many better scripts than mine for SAR in circulation.
Regards
K
So the SAR Script I have cobbled together using other people's script is triggered when an aircraft is shot down as follows:
local Mu=ScenEdit_UnitX()
local MuC= Mu.crew
print (MuC)
local elevation = World_GetElevation({latitude=Mu.latitude, longitude=Mu.longitude})
print (elevation)
if elevation < 0 then do
local i= 1, Mu.crew
for planes = 1, Mu.crew, 1 do
local SurvivorsS =
ScenEdit_AddUnit({
type='ship',
dbid=3725,
side='Aircrew',
name=Mu.name .. " " .. "Aircrew".." "..planes,
guid=Mu.guid .." ".."Aircrew".." "..planes,
latitude=Mu.latitude,
longitude=Mu.longitude})
SurvivorsS.SAR_enabled=true
end
end
elseif elevation > 0 then do
local i= 1, Mu.crew
for planes = 1, Mu.crew, 1 do
local SurvivorsL =
ScenEdit_AddUnit({
type='facility',
dbid=2046,
side='Aircrew',
name=Mu.name .. " " .. "Aircrew".." "..planes,
guid=Mu.guid .." ".."Aircrew".." "..planes,
latitude=Mu.latitude,
longitude=Mu.longitude})
SurvivorsL.SAR_enabled=true
end
end
end
It produces a downed aircrew on sea or land etc with one survivor for each crew member which when you check the wrapper is as follows the created unit is:
[object] = SAR_enabled
'Yes'
BUT....
When I save the game in the editor and reload in edit mode it the same downed aircrew(s) is/are then SAR_enabled = 'No'
Any help in what I am missing on how to preserve the values would be much appreciated. I am using this to self teach as I appreciate there are many better scripts than mine for SAR in circulation.
Regards
K