<SpecialCargo> and SPECIALUNITS

thelijah

Chieftain
Joined
Jul 18, 2016
Messages
53
Location
New Jersey, US
Hey all.

So I've been playing with carriers and I understand that SPECIALUNITS dictate what a carrier can hold, but beyond that, I don't really know how to expand off of them.
I've created a new unit that is supposed to serve as a hovering carrier that can travel both sea and land. I've accomplished the hovering part and it can carry aircraft or missiles.

Spoiler :
<Units>
<Row>
<Type>UNIT_HOVERING</Type>
<Class>UNITCLASS_CAPITAL</Class>
<PrereqTech>TECH_AGRICULTURE</PrereqTech>
<Combat>150</Combat>
<RangedCombat>150</RangedCombat>
<Cost>1500</Cost>
<Moves>6</Moves>
<Range>2</Range>
<CombatClass>UNITCOMBAT_HELICOPTER</CombatClass>
<Domain>DOMAIN_SEA</Domain>
<DefaultUnitAI>UNITAI_CARRIER_SEA</DefaultUnitAI>
<Description>TXT_KEY_UNIT_HOVERING</Description>
<Civilopedia>TXT_KEY_UNIT_HOVERING_TEXT</Civilopedia>
<Strategy>TXT_KEY_UNIT_HOVERING_STRATEGY</Strategy>
<Help>TXT_KEY_UNIT_HOVERING_HELP</Help>
<MilitarySupport>true</MilitarySupport>
<MilitaryProduction>true</MilitaryProduction>
<Pillage>false</Pillage>
<IgnoreBuildingDefense>true</IgnoreBuildingDefense>
<Mechanized>true</Mechanized>
<AdvancedStartCost>100</AdvancedStartCost>
<XPValueAttack>3</XPValueAttack>
<XPValueDefense>3</XPValueDefense>
<SpecialCargo>SPECIALUNIT_FIGHTER</SpecialCargo>
<DomainCargo>DOMAIN_AIR</DomainCargo>

<UnitArtInfo>ART_DEF_UNIT_SMOKEY_STEAM_AIRSHIP</UnitArtInfo>
<MoveRate>BOAT</MoveRate>
<UnitFlagIconOffset>8</UnitFlagIconOffset>
<UnitFlagAtlas>EXPANSION_SCEN_UNIT_FLAG_ATLAS</UnitFlagAtlas>
<PortraitIndex>8</PortraitIndex>
<IconAtlas>EXPANSION_SCEN_UNIT_ATLAS</IconAtlas>
</Row>
</Units>


I have two problems:

1) I want it to carry land units. Now; I've looked into threads of people trying to figure out how to make a land unit carry a land unit, and before you say "its not possible", my unit is simply a sea unit that can carry cargo and travel over land tiles, and yes it works. I found Redox's Amphibious Assault Ship Mod, which creates carriers for land units so I downloaded the mod and took a look at the code, but I had trouble pulling [and deciphering] the code to allow carriers to carry land units.
In theory, shouldn't it be possible to just create a new SPECIALUNIT (in the CIV5SpecialUnits.xml file) that refers to land units (or combat classes? (or domains?))? And is this possible without LUA?:confused:

Spoiler :
CIV5SpecialUnits.xml said:
<SpecialUnits>
<Row>
<ID>0</ID>
<Type>SPECIALUNIT_FIGHTER</Type>
<Description>TXT_KEY_SPECIALUNIT_FIGHTER</Description>
<Valid>true</Valid>
<CityLoad>true</CityLoad>
</Row>

<Row>
<Type>SPECIALUNIT_PEOPLE</Type>
<Description>TXT_KEY_SPECIALUNIT_PEOPLE</Description>
<Valid>true</Valid>
<CityLoad>false</CityLoad>
</Row>

<Row>
<Type>SPECIALUNIT_MISSILE</Type>
<Description>TXT_KEY_SPECIALUNIT_MISSILE</Description>
<Valid>true</Valid>
<CityLoad>true</CityLoad>
</Row>

<Row>
<Type>SPECIALUNIT_STEALTH</Type>
<Description>TXT_KEY_SPECIALUNIT_FIGHTER</Description>
<Valid>true</Valid>
<CityLoad>true</CityLoad>
</Row>

</SpecialUnits>

<SpecialUnit_CarrierUnitAI>
<Row>
<SpecialUnitType>SPECIALUNIT_FIGHTER</SpecialUnitType>
<UnitAIType>UNITAI_CARRIER_SEA</UnitAIType>
</Row>

<Row>
<SpecialUnitType>SPECIALUNIT_PEOPLE</SpecialUnitType>
<UnitAIType>UNITAI_MISSIONARY_SEA</UnitAIType>
</Row>
<Row>
<SpecialUnitType>SPECIALUNIT_PEOPLE</SpecialUnitType>
<UnitAIType>UNITAI_ASSAULT_SEA</UnitAIType>
</Row>

<Row>
<SpecialUnitType>SPECIALUNIT_MISSILE</SpecialUnitType>
<UnitAIType>UNITAI_MISSILE_CARRIER_SEA</UnitAIType>
</Row>
</SpecialUnit_CarrierUnitAI>
None of these pre-existing SPECIALUNIT types are of much use; although I'm not sure about SPECIALUNIT_PEOPLE (I think that's for specialists).


2) [Minor] Is it possible to allow a carrier to carry different types of SPECIALUNITS as long as they fit the cargo number limit?
eg. A carrier that can hold 10 units, with 4 missiles, and 6 aircraft.

Thanks all.:cool:
 
Hello Thelijah,

2) [Minor] Is it possible to allow a carrier to carry different types of SPECIALUNITS as long as they fit the cargo number limit?

no.
either you don't define a specialunit for the carrier's cargo and it can hold any unit of the domain defined with <DomainCargo>...</DomainCargo>
or you give all units you want to be embarked the same specialunit tag.

But you can't define more than one <SpecialCargo> in the carrier code.

In theory, shouldn't it be possible to just create a new SPECIALUNIT (in the CIV5SpecialUnits.xml file) that refers to land units (or combat classes? (or domains?))? And is this possible without LUA?

yes it would work. Create a new specialunit, tag a land unit with it, set it as <SpecialCargo> in the carrier code but...

when sea unit carries a land unit sooner or later it leads to the savegame bug (corrupted saves that are either 12ko in size or reach a GB size until you stop the game with the task manager).
 
Funny, I was doing some more digging and I found this, Hulfgar :lol:
http://forums.civfanatics.com/showthread.php?t=417963

Thank you, reading that thread along with your response has answered what I was looking for.

Hulfgar said:
either you don't define a specialunit for the carrier's cargo and it can hold any unit of the domain defined with <DomainCargo>...</DomainCargo>
or you give all units you want to be embarked the same specialunit tag.

I presume you cannot designate more than one domain for <DomainCargo>. Would it be possible to simply create a new SpecialUnit and assign it to units of different domains and leave <DomainCargo> blank? (I doubt that this wouldn't result in errors)

Also, a big thing is: Do all units have to paradrop to load onto the carrier? This is what I've heard, but it would be problematic because I would have to give my non-paradropping units the ability to rebase, but I would have to recreate it as a new mission, limit the range (to 1) and not allow rebasing to cities or other carriers.

Hulfgar said:
when sea unit carries a land unit sooner or later it leads to the savegame bug (corrupted saves that are either 12ko in size or reach a GB size until you stop the game with the task manager).
I've read about this bug, but is it unavoidable when carrying land units?

Thanks again.
 
I presume you cannot designate more than one domain for <DomainCargo>.

no you can have only one <DomainCargo> per carrier type.

Would it be possible to simply create a new SpecialUnit and assign it to units of different domains and leave <DomainCargo> blank?
I never tried it. You don't need a <SpecialCargo> for a carrier to carry units but I doubt that it would work without a <DomainCargo>. But try it and see what happens, maybe it will work.

Do all units have to paradrop to load onto the carrier?
To load Commandos on Submarines I had to paradrop them.
To load marines on cruisers I just had to move the marines on the cruiser tile.

but is it unavoidable when carrying land units?
I never found a workaround and I was not the only one having this bug with the mod.
The bad thing is that you never know when the bug will happen : it can be with the 1st. save or after turns of game and multiple good saves !
 
Hulfgar said:
To load Commandos on Submarines I had to paradrop them.
To load marines on cruisers I just had to move the marines on the cruiser tile.
Your commandos cannot load into submarines by moving them onto the same tile? Do you know if this is caused by either unit?

Hulfgar said:
when sea unit carries a land unit sooner or later it leads to the savegame bug (corrupted saves that are either 12ko in size or reach a GB size until you stop the game with the task manager).
Hulfgar said:
I never found a workaround and I was not the only one having this bug with the mod.
The bad thing is that you never know when the bug will happen : it can be with the 1st. save or after turns of game and multiple good saves !
Are you positive that it is caused by sea units carrying land units?
 
Do you know if this is caused by either unit?
since marines could load on cruisers by moving on their tile I suppose that the problem came from the submarines.

Are you positive that it is caused by sea units carrying land units?
once I removed the ability to carry land troops for the ships the savegame disappeared. So yes I'm sure that it was caused by sea units carrying land units.
 
So, I tried it.
Spoiler :
<Units>
<Row>
<Type>UNIT_NEWCARRIER</Type>
<Class>UNITCLASS_CAPITAL</Class>
<PrereqTech>TECH_AGRICULTURE</PrereqTech>
<Combat>170</Combat>
<RangedCombat>170</RangedCombat>
<Cost>1500</Cost>
<Moves>5</Moves>
<Range>2</Range>
<CombatClass>UNITCOMBAT_HELICOPTER</CombatClass>
<Domain>DOMAIN_SEA</Domain>
<DefaultUnitAI>UNITAI_CARRIER_SEA</DefaultUnitAI>
<Description>TXT_KEY_UNIT_STARDESTROYER</Description>
<Civilopedia>TXT_KEY_UNIT_STARDESTROYER_TEXT</Civilopedia>
<Strategy>TXT_KEY_UNIT_STARDESTROYER_STRATEGY</Strategy>
<Help>TXT_KEY_UNIT_STARDESTROYER_HELP</Help>
<MilitarySupport>true</MilitarySupport>
<MilitaryProduction>true</MilitaryProduction>
<Pillage>false</Pillage>
<IgnoreBuildingDefense>true</IgnoreBuildingDefense>
<Mechanized>true</Mechanized>
<AdvancedStartCost>100</AdvancedStartCost>
<XPValueAttack>3</XPValueAttack>
<XPValueDefense>3</XPValueDefense>
<SpecialCargo/>
<DomainCargo>DOMAIN_LAND</DomainCargo>

<UnitArtInfo>ART_DEF_UNIT_SMOKEY_STEAM_AIRSHIP</UnitArtInfo>
<MoveRate>BOAT</MoveRate>
<UnitFlagIconOffset>8</UnitFlagIconOffset>
<UnitFlagAtlas>EXPANSION_SCEN_UNIT_FLAG_ATLAS</UnitFlagAtlas>
<PortraitIndex>8</PortraitIndex>
<IconAtlas>EXPANSION_SCEN_UNIT_ATLAS</IconAtlas>
</Row>
</Units>


It does allow land units to load up into my carrier unit.
Spoiler :
embark sea 0.jpg
embark sea 1.jpg


- It will only allow units to load up when it would otherwise embark onto the same tile of my carrier. My carrier hovers over all terrain and when it is on land, land units won't load up into the carrier when it walks onto the same tile.
Spoiler :
embark 0.jpg
embark 1.jpg
embark 2.jpg


- When units are loaded up, they are embarked. So because my carrier can hover over land, so can the embarked units. When they leave the carrier, they glitch out as embarked boats swimming through land. The only way to get them back is to exit to ocean and re-disembark. I tried removing embarkation for land units, thinking it would fix it, but it just prevented the units from loading up into the carrier since it will only allow them to load up into the carrier on ocean.
Spoiler :
embark glitch 0.jpg
embark glitch 1.jpg
embark glitch 2.jpg


When my game is loaded up with this it will occasionally crash randomly without warning.

I was considering changing the domain to land (since it would still be able to float over all terrain with my promotion) but that would no doubt create more issues with a land unit carrying a land unit.
EDIT:
I changed it to DOMAIN_LAND and nothing really seemed to be different except it could no longer be on the same tile as a land unit. I haven't experienced any crashes with this, but I changed it back to DOMAIN_SEA before I could test it long enough.

If anyone has any suggestions, I'd be much obliged.
 
Top Bottom