Civ 5 mod - need help creating a new unit based on WORKER

hiramarchibald

Chieftain
Joined
Mar 15, 2012
Messages
16
I need help with getting a new unit to be able to perform build actions like a builder.

I've created a unit cut from the UNITCALSS_WORKER slot in a unit .XML file for a mod. I took the basic worker template

Spoiler :
<Row>
<Class>UNITCLASS_WORKER</Class>
<Type>UNIT_WORKER</Type>
<Cost>70</Cost>
<Moves>2</Moves>
<Capture>UNITCLASS_WORKER</Capture>
<CivilianAttackPriority>CIVILIAN_ATTACK_PRIORITY_LOW</CivilianAttackPriority>
<Domain>DOMAIN_LAND</Domain>
<DefaultUnitAI>UNITAI_WORKER</DefaultUnitAI>
<Description>TXT_KEY_UNIT_WORKER</Description>
<Civilopedia>TXT_KEY_CIV5_ANTIQUITY_WORKER_TEXT</Civilopedia>
<Strategy>TXT_KEY_UNIT_WORKER_STRATEGY</Strategy>
<Help>TXT_KEY_UNIT_HELP_WORKER</Help>
<AdvancedStartCost>20</AdvancedStartCost>
<WorkRate>100</WorkRate>
<CombatLimit>0</CombatLimit>
<UnitArtInfo>ART_DEF_UNIT__WORKER</UnitArtInfo>
<UnitArtInfoEraVariation>true</UnitArtInfoEraVariation>
<UnitFlagIconOffset>1</UnitFlagIconOffset>
<PortraitIndex>1</PortraitIndex>
<IconAtlas>UNIT_ATLAS_1</IconAtlas>
</Row>


and changed it a tiny bit to create a unit called "Artisan" that is a worker with 3 move (instead of original 2):

Spoiler :
<GameData>
<Units>
<Row>
<Class>UNITCLASS_WORKER</Class>
<Type>UNIT_Artisan</Type>
<Cost>70</Cost>
<Moves>3</Moves>
<Capture>UNITCLASS_WORKER</Capture>
<CivilianAttackPriority>CIVILIAN_ATTACK_PRIORITY_LOW</CivilianAttackPriority>
<Domain>DOMAIN_LAND</Domain>
<DefaultUnitAI>UNITAI_WORKER</DefaultUnitAI>
<Description>Artisan</Description>
<Civilopedia>Hooni workers take special pride in their native culture, moving quickly and requiring less motivation to begin their vocation.

</Civilopedia>
<Strategy>TXT_KEY_UNIT_WORKER_STRATEGY</Strategy>
<Help>TXT_KEY_UNIT_HELP_WORKER</Help>
<AdvancedStartCost>20</AdvancedStartCost>
<WorkRate>100</WorkRate>
<CombatLimit>0</CombatLimit>
<UnitArtInfo>ART_DEF_UNIT__WORKER</UnitArtInfo>
<UnitArtInfoEraVariation>true</UnitArtInfoEraVariation>
<UnitFlagIconOffset>1</UnitFlagIconOffset>
<PortraitIndex>1</PortraitIndex>
<IconAtlas>UNIT_ATLAS_1</IconAtlas>
</Row>
</GameData>


What I got was a unit that looked identical to a worker (same icons, sprites, etc.) and had 3 move and could do the autobuild function (hotkey 'A'), but had no ability to build improvements on tiles ike a worker.

I even went in at added to the unit .XML:

Spoiler :
<Row>
<UnitType>UNIT_WOKER</UnitType>
<FlavorType>FLAVOR_TILE_IMPROVEMENT</FlavorType>
<Flavor>30</Flavor>
</Row>


and added to the original Civ 5 assets/Gameplay/XML/Units/CIV5Units.xml the lines:

Spoiler :
<Row>
<Class>UNITCLASS_WORKER</Class>
<Type>UNIT_Artisan</Type>
<Cost>70</Cost>
<Moves>2</Moves>
<Capture>UNITCLASS_WORKER</Capture>
<CivilianAttackPriority>CIVILIAN_ATTACK_PRIORITY_LOW</CivilianAttackPriority>
<Domain>DOMAIN_LAND</Domain>
<DefaultUnitAI>UNITAI_WORKER</DefaultUnitAI>
<Description>TXT_KEY_UNIT_WORKER</Description>
<Civilopedia>TXT_KEY_CIV5_ANTIQUITY_WORKER_TEXT</Civilopedia>
<Strategy>TXT_KEY_UNIT_WORKER_STRATEGY</Strategy>
<Help>TXT_KEY_UNIT_HELP_WORKER</Help>
<AdvancedStartCost>20</AdvancedStartCost>
<WorkRate>100</WorkRate>
<CombatLimit>0</CombatLimit>
<UnitArtInfo>ART_DEF_UNIT__WORKER</UnitArtInfo>
<UnitArtInfoEraVariation>true</UnitArtInfoEraVariation>
<UnitFlagIconOffset>1</UnitFlagIconOffset>
<PortraitIndex>1</PortraitIndex>
<IconAtlas>UNIT_ATLAS_1</IconAtlas>
</Row>


and:

Spoiler :
<Row>
<UnitType>UNIT_Artisan</UnitType>
<FlavorType>FLAVOR_TILE_IMPROVEMENT</FlavorType>
<Flavor>30</Flavor>
</Row>


(and tried variations on the unit .xml file for the mod, trying to pull in a flavor of either WOKER or Artisan). No change.

Is there an action in a .lua file in the original Civ 5 files that I need to link to or create?

Help?

Moderator Action: Moved to the main forum.
Because the tutorials subforum is only for tutorials, not for questions ;).
 
Okay, under Units.xml you also have to go the <Unit_Builds> section, copy everything a worker can do and repaste it after changing WORKER to Artisan.
 
Back
Top Bottom