Tutorial:Shared Unit Caps

From Total War Modding
Revision as of 21:04, 6 July 2023 by Not All is Dust (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Intro:

This page is specifically on what shared unit caps are, how they are set up, what they are used for, and how they interact with normal unit caps.

Shared unit caps where introduced with the Forge of the Chaos Dwarfs DLC. They make it so the player needs to choose between one unit when using caps. Example: Both the Infernal Guard and Infernal Guard (Great Weapons) share the same cap so after unlocking one additional cap the player must choose between recruiting one unit or the other.

This mechanic allows for more diversity of units with different weapons without bloating a roster and still make the caps restrictive and not have undesirable available units. Example: The Beastmen have caps, but because they don't have shared caps, the way they are unlocked can either feel too restrictive or not enough. The three minotaur units cap has to be increased separately making them to restrictive and the three centigor units when increased are all increased by one making it likely there are undesirable centigors.

Tables Required:

  1. db/effect_bonus_value_unit_list_junctions_tables
  2. db/effects_tables
  3. db/main_units_tables
  4. db/unit_allowances_tables
  5. db/unit_lists_tables
  6. db/unit_to_unit_list_junctions_tables

Detailed Explanation:

db/unit_lists_tables

Create a unit list key, it is a unique key that will be used to represent all the units that will get the cap.

db/unit_to_unit_list_junctions_tables

Where you connect the or more than one main unit key to the unit list key.

db/unit_allowances_tables

This table has 3 fields:

  • Unit List is where the unit list key will be.
  • Point Cap the number that determines the starting cap amount, it can be "0".
  • Subculture serves to limit the capping of the unit to a specific subculture, if this field isn't filled all factions and cultures this unit is available will find that unit with a cap.
db/main_units_tables

In main units there are two relevant fields about shared unit caps:

  • Campaign Cap while normal caps have this field be "0" with shared caps this field must be "-1".
  • Point Allowance Weight this number determines how much does one unit weight in the cap. This is used for some of the chaos dwarf trains because they have two carriages but can be used for if you want the player to have to choose between having fewer higher tier units or lots of low tier units.
db/effects_tables

Interacting with the shared caps by adding or removing is done via effects. The most common way chaos dwarfs do this is by connecting the effect to a effect bundle and use scripting to change the cap of those units that bundle gives to the player. Because this uses effects it requires a localisation entry in a .loc file, usually the text is "Unit capacity: %+n\\nMinotaurs" with substituting minotaurs for the what represents all units in the cap.

  • Effect Create a effect key, it is a unique key that will be used to represent the process of adding and removing from the cap.
  • Icon and Icon Negative are usually "unit_capacity.png".
  • Priority is usually high 1 or 2 the lower the number the higher it will show up to the player when they look at the effect.
  • Category is "campaign".
  • Is Positive Value Good set to "true".
db/effect_bonus_value_unit_list_junctions_tables

This table connects the unit list key to the effect key. It has three fields:

  • Bonus Value Id is "unit_allowance_point_cap_mod".
  • Unit List is the unit list key. One Unit list can be referenced by several effects.
  • Effect is the effect key. One effect can have several unit lists.

Final Notes:

Shared caps overwrite the normal caps. Tried to do shared caps for both types of tomb guard and it overwrites the caps of vanilla. A new effect is still needed to be given to the same building.