Need help to create special unit capacity

Optik

Chieftain
Joined
Mar 24, 2011
Messages
75
Location
France
I try to create a slave unit with a similar ability to an engineer but with many restrictions.
This unit could give only +1:c5production: or +2 :c5production: in a city instantly (like engineer's ability).First, witch lines give this instanly capacity:<WorkRate></WorkRate>,<BaseHurry></BaseHurry>,<HurryMultiplier></HurryMultiplier>?

I was trying two different method without success. First created it as a new unit with a UnitClasses.xml and Units.xml, and make pop one as free unit to see what it might look like, but nothing pop.
Spoiler :
UnitClasses.xml:
<GameData>
<UnitClasses>
<row>
<Type>UNITCLASS_SLAVE</Type>
<Description>TXT_KEY_UNIT_SLAVE</Description>
<DefaultUnit>UNIT_SLAVE</DefaultUnit>
</row>
</UnitClasses>
</GameData>

Units.xml:
<Units>
<Row>
<Class>UNITCLASS_SLAVE</Class>
<Type>UNIT_SLAVE</Type>
<Cost>-1</Cost>
<Moves>2</Moves
<CivilianAttackPriority>CIVILIAN_ATTACK_PRIORITY_HIGH</CivilianAttackPriority>
<Special>SPECIALUNIT_PEOPLE</Special>
<Domain>DOMAIN_LAND</Domain>
<DefaultUnitAI>UNITAI_ENGINEER</DefaultUnitAI>
<Description>TXT_KEY_UNIT_SLAVE</Description>
<Civilopedia>TXT_KEY_CIV5_SLAVE_TEXT</Civilopedia>
<Strategy>TXT_KEY_UNIT_SLAVE_STRATEGY</Strategy>
<AdvancedStartCost>-1</AdvancedStartCost>
<WorkRate>1</WorkRate>
<CombatLimit>0</CombatLimit>
<BaseHurry>20</BaseHurry>
<HurryMultiplier>2</HurryMultiplier>
<UnitArtInfo>ART_DEF_UNIT__WORKER</UnitArtInfo>
<UnitArtInfoEraVariation>true</UnitArtInfoEraVariation>
<UnitFlagIconOffset>1</UnitFlagIconOffset>
<IconAtlas>UNIT_ATLAS_1</IconAtlas>
<PortraitIndex>1</PortraitIndex>
</Row>
</Units>

<Unit_AITypes>
<Row>
<UnitType>UNIT_SLAVE</UnitType>
<UnitAIType>UNITAI_ENGINEER</UnitAIType>
</Row>
</Unit_AITypes>
<Unit_Flavors>
<Row>
<UnitType>UNIT_SLAVE</UnitType>
<FlavorType>FLAVOR_PRODUCTION</FlavorType>
<Flavor>1</Flavor>
</Row>
</Unit_Flavors>


Next , i create it with specialist references and I got a setller O_o
Spoiler :

Specialist.xml:
<Specialists>
<Row>
<Type>SPECIALIST_SLAVE</Type>
<Description>TXT_KEY_SPECIALIST_SLAVE</Description>
<Strategy>TXT_KEY_SPECIALIST_SLAVE_STRATEGY</Strategy>
<GreatPeopleTitle>TXT_KEY_SPECIALIST_SLAVE_TITLE</GreatPeopleTitle>
<Visible>true</Visible>
<Cost>0</Cost>
<GreatPeopleUnitClass>UNITCLASS_SLAVE</GreatPeopleUnitClass>
<GreatPeopleRateChange>-1</GreatPeopleRateChange>
<IconAtlas>UNIT_ATLAS_1</IconAtlas>
<PortraitIndex>1</PortraitIndex>
</Row>
</Specialists>
<SpecialistYields>
<Row>
<SpecialistType>SPECIALIST_SLAVE</SpecialistType>
<YieldType>YIELD_PRODUCTION</YieldType>
<Yield>1</Yield>
</Row>
</SpecialistYields>
<Language_en_US>
<Row Tag="TXT_KEY_SPECIALIST_SLAVE">
<Text>Slave</Text>
</Row>
</Language_en_US>
</GameData>


The ultimate goal of this unit is to be captured after killing an enemy unit (with a rate %). Once returned to the city it can be used to instantly add +1:c5production: at the current production.That's a concept that I had seen in a BTS mod.
Maybe lua's will be helpful but it's only been two weeks that I started reading Kael's guide... and no experience with lua.
 
A few notes:
1> <WorkRate> is the speed at which a worker builds farms, mines, etc., with 100 being the normal speed for a Worker. The other two you changed adjust how much you get when you sacrifice the unit to hurry production.

2> If it's creating a Settler, then that means your Unit Class wasn't being created correctly. Does the unit show up on the list in FireTuner? (Map tab, try using the Unit Plopper.) Does it show up in the Civilopedia? If you give it a tech (say, Agriculture), does it show up in the tech tree? These are the ways you debug this sort of thing.

2a> If the unit class isn't being loaded at all, then that means there's an error in your first file somewhere. A failure anywhere in the file will cause the whole thing to not load, so it could be any part.
First thing I see, change the <row> to <Row> and </row> to </Row> in the UnitClasses table. Yes, some things are case-sensitive.

2b> If your first reaction to #2 was "What's FireTuner?" then stop now and go learn that first. It is THE main debugging tool for modding, and also has all of the cheat features you need for testing, like the ability to place units on the map wherever you want.
 
If you give it a tech (say, Agriculture)
<row> to <Row> and </row> to </Row> in the UnitClasses table.
:goodjob:
Thanks! The unit appears in the city now with the good capacity.
<BaseHurry>10</BaseHurry>
<HurryMultiplier>1</HurryMultiplier>
give +2:c5production:
The unit appears in Civilopedia.

I read some stuff on Fireturner, but I don't know anything about this program :confused:

I need to learn a little about lua now, create a event like: when localplayer kill a unit -> give localplayer a unit. (with a 50% rate maybe)...

Thanks again Spatzimaus, you help me already twice :goodjob:
 
Back
Top Bottom