Unique units not actually unique

Sir Ramekin

Chieftain
Joined
Jul 22, 2017
Messages
4
Hey guys,
I have been working on a mod creating a new civilization. its a bit of a proof of concept mod as the civ has one of everything. ie. unique units, tile improvements, unique buildings. however when I was playing the game the unique unit was not unique! everyone had it. I am wondering how to create a unit without everyone getting it.

Thanks in advanced!
 
You will want to add the TraitType to the Units table and define that TraitType for your Civilization/Leader.
Below is an example from one of my mods... Units table:
Code:
INSERT INTO Units   
        (UnitType,                BaseMoves, Cost,     AdvisorType, BaseSightRange, ZoneOfControl, Domain, FormationClass, Name,                            Description,                            MandatoryObsoleteTech, PurchaseYield, PromotionClass, Maintenance,   Combat,    PrereqTech, TraitType)
SELECT  'UNIT_GA_TRINITARIO',    BaseMoves, 240,        AdvisorType, BaseSightRange, ZoneOfControl, Domain, FormationClass, 'LOC_UNIT_GA_TRINITARIO_NAME',    'LOC_UNIT_GA_TRINITARIO_DESCRIPTION',    MandatoryObsoleteTech, PurchaseYield, PromotionClass, Maintenance, 65,        PrereqTech, 'TRAIT_UNIT_GA_TRINITARIO'       
FROM Units WHERE UnitType = 'UNIT_MUSKETMAN';

Here is the defined Leader Trait (you can do the same for Civilization Traits):
Code:
--------------------------------------------------------------------------------------------------------------------------
-- LeaderTraits
--------------------------------------------------------------------------------------------------------------------------
INSERT INTO LeaderTraits
        (LeaderType,            TraitType)
VALUES    ('LEADER_GA_DUARTE',    'TRAIT_LEADER_GA_DUARTE_VISIONARY'),
        ('LEADER_GA_DUARTE',    'TRAIT_UNIT_GA_TRINITARIO');
 
I have attached my test modding files, I am still unsure where I need to add that code, does that add a new unit or replace the musketman? as I would like to make an entirely new unit.
 

Attachments

  • NewLeader2.zip
    57.3 KB · Views: 55
@KoubaK's examples add data using SQL. His code is equivalent to "Row" in the XML.

You can create the trait with LEADER_JASPER_KITTY by editing NewLeader_Felines.xml
  1. Add <Row Type="TRAIT_LEADER_CAT_UNIT" Kind="KIND_TRAIT"/> within Types
  2. Add <LeaderTraits></LeaderTraits> within GameInfo
  3. Add <Row LeaderType="LEADER_JASPER_KITTY" TraitType="TRAIT_LEADER_CAT_UNIT"/> within LeaderTraits
Then associate the trait with UNIT_CAT by editing NewLeader_Felines.xml. Add TraitType="TRAIT_LEADER_CAT_UNIT" after UnitType="UNIT_CAT" (before "/>").

This associates the unit with a leader. Associating the unit with the civilization is left as an exercise to the reader. :)
 
As a side note I also had to add
<Row TraitType="TRAIT_LEADER_CAT_UNIT" Name="LOC_PLACEHOLDER" Description="LOC_PLACEHOLDER" />
in <Traits></Traits> before it would work
 
Top Bottom