Page 1 of 1

LUA to change submarine depth

Posted: Sun Jun 09, 2019 12:03 pm
by AdmiralSteve
I have this small script that changes the depth of a submarine as it changes missions from patrol to land attack;

ScenEdit_SetSidePosture('USN Submarine', 'PLAN PLAAF', 'H')
ScenEdit_SetMission('USN Submarine','USS John Warner SSN785 Patrol',{stationDepthSubmarine=-30})
ScenEdit_AssignUnitToMission('USS John Warner SSN785', 'Palawan Strike')

What I can't figure out is after the submarine is assigned to 'Palawan Strike', it settles back down below launch depth and the TLAM's cannot launch. Any suggestions? Scenario is attached.

Thank you,

Steve



RE: LUA to change submarine depth

Posted: Sun Jun 09, 2019 3:18 pm
by Whicker
in your line 2 you are setting station depth but on a strike mission there is no station depth. It is just inheriting the depth from the patrol missions station depth so you need to change it.

I did:

ScenEdit_SetSidePosture('USN Submarine', 'PLAN PLAAF', 'H')

ScenEdit_AssignUnitToMission('USS John Warner SSN785', 'Palawan Strike')

ScenEdit_SetUnit({name='USS John Warner SSN785', guid='924f266e-24e2-436c-b473-5d504ea796c2', depth= '130 FT', moveto=true})

moveto means that the altitude change doesn't happen instantly - it moves to it as it should. First time I have seen that. Once the mission is over you probably need to do something to put it back on the patrol mission? just thinking it will stay at shallow depth and maybe that will be bad for it.

RE: LUA to change submarine depth

Posted: Sun Jun 09, 2019 5:17 pm
by AdmiralSteve
ORIGINAL: Whicker



moveto means that the altitude change doesn't happen instantly - it moves to it as it should. First time I have seen that. Once the mission is over you probably need to do something to put it back on the patrol mission? just thinking it will stay at shallow depth and maybe that will be bad for it.

Thank you very much. I will put this in. And yes, the sub will go back to a patrol mission but I had to get past this step.

Steve