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
Brigadier-General - Elite Grenadier
Brigadier-General - Elite Grenadier
Posts: 2010
Joined: Mon Aug 04, 2014 10:07 pm

embark spawning unit on air transport

Post by Grondel »

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 - SdKfz 234/2 8Rad
Sergeant Major - SdKfz 234/2 8Rad
Posts: 628
Joined: Tue May 28, 2013 8:48 pm

Re: embark spawning unit on air transport

Post by asuser »

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
Brigadier-General - Elite Grenadier
Brigadier-General - Elite Grenadier
Posts: 2010
Joined: Mon Aug 04, 2014 10:07 pm

Re: embark spawning unit on air transport

Post by Grondel »

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 »

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”