embark spawning unit on air transport

A forum to discuss custom scenarios, campaigns and modding in general.

Moderator: Panzer Corps 2 Moderators

Post Reply
Grondel
Sergeant - 7.5 cm FK 16 nA
Sergeant - 7.5 cm FK 16 nA
Posts: 202
Joined: Mon Aug 04, 2014 10:07 pm

embark spawning unit on air transport

Post by Grondel » Mon Apr 05, 2021 9:19 pm

i just tried to spawn a unit of fallschirmjaeger in airtransport and noticed this is not as easy as i thought.
any ideas on how to do it?

same is for any other unit embarked on whatever. i can´t figure out the command to have the unit spawned embarked.

any help welcome.

seers,
thomas

asuser
Sergeant Major - Armoured Train
Sergeant Major - Armoured Train
Posts: 557
Joined: Tue May 28, 2013 8:48 pm

Re: embark spawning unit on air transport

Post by asuser » Tue Apr 06, 2021 11:27 am

That works, example:

For Germany:

function F1()
local feld = {8,3} -- set into
local einheit = "Fallschirmjager"
local player = world:GetPlayer(0)
local create_action = world:MakePurchaseAction(player, einheit, "SharedJu52", 0)
create_action.auxiliary = true
create_action.cost = 0
world:Exec(create_action)
local unit = world:GetUnit(create_action.id)
local hex = world:GetHex(feld)
if (hex:GetUnit(0) == nil) then
deploy_action = world:MakeDeployAction(unit,feld)
world:Exec(deploy_action)
end

For Italy:
Fallschirmjager -> ITParatroopers
SharedJu52 -> ITJu52

!!! Don't be surprised, the paratroopers are displayed as having landed, but will be transported by plane the next time they move !!!

Grondel
Sergeant - 7.5 cm FK 16 nA
Sergeant - 7.5 cm FK 16 nA
Posts: 202
Joined: Mon Aug 04, 2014 10:07 pm

Re: embark spawning unit on air transport

Post by Grondel » Tue Apr 06, 2021 3:27 pm

asuser wrote:
Tue Apr 06, 2021 11:27 am
!!! Don't be surprised, the paratroopers are displayed as having landed, but will be transported by plane the next time they move !!!
OK ;) i gave up when i saw 3 infantrie swimming in the ocean and didn´t try to move them.

bamboofats
Private First Class - Opel Blitz
Private First Class - Opel Blitz
Posts: 2
Joined: Fri Jun 04, 2021 6:16 pm

Re: embark spawning unit on air transport

Post by bamboofats » Fri Jun 11, 2021 8:17 am

Hi asuser
This method seems to have some issues as the Ju52 is now attached as an organic transport to the Fallschirmjager.
And they can use this air transport every single turn to move.

I also tried this method with LandingCraft with a unit spawned in water but the unit remains stuck after it gets onto the "organic" LandingCraft to move.

Is there an alternative way to embark the unit programmatically using LUA?

Post Reply

Return to “Panzer Corps 2 Scenario Design”