Enabling certain units an ability to embark and disebmark before Sailing technology

Joined
Jan 10, 2019
Messages
1,861
What are XML Codes that can permit certain units an ability to embark and disembark before the ability is enabled with TECH_SAILING ? Did Ability Tag Class needed to add to certain units (for example UNIT_SCOUT) so it can bypass the need to research this aforemented tech entirely?


Base on this thread
 
The main tag for UNIT_SCOUT Type would be CLASS_RECON. That's mainly used to assign promotion types and to allow various units such as Great Generals to apply their special abilities to them. Are you looking to allow specific other units to embark earlier or are you trying to get recon units themselves able to do so?

There are a few basic manners in which this could be accomplished but how you go about it would depend on your specific goals, I'd say. If you want every civilization to have that option, that'd be a very different solution than if you want to grant a particular civilization the option.

For the latter, repurposing part of Maori's traits would likely be one of the more straightforward methods. The TRAIT_MAORI_EMBARKED_ABILITY modifier in that trait could be applied to the class for whatever you're looking at doing this for.

You can find the following code for that specific part of that trait in the file Expansion2_Civilizations_Major.xml located in <install path>\DLC\Expansion2\Data :

XML:
<GameInfo>
   <Types>
       <Row Type="TRAIT_CIVILIZATION_MAORI_MANA" Kind="KIND_TRAIT"/>
   </Types>     
   <CivilizationTraits>
      <Row CivilizationType="CIVILIZATION_MAORI" TraitType="TRAIT_CIVILIZATION_MAORI_MANA"/>
   </CivilizationTraits>
   <TraitModifiers>
      <Row>
         <TraitType>TRAIT_CIVILIZATION_MAORI_MANA</TraitType>
         <ModifierId>TRAIT_MAORI_EMBARKED_ABILITY</ModifierId>
      </Row>
   </TraitModifiers>
   <Modifiers>
      <Row>
         <ModifierId>TRAIT_MAORI_EMBARKED_ABILITY</ModifierId>
         <ModifierType>MODIFIER_PLAYER_UNITS_GRANT_ABILITY</ModifierType>
         <Permanent>true</Permanent>
      </Row>
      <Row>
         <ModifierId>TRAIT_MAORI_EMBARKED_ABILITY</ModifierId>
         <Name>AbilityType</Name>
         <Value>ABILITY_MANA</Value>
      </Row>
   </Modifiers>
</GameInfo>

You could just take that trait modifier and apply it directly to a different civilization's trait like this:

XML:
<TraitModifiers>
   <Row>
      <TraitType>TRAIT_CIVILIZATION_MALI_GOLD_DESERT</TraitType>
      <ModifierId>TRAIT_MAORI_EMBARKED_ABILITY</ModifierId>
   </Row>
</TraitModifiers>

I just grabbed Mali's since they're in the same file I had open but you could do that for any civilization. To apply it to units for all civilizations would work differently, of course, but the same modifier could be used like so:

XML:
<GameInfo>
   <Types>
      <Row Type="ABILITY_EMBARKATION_FOR_LONECAT" Kind="KIND_ABILITY"/>
   </Types>
   <TypeTags>
      <Row Type="ABILITY_EMBARKATION_FOR_LONECAT" Tag="CLASS_RECON"/>
      <Row Type="ABILITY_EMBARKATION_FOR_LONECAT" Tag="CLASS_MELEE"/>
   </TypeTags>
   <UnitAbilities>
      <Row UnitAbilityType="ABILITY_EMBARKATION_FOR_LONECAT" Name="LOC_ABILITY_EMBARKATION_FOR_LONECAT_NAME" Description="LOC_ABILITY_EMBARKATION_FOR_LONECAT_DESCRIPTION"/>
   </UnitAbilities>
   <UnitAbilityModifiers>
      <Row>
         <UnitAbilityType>ABILITY_EMBARKATION_FOR_LONECAT</UnitAbilityType>
         <ModifierId>TRAIT_MAORI_EMBARKED_ABILITY</ModifierId>
      </Row>
   </UnitAbilityModifiers>
</GameInfo>

This is, of course, untested but the principle is sound and should work fairly well. While I only applied it to both recon and melee units above, you could use a single class, of course, or add as many as you like, one to a line, in the TypeTags. That would then make it available to all civilizations who train units of that class.

Edited to add: You'd need to make a separate file with the descriptions if you used the last section of code. That's under <GameData> and you can't put both of those in a single file. I didn't bother adding them here since this would work and you'd simply see LOC_ABILITY_EMBARKATION_FOR_LONECAT_NAME for the ability name, if you saw it anywhere at all. Unit abilities aren't really in your face or anything so it should be easy to ignore but of course if you want to publish anything it's best to add that as well.
 
The main tag for UNIT_SCOUT Type would be CLASS_RECON. That's mainly used to assign promotion types and to allow various units such as Great Generals to apply their special abilities to them. Are you looking to allow specific other units to embark earlier or are you trying to get recon units themselves able to do so?
Only UNIT_SCOUT. (and UU Replacements) is allowed to do.
Also for land military units to embark when TECH_SAILING is researched. so to reflect real life history more accurately.

And Do I need GS mod for this ability to work? my mod project is intended to be modular and with BASE MOD for BASE VANILLA VERSION. and Expansion mod for each DLC and Expansions.
 
Only UNIT_SCOUT. (and UU Replacements) is allowed to do.
Also for land military units to embark when TECH_SAILING is researched. so to reflect real life history more accurately.
That should be pretty straightforward then.

And Do I need GS mod for this ability to work? my mod project is intended to be modular and with BASE MOD for BASE VANILLA VERSION. and Expansion mod for each DLC and Expansions.
Yeah, the Maori civ was added in Gathering Storm. To manage it without that trait may be possible but as I recall, that's mostly done via the tech applying a new value in the database so that's likely to apply to more than just recon units. OTOH, it'd be pretty silly not to allow builders, for example, to embark if a scout can do so. Ancient peoples used small boats to get around coastlines for literally tens of thousands of years before we invented anything close to modern shipbuilding techniques, after all.

Another way to go about this would be to just edit the technologies themselves. For example, here are the 2 relevant techs we're discussing:

XML:
<Technologies>
<Row TechnologyType="TECH_SAILING" Name="LOC_TECH_SAILING_NAME" Description="LOC_TECH_SAILING_DESCRIPTION" Cost="50" AdvisorType="ADVISOR_GENERIC" EraType="ERA_ANCIENT" UITreeRow="-3" EmbarkUnitType="UNIT_BUILDER" BarbarianFree="true"/>
<Row TechnologyType="TECH_CELESTIAL_NAVIGATION" Name="LOC_TECH_CELESTIAL_NAVIGATION_NAME" Description="LOC_TECH_CELESTIAL_NAVIGATION_DESCRIPTION" Cost="120" AdvisorType="ADVISOR_GENERIC" EraType="ERA_CLASSICAL" UITreeRow="-2" EmbarkUnitType="UNIT_TRADER"/>
<Row TechnologyType="TECH_SHIPBUILDING" Name="LOC_TECH_SHIPBUILDING_NAME" Description="LOC_TECH_SHIPBUILDING_DESCRIPTION" Cost="200" AdvisorType="ADVISOR_GENERIC" EraType="ERA_CLASSICAL" UITreeRow="-3" BarbarianFree="true" EmbarkAll="true"/>
</Technologies>

The EmbarkUnitType part could be used pretty easily, I'd expect, to allow recon units to embark early. The main sticking points would be how early and whether or not you can add multiple unit types to a single technology if that's something you wanted to do. Since the UU recon are a separate type of unit from scouts (UNIT_CREE_OKIHTCITAW vs UNIT_SCOUT), I don't know that this could be used to allow them to embark at the same time as scouts.

One way that occurs to me to try would be to make extra techs, one each for the relevant units, both of which are automatically granted to all civilizations. I'm not 100% sure how easy that would be, however. They wouldn't need prerequisites and that would certainly work in the base game. Hopefully it wouldn't mess up the tech tree, though. I've never played with those so I'm not 100% sure.
 
Top Bottom