Garrison Pop Counting

Modding, Map Editor, IES Scripting and Other Questions
Post Reply
PaulStretch
Posts: 112
Joined: 27 Jun 2021, 16:10
Has thanked: 45 times
Been thanked: 13 times

Garrison Pop Counting

Post by PaulStretch »

I've working on a transport that carries apcs that can carry infantry. I noticed though that when I garrison the apc. the game counts the infantry pop that is garrisoned in the APC towards the pop of the apc. Another problem, is unless the transport is set to both pick up infantry and vehicles, It can't garrisoned an apc with infantry inside it. You have to ungarrison the infantry or change the transport's garrison type. A workaround I found is the heliport ignores infantry thats inside transport helicopters when you garrison helicopters. It does this for all helicopters, but not for units that don't have the helicopter parent type. I've been trying to figure out how it is that helicopters have this special property, but i'm not having any luck The dirty solution is to just use the Helicopter unittype as a parent whenever I need to ignore garrisoned units, but I'd rather know specifically how to create a unity type with this property on my own.

User avatar
Dr.MonaLisa
High Representative
Posts: 8697
Joined: 17 Jun 2010, 11:21
Location: Poland
Has thanked: 49 times
Been thanked: 108 times

Re: Garrison Pop Counting

Post by Dr.MonaLisa »

Could you please clarify what you mean by:

"the game counts the infantry pop that is garrisoned in the APC towards the pop of the apc"

Once you garrison the APC the population of this vehicle is ignored, and only units inside it are counted?

The one thing I can think of is that all Garrison types need to be specified in the building.

There's also file "dbunittypeattributes.ddf", with:

Code: Select all

UnitTypeAttribute GarrisonnableUnits {
	MaskMode = All
	AbilityMask = [ 
		Garrisonable
	]
}

Code: Select all

UnitTypeAttribute GarrisonHosts {
	MaskMode = All
	AbilityMask = [
		Garrison
	]
}

Code: Select all

UnitTypeAttribute MobileGarrisonHosts {
	MaskMode = All
	AbilityMask = [
		Movement
		Garrison
	]
}

Code: Select all

UnitTypeAttribute GarrisonAircraftHosts {
	UnitTypeFamilies = [
		Airport
		AircraftCarrier
		InternationalAirport1
		InternationalAirport2
		Flyairport 
	]
}
Do all of your units have the "Garrisonable" ability? Maybe it's worth to try adding some extra "UnitTypeFamilies" to dbunittypeattributes.ddf file with your modded units. That possibly could workaround problems, but I'm not sure.
Best regards,
Dr.MonaLisa
Ministry of Game Affairs
Department of Control and Complains
These users thanked the author Dr.MonaLisa for the post:
PaulStretch
PaulStretch
Posts: 112
Joined: 27 Jun 2021, 16:10
Has thanked: 45 times
Been thanked: 13 times

Re: Garrison Pop Counting

Post by PaulStretch »

So if the pop count of the apc is 2, but it has 10 infantry garrisoned inside it, then when the apc is garrisoned inside a naval transport, it takes up 12 slots instead of 2. It seems like it is tied to the vehicle and not the building. I made the helicopter unit type the parent for the apc, and when I did that, the apc only took up 2 slots like it should.

Added after 1 hour 36 minutes 39 seconds:
It's the movetype. I think air units have a special attribute in the source code that changes how their pop is calculated in garrison slots. It's unfortunate. I can apply this to the apc but the unit will then always be able to drive though buildings. This is a pretty big oversight, because naval transports can't garrison in a dock if they're carrying units. I don't see why this attribute wasn't just applied to all movetypes.
User avatar
Dr.MonaLisa
High Representative
Posts: 8697
Joined: 17 Jun 2010, 11:21
Location: Poland
Has thanked: 49 times
Been thanked: 108 times

Re: Garrison Pop Counting

Post by Dr.MonaLisa »

In my opinion, the way it works with counting all units inside other garrisoned units is better, as it prevents abuses where a small transport unit could transport a lot of others. So the way it works in helicopters is more like a bug than a feature.

I wonder if you've searched for "garrison" things in file zips\hdrs.zip ? It might have some useful information on how DDF are read.
Best regards,
Dr.MonaLisa
Ministry of Game Affairs
Department of Control and Complains
PaulStretch
Posts: 112
Joined: 27 Jun 2021, 16:10
Has thanked: 45 times
Been thanked: 13 times

Re: Garrison Pop Counting

Post by PaulStretch »

I did check the header files. No luck, but I figured I'll just make separate transports for infantry and vehicles. I think that makes sense about abusing the transport system. Where I want to use the nested garrison is with container modules that transports use to carry units. Instead of the transport holding the units directly, they would hold a container module that held the units, and the container module would act as a base wherever it dropped, and could be switched out for different modules, or even deployable buildings.
Post Reply

Return to “Questions”