Need help changing carrier unit capacity and unit type parameters

dlwebbx

Chieftain
Joined
Jan 16, 2011
Messages
4
Edit-Post #4 has a partial solution!

Hi,
I was wondering how to change the unit capacity of the carrier in civ v to hold more planes and carry different types of units as to avoid embarking land units and enable basing for missiles.

I'm pretty sure I recall in Civ II that the carrier had this functionality and it held up to 12 units (planes and missiles only--land units used transport boats).

Anyway, there is no special value assigned under the carrier row in the units XML file:

(c:\program files\steam\steamapps\common\sid meier's civilization v\assets\gameplay\xml\Units\CIV5Units.xml)

<Row>
<Class>UNITCLASS_CARRIER</Class>
<Type>UNIT_CARRIER</Type>
<PrereqTech>TECH_FLIGHT</PrereqTech>
<Combat>30</Combat>
<Cost>520</Cost>
<Moves>5</Moves>
<CombatClass>UNITCOMBAT_NAVAL</CombatClass>
<Domain>DOMAIN_SEA</Domain>
<DefaultUnitAI>UNITAI_CARRIER_SEA</DefaultUnitAI>
<Description>TXT_KEY_UNIT_CARRIER</Description>
<Civilopedia>TXT_KEY_CIV5_INDUSTRIAL_CARRIER_TEXT</Civilopedia>
<Strategy>TXT_KEY_UNIT_CARRIER_STRATEGY</Strategy>
<Help>TXT_KEY_UNIT_HELP_CARRIER</Help>
<MilitarySupport>true</MilitarySupport>
<MilitaryProduction>true</MilitaryProduction>
<Pillage>true</Pillage>
<IgnoreBuildingDefense>true</IgnoreBuildingDefense>
<Mechanized>true</Mechanized>
<AdvancedStartCost>60</AdvancedStartCost>
<MinAreaSize>20</MinAreaSize>
<XPValueAttack>3</XPValueAttack>
<XPValueDefense>3</XPValueDefense>
<SpecialCargo>SPECIALUNIT_FIGHTER</SpecialCargo>
<DomainCargo>DOMAIN_AIR</DomainCargo>
<UnitArtInfo>ART_DEF_UNIT_CARRIER</UnitArtInfo>
<UnitFlagIconOffset>70</UnitFlagIconOffset>
<IconAtlas>UNIT_ATLAS_2</IconAtlas>
<PortraitIndex>23</PortraitIndex>
<MoveRate>BOAT</MoveRate>
</Row>

I highlighted in blue the <SpecialCargo> line because I think that's a good starting point as the nuclear submarine row also contains the line:
<SpecialCargo>SPECIALUNIT_MISSILE</SpecialCargo>

What would the format be to combine these two lines under the carrier row? I think that would work. Would it look like this:
<SpecialCargo>SPECIALUNIT_MISSLE_AND_SPECIALUNIT_FIGHTER</SpecialCargo>
?

I just don't know the XML syntax can I combine those like that doing underscoreANDunderscore?

If we can combine those two then that takes care of adding missiles to the carrier but what about land units?

Back to the question of capacity: look at the XML row for the fighter:

<Row>
<Class>UNITCLASS_FIGHTER</Class>
<Type>UNIT_FIGHTER</Type>
<PrereqTech>TECH_FLIGHT</PrereqTech>
<RangedCombat>50</RangedCombat>
<Cost>420</Cost>
<Moves>2</Moves>
<Immobile>true</Immobile>
<Range>8</Range>
<Special>SPECIALUNIT_FIGHTER</Special>
<CombatClass>UNITCOMBAT_FIGHTER</CombatClass>
<Domain>DOMAIN_AIR</Domain>
<DefaultUnitAI>UNITAI_DEFENSE_AIR</DefaultUnitAI>
<Description>TXT_KEY_UNIT_FIGHTER</Description>
<Civilopedia>TXT_KEY_CIV5_INDUSTRIAL_FIGHTER_TEXT</Civilopedia>
<Strategy>TXT_KEY_UNIT_FIGHTER_STRATEGY</Strategy>
<Help>TXT_KEY_UNIT_HELP_FIGHTER</Help>
<MilitarySupport>true</MilitarySupport>
<MilitaryProduction>true</MilitaryProduction>
<IgnoreBuildingDefense>true</IgnoreBuildingDefense>
<Mechanized>true</Mechanized>
<AdvancedStartCost>50</AdvancedStartCost>
<AirUnitCap>1</AirUnitCap>
<RangedCombatLimit>100</RangedCombatLimit>
<CombatLimit>0</CombatLimit>
<XPValueAttack>3</XPValueAttack>
<XPValueDefense>2</XPValueDefense>
<UnitArtInfo>ART_DEF_UNIT_FIGHTER</UnitArtInfo>
<UnitFlagIconOffset>62</UnitFlagIconOffset>
<IconAtlas>UNIT_ATLAS_2</IconAtlas>
<PortraitIndex>17</PortraitIndex>
<MoveRate>AIR_REBASE</MoveRate>
</Row>

Again, I highlighted in blue a line of interest. I'm not sure if this is actually the capacity it takes up or I'm just wishful thinking on a false cognitive (I didn't set it to 0 either to see if I could put unlimited planes on the carrier, but I did look for integer values of 3 on the carrier (its unit capacity), but couldn't find anything associated with the AirUnitCap line.

So at this point I don't know what to do and am open to suggestions, or if the solution is out there please point me in the right direction. I'm hoping that someone has already done this and there is a quick and easy way to accomplish it.

Thanks in advance to those willing to teach.

-Dan
 
I'd look into the SPECIALUNIT definitions. I think they're in a file of their own.

I keep meaning to make a second helicopter unit that can hold non-cavlary, non-vehicle-using melee units, and I think I found the relevant stuff, but I didn't get around to doing it. I guess I'd be bothered if I had unit graphics.
 
I'd look into the SPECIALUNIT definitions. I think they're in a file of their own.

I keep meaning to make a second helicopter unit that can hold non-cavlary, non-vehicle-using melee units, and I think I found the relevant stuff, but I didn't get around to doing it. I guess I'd be bothered if I had unit graphics.

I looked at the special unit file but didn't find much in it at all. I like the idea of the helicopter being able to hold infantry men or paratroopers.
 
I seemed to have found a round about way to increase the carrier unit capacity and to hold missiles. So far I have not figured out how to put land units on the carrier or infantry in the helicopters. I will share as soon as I figure out. As far as increasing unit capacity....

Step 1 Create New Promotion:

I found that Civ V uses free promotions in the Civ5Units.xml in order to provide abilities to units. By free it means the unit receives the promotion automatically upon creation (it does not have to be earned) and you don't have to manually select the promotion every time you make the unit--basically you don't even know you have it you just assume its a normal ability of the unit.

Open the Civ5UnitPromotions.xml file in your editor and find the lines:
<Row>
<Type>PROMOTION_CARGO_III</Type>
<Description>TXT_KEY_PROMOTION_CARGO_III</Description>
<Help>TXT_KEY_PROMOTION_CARGO_III</Help>
<Sound>AS2D_IF_LEVELUP</Sound>
<CargoChange>3</CargoChange>
<PortraitIndex>58</PortraitIndex>
<IconAtlas>ABILITY_ATLAS</IconAtlas>
<PediaType>PEDIA_ATTRIBUTES</PediaType>
<PediaEntry>TXT_KEY_PEDIA_PROMOTION_CARGO_III</PediaEntry>
</Row>

It should be around line 1600. If not just pick a line and use CTRL+F to find it. This is a promotion that is referenced by the carrier in the Free Promotions table in the Civ5Units.xml file. Since we don't know if any other units also refer back to this promotion we should not just change the <CargoChange> column value from 3 to 12(which would work if that is your only aim). Instead, copy and paste this whole "row" back into the Civ5UnitPromotions.xml (probably almost anywhere will work but just to be safe and follow convention paste after the PROMOTION_CARGO_IV promotion). Obviously since we copy and pasted another promotion all the information about our new promotion will actually be the information from the one we copy and pasted, and changing that is beyond me as of yet.

After you paste change the lines
<Type>PROMOTION_CARGO_III</Type> to <Type>PROMOTION_CARGO_V</Type> and <CargoChange>3</CargoChange> to <CargoChange>12</CargoChange>. Now it should look like this:

<Row>
<Type>PROMOTION_CARGO_III</Type>
<Description>TXT_KEY_PROMOTION_CARGO_III</Description>
<Help>TXT_KEY_PROMOTION_CARGO_III</Help>
<Sound>AS2D_IF_LEVELUP</Sound>
<CargoChange>3</CargoChange>
<PortraitIndex>58</PortraitIndex>
<IconAtlas>ABILITY_ATLAS</IconAtlas>
<PediaType>PEDIA_ATTRIBUTES</PediaType>
<PediaEntry>TXT_KEY_PEDIA_PROMOTION_CARGO_III</PediaEntry>
</Row>
<Row>
<Type>PROMOTION_CARGO_IV</Type>
<Description>TXT_KEY_PROMOTION_CARGO_IV</Description>
<Help>TXT_KEY_PROMOTION_CARGO_IV</Help>
<Sound>AS2D_IF_LEVELUP</Sound>
<CargoChange>4</CargoChange>
<PortraitIndex>58</PortraitIndex>
<IconAtlas>ABILITY_ATLAS</IconAtlas>
<PediaType>PEDIA_ATTRIBUTES</PediaType>
<PediaEntry>TXT_KEY_PEDIA_PROMOTION_CARGO_IV</PediaEntry>
</Row>
<Row>
<Type>PROMOTION_CARGO_V</Type>
<Description>TXT_KEY_PROMOTION_CARGO_IV</Description>
<Help>TXT_KEY_PROMOTION_CARGO_IV</Help>
<Sound>AS2D_IF_LEVELUP</Sound>
<CargoChange>12</CargoChange>
<PortraitIndex>58</PortraitIndex>
<IconAtlas>ABILITY_ATLAS</IconAtlas>
<PediaType>PEDIA_ATTRIBUTES</PediaType>
<PediaEntry>TXT_KEY_PEDIA_PROMOTION_CARGO_IV</PediaEntry>
</Row>


Now that you have defined a new promotion in a row in the Civ5UnitPromotions.xml file save it, and open your Civ5Units.xml in an editor (modbuddy, notepad etc.) and find the lines:
<Row>
<UnitType>UNIT_CARRIER</UnitType>
<PromotionType>PROMOTION_CARGO_III</PromotionType>
</Row>
It should be around line 6000 or just do CTRL+F and find it. It will be in the <Unit_FreePromotions> table. Now you just simply change the <PromotionType>PROMOTION_CARGO_III</PromotionType> line to this <PromotionType>PROMOTION_CARGO_V</PromotionType>

so it reads
<Row>
<UnitType>UNIT_CARRIER</UnitType>
<PromotionType>PROMOTION_CARGO_V</PromotionType>
</Row>
Save it, and then you're done! Your carrier now has a capacity of 12! Sorry if this post was very redundant--I couldn't find hardly any resources for modding the game and wanted anybody to be able to take these directions and accomplish the goal.

Oh, and how to add the missiles to the carriers....open your Civ5Units.xml file and find the carrier:

<Row>
<Class>UNITCLASS_CARRIER</Class>
<Type>UNIT_CARRIER</Type>
<PrereqTech>TECH_FLIGHT</PrereqTech>
<Combat>30</Combat>
<Cost>520</Cost>
<Moves>5</Moves>
<CombatClass>UNITCOMBAT_NAVAL</CombatClass>
<Domain>DOMAIN_SEA</Domain>
<DefaultUnitAI>UNITAI_CARRIER_SEA</DefaultUnitAI>
<Description>TXT_KEY_UNIT_CARRIER</Description>
<Civilopedia>TXT_KEY_CIV5_INDUSTRIAL_CARRIER_TEXT</Civilopedia>
<Strategy>TXT_KEY_UNIT_CARRIER_STRATEGY</Strategy>
<Help>TXT_KEY_UNIT_HELP_CARRIER</Help>
<MilitarySupport>true</MilitarySupport>
<MilitaryProduction>true</MilitaryProduction>
<Pillage>true</Pillage>
<IgnoreBuildingDefense>true</IgnoreBuildingDefense>
<Mechanized>true</Mechanized>
<AdvancedStartCost>60</AdvancedStartCost>
<MinAreaSize>20</MinAreaSize>
<XPValueAttack>3</XPValueAttack>
<XPValueDefense>3</XPValueDefense>
<SpecialCargo>SPECIALUNIT_FIGHTER</SpecialCargo> gets changed to <SpecialCargo>SPECIALUNIT_FIGHTER_SPECIALUNIT_MISSLE</SpecialCargo> (LOL I had a typo--I never spelled missile correctly...do carriers hold cruise missiles by default already?:blush: I'm not going to check I'm going to bed haha)
<DomainCargo>DOMAIN_AIR</DomainCargo>
<UnitArtInfo>ART_DEF_UNIT_CARRIER</UnitArtInfo>
<UnitFlagIconOffset>70</UnitFlagIconOffset>
<IconAtlas>UNIT_ATLAS_2</IconAtlas>
<PortraitIndex>23</PortraitIndex>
<MoveRate>BOAT</MoveRate>
</Row>


Save it, and you're done!
missle missile
-Dan
 
I seemed to have found a round about way to increase the carrier unit capacity and to hold missiles.

While dlwebbx has the right basic idea (the capacity of the carrier is tied to the Cargo promotion it uses), it is a BAD idea to be cutting-and-pasting the XML files. Bad, bad, bad idea.
So just use the usual UpdataDatabase methods for XML, and just add a new promotion that way. It works just fine, meshes better with other mods, and doesn't conflict with any patches that may come out.

The real question is, why? What's the point of putting that many aircraft on a carrier, when it's just going to get sunk? There's currently no advantage to basing off of a carrier, and Stealth Bombers can't even go on a carrier in the first place; the only good thing to use them for is ferrying units between distant continents. So there's no good reason to want 12 on there, and it's just abuseable against the AI. Even moreso if you want missiles to fit on there as well.
 
Hi,

Thanks for your reply. Forgive my ignorance, but what are the "usual UpdataDatabase methods for XML"? If it's in the Civ V SDK just point me in the right direction and I'll find it and figure it out for myself--it seems hard enough finding help anyway.

I just got the game and like everything else I get I take it apart and change it the way I like it. I started out playing a mod of Earth and picked America...apparently their special unit bomber can base on carriers which made me wrongly assume all bombers could base on carriers...I guess I had the wrong idea?

But why not change the capacity? It makes it more realistic...3 units really? And what do you mean it's just going to get sunk? Why couldn't one defend it with other naval units and prevent sinking? Ferrying seems more realistic to me and I don't much like the embarking idea.

Anyway, mainly I just wanted to be able to drop bombs from a fleet of airplanes that land on a big boat to refuel/rearm and do it all over again. Right now this is possible with a large fleet of carriers, however, I would argue that that is even more abuseable since you can move the carriers around and cover more ground to bomb with the same number of planes. I just think it is that much more realistic and reflects the real world. In real life an aircraft carrier is like a floating city and very much changes the geopolitical dynamic of any area it enters.

The real question is, why do you care what my motives are anyway? I find it VERY ironic that someone who has "Mad Scientist" written under their name questions the reasons why another would want to experiment around with changing something to their own particular fancy. Maybe I want to comp stomp all day long? Maybe I want the game to be epic and as realistic as possible because my GPU, CPU, and north/south bridge are all over-clocked and liquid-cooled so when I get to turn 500 with 17 civs and 20 city states on a huge map it still chugs along ending turns fairly quickly (because I'm a real mad scientist trying to get a box into the top 20 on a BOINC project (you should check it out and join up.)) And not for nothing, in the future, how about some detailed how-to posts answering our questions that end up in the top 10 results on google when other people search the same question!! ; ) I couldn't find many recs for this game one wiki was entirely blank...what is going on?!?
 
As explained in Kael's guide (although many details are out of date), the 'correct' way to mod the DB is to create XML files that define the changes you want to make, rather than redefining everything. You then use ModBuddy to set an action, for each such XML file, of set OnModActivated and type UpdateDatabase, with the filename being the relative path (from mod root) to the XML file.
 
CARGO_III is used by the Carrier and the Missile Cruiser. CARGO_IV is in CIV5UnitPromotions.xml, but isn't used by anything. Change the Carrier to use the CARGO_IV promo and change <CargoChange> to 12.
 
But why not change the capacity? It makes it more realistic...3 units really? And what do you mean it's just going to get sunk? Why couldn't one defend it with other naval units and prevent sinking? Ferrying seems more realistic to me and I don't much like the embarking idea.

Because there's very little "defense" in this game. You can't actually prevent the carrier from sinking; a concerted attack by three or four land-based bombers will sink any carrier, and anyone onboard will go with it. Sure, you can also put some fighters onboard to intercept incoming planes or a few destroyers nearby, but fighters are limited to a single interception per turn AND can be neutralized with an "air sweep" mission. And anti-aircraft fire only prevents the incoming damage if it kills the attacking aircraft entirely (which almost never happens); sure, the bombers will take some damage, but the carrier will be dead. The Carrier doesn't even get a defense bonus versus air attacks (which it should!) to represent the CAP.

Likewise, Civ5 just isn't structured around the idea of a "fleet". The number of units you can support, financially, doesn't depend on their types, and you simply can't afford to place a ring of destroyers and such around each carrier. Even if you did, this'd be a horrendous waste (those units would be better used doing other things, like attacking), and since there's no ship-based analogue to the Intercept mission, a determined attacker could get through any incomplete ring. So enemy submarines WILL get through, and even a single submarine can sink a carrier with ease. But even if you could afford that many escorts for each carrer, the AI won't do that; it's just not smart enough to manage things on that level.

When a single unit of aircraft costs more than a carrier, you understand that one "unit" represents a large number of planes anyway. So if all of the fighters on board the carrier cost 10 times its value, you can see why being able to sink the carrier at all costs is a good idea.

So my point was that making this sort of change has three basic effects:
1> For units that can carry missiles, you create an unstoppable "alpha strike". Fire off all my guided missiles at once to wipe out a city's defenses and take it with ease, then back off to restock.
2> For units that carry fighters, there's little point to takign advantage of it, because there's basically no advantage to using a carrier as a base instead of a city. City-based fighters, as long as they can reach the target, are better than naval fighters, because they can heal themselves more by resting and aren't as vulnerable to attacks on their carrier. (I'm going to give carriers the Medic promotion to help make up for this, but it's still unbalanced.) So a smart player would simply never take advantage of that extra room; you'd only use carriers to ferry planes between distant continents, or in an initial assault, but once you've got a foothold city, you'd be smarter to rebase everything there. This gets even more pronounced in the later game, when you're using air units with ranges of 15-20; you'll go a dozen turns or more of normal attacks before you'd need to rebase a land-based bomber even once, so the mobility advantage of the carrier goes away already.
3> The AI wouldn't do any of this intelligently. It'd put lots of aircraft on each carrier, while you'd easily be able to kill that carrier, for a huge economic advantage. Conversely, the AI wouldn't understand that killing YOUR carrier at all costs is worth the effort, and will rarely do so. This is the big problem with adding this sort of mod; if you do it in a way that's an advantage then the AI usually won't know how to take advantage of it, and if you do it in a way that has drawbacks then the AI will usually walk right into them because it won't know how to evaluate the change correctly.

#3 is the big one for almost any mod. The AI is just not very adaptable to game changes; there are ways to change its behaviors using Flavor ratings and such, but most of the AI is locked away in the DLL for now. Eventually this might change, but that sort of change will be at a much higher level than most modders can handle.

In real life an aircraft carrier is like a floating city and very much changes the geopolitical dynamic of any area it enters.

True. For a real carrier, they effectively control the entire sea within hundreds of miles of their location, and they have plenty of other advantages (command and control, medical abilities, etc.). You could mimic this in other ways, like making carriers act as toned-down Great Generals (buffing all nearby units) and/or Medics. The current Carrier is just a pure combat unit, and not a very good one.

The real question is, why do you care what my motives are anyway?

Do you understand what board you're on? This is a forum (really, THE forum) for customization of this game. People propose ideas here or present mods they've made, in both cases wanting feedback. If the feedback is "that idea is flawed" then that's still valid feedback. Knowing exactly WHY you want to make a certain change is a big part of suggesting alternatives; if you're relatively new to modding then you often won't know what's possible, and it's likely that there's a different way to do something that'd get the basic effect you want without the potential imbalances we can spot.

For instance, let's say your motivation is that you just like the idea of having more units on a carrier, and/or more fine control over air units in general. Okay, so let's mod the following:
> All air units are half as strong as they are currently, cost half as much to build, and require no unit support costs. (I've actually been considering something like this one for my own mod for other reasons.) Besides doing half as much damage, air units would also take more damage from each anti-aircraft encounter, which increases the chances they'll die before getting through to their targets. (Not so much of the "how many attacks can I make before I need to rest up?" that you have now.)
> Carriers hold twice as many planes. (Maybe more, this one would take some testing.)
> Carriers get the Medic promotion, and get +50% vs. air attacks.
> Carriers provide a custom promotion to all air units they carry, which reduces Range by 2 and city attack strength by 20%, but adds +50% Evasion and +1 visibility. (Carrier aircraft can't carry as much of a fuel or weapon payload as their land-based counterparts, but the fact that you don't know where they're coming from makes them more likely to succeed.) This last one would need to be done through Lua, but it's not hard.

Most of the above are things that'd be basically transparent to the AI; with a little Flavor tweaking you could get it to use the right number of naval planes, and the AI wouldn't be at a huge disadvantage compared to a smart player.
 
Back
Top Bottom