Which units can be airlifted?

wotan321

Emperor
Joined
Oct 25, 2001
Messages
1,228
Location
NC, USA
How do you control which units can be airlifted and which ones cannot? Is there a tag in the civ4unitinfos.xml file?

Any help is appreciated.
 
Here's the code that determines if a unit can air lift or not. This is from Vanilla, check the SDK's from Warlords if you need warlord.

Code:
bool CvUnit::canAirlift(const CvPlot* pPlot) const
{
	CvCity* pCity;

	if (getDomainType() != DOMAIN_LAND)
	{
		return false;
	}

	if (hasMoved())
	{
		return false;
	}

	pCity = pPlot->getPlotCity();

	if (pCity == NULL)
	{
		return false;
	}

	if (pCity->getCurrAirlift() >= pCity->getMaxAirlift())
	{
		return false;
	}

	if (pCity->getTeam() != getTeam())
	{
		return false;
	}

	return true;
}

So, the criteria is this:

1.) The unit must be DOMAIN_LAND.

2.) The unit must not have moved this turn.

3.) The unit must be in a plot with a city.

4.) That city must not have already airlifted it's maximum amount of units (a city that can't airlift units will have a max of zero).

5.) The city must be owned by a member of the same team as the unit.
 
Thanks. So all units in the DOMAIN_LAND in the civ4unitinfos.xml file can be airlifted if they fit your other criteria? Very good, this is just what I needed to know.
 
Okay, I tested this again, and I have 2 units, both DOMAIN_LAND, and one can be airlifted and the other not. Why? Everything else I can see is the same, as far as your other prerequisites go.
 
wotan321 said:
Okay, I tested this again, and I have 2 units, both DOMAIN_LAND, and one can be airlifted and the other not. Why? Everything else I can see is the same, as far as your other prerequisites go.


1.) Are you running Walords? There might be something different there.

2.) Are you running v1.61? If not, there migh be a difference between what I've shown and what code your version runs.

Otherwise, exactly what units are you trying to airlift?

alpha wolf 64 said:
So if I want to make tanks, ma and mi non-airliftable by changing DOMAIN_LAND, what other ways will the units be affected?

Probably more than you'd like them to be. The best way to do this would be to make an XML tag that makes the unit non-airliftable, or a callback for canAirliftUnit, but that requires an SDK change. Maybe the CCP has such a thing?

Edit: Although, if you're up for it, you could use this tutorial to edit the SDK yourself. That is, if you already have a way to edit the SDK. Then, just find that CvUnit::canAirlift() function and put in:

Code:
if (!GC.getUnitInfo(pUnit->getUnitType()).canBeAirlifted())
{
	return false;
}
 
Back
Top Bottom