Diver from Submarine

All discussions & material related to Command's Lua interface

Moderators: RoryAndersonCDT, michaelm75au, angster, MOD_Command

Post Reply
Parel803
Posts: 962
Joined: Thu Oct 10, 2019 3:39 pm
Location: Netherlands

Diver from Submarine

Post by Parel803 »

Good afternoon,
I got this from the Scenario: SakuraBlue by Rory N, very neat. I plucked this from the lua docs made by Rory (thx). A question that came up was how to get two instead of one option to drop forces ashore. I guess it is in the Key for deployed but don't know how to change that. All credits tot RN. If I should tweak it somewere, happy to here. The original docs contains much more.
regards GJ
Attachments
SelectMsg..pSpecops.zip
(1.76 KiB) Downloaded 14 times
KnightHawk75
Posts: 1850
Joined: Thu Nov 15, 2018 7:24 pm

RE: Diver from Submarine

Post by KnightHawk75 »

Attached in version where you are asked how many divers you want from the selected sub (1-10, change as you desire).
It also corrects areas where the original fell short (detects > 1 unit selected,etc now), adds a function you can use to easily clear the storage keys during development, and adjusts things such that GetUnit isn't called multiple times, but instead is obtained once and passed onto funcs that need it, added params to the 'diver' generation, along with defaults that match the original.

att: SelectedSubDropsDiversOffOnLand_514009.zip
Attachments
SelectedSu..d_514009.zip
(2.4 KiB) Downloaded 18 times
Parel803
Posts: 962
Joined: Thu Oct 10, 2019 3:39 pm
Location: Netherlands

RE: Diver from Submarine

Post by Parel803 »

KH,
I realize I ask a lot of Q's. Thanks again for the answer.
regards GJ
KnightHawk75
Posts: 1850
Joined: Thu Nov 15, 2018 7:24 pm

RE: Diver from Submarine

Post by KnightHawk75 »

ORIGINAL: Parel803

KH,
I realize I ask a lot of Q's. Thanks again for the answer.
regards GJ
No worries, you're welcome.
Parel803
Posts: 962
Joined: Thu Oct 10, 2019 3:39 pm
Location: Netherlands

RE: Diver from Submarine

Post by Parel803 »

Thank you, much appriciated.
Follow up from first one. If want to put two recons ashore but not at the same time?
When I try that I get: There was aproblem with your selection. Ensure that you have selected a single submarine which has not yet deployed a dive team.

I found that mesage line but was wondering were to find the fact that it can only happen once? And if that can be set to e.g. two teams, so twice a drop?

regards GJ
KnightHawk75
Posts: 1850
Joined: Thu Nov 15, 2018 7:24 pm

RE: Diver from Submarine

Post by KnightHawk75 »

ORIGINAL: Parel803

Thank you, much appriciated.
Follow up from first one. If want to put two recons ashore but not at the same time?
When I try that I get: There was aproblem with your selection. Ensure that you have selected a single submarine which has not yet deployed a dive team.

I found that mesage line but was wondering were to find the fact that it can only happen once? And if that can be set to e.g. two teams, so twice a drop?

regards GJ
Follow up from first one. If want to put two recons ashore but not at the same time?

Areas that validate and check against the storage keys is where you want to look.
Probably minimal amount of work if you just want to disable that is just to remove the calls to SubmarineSelectionIsValidForDivers();
so change

Code: Select all

 	  if (SubmarineSelectionIsValidForDivers(selectedSubmarine)) and ConfirmSpecialAction('Deploy dive team from '..selectedSubmarine.name) then
 	    if DeployDiversFromSubmarine(selectedSubmarine) then
                 ScenEdit_SetKeyValue('Swimmers_'..selectedSubmarine.guid,'deployed')  -- delete this line for >1 SpecOps team
                   return true;
               end
 	  else -- failed validation.
 
to

Code: Select all

          if ConfirmSpecialAction('Deploy dive team from '..selectedSubmarine.name) then
 	     if DeployDiversFromSubmarine(selectedSubmarine) then return true; end
 	 else -- failed validation.
 

I did not test ^^ that before posting, but I think it should cause what you want without causing other problems.
Parel803
Posts: 962
Joined: Thu Oct 10, 2019 3:39 pm
Location: Netherlands

RE: Diver from Submarine

Post by Parel803 »

again thx, also for tomorrow :-)
Works great thx
Post Reply

Return to “Lua Legion”