Barbarian Unit

Bóreas

The Wind of the North
Joined
Jan 5, 2004
Messages
608
Location
Here, there, everywhere
How can I change which units a barbarian camp produces? If I want it to produce, say, only this one unit I've created. Also, is it possible to control where barbarians camps spawn and their number?
 
Hi! I'm not a modder, but since nobody else replied...
I was interested in changing the behavior of barbarians and found that the code to modify is in barbarians.cpp (therefore you would need to compile the dll). It is interesting to read all the code in there, and yes, spawning more camps could be easy; for the unit spawned, code from a different cpp is called, so you could just disable that call.
Hope this gets you started :)
 
Or you could just replace one of them with the unit that you created and disable the rest in XML.

Code:
<GameData>	
     <Civilization_UnitClassOverrides>
          <Row>
                    <CivilizationType>CIVILIZATION_BARBARIAN</CivilizationType>
                    <UnitClassType>UNITCLASS_WARRIOR</UnitClassType>
                    <UnitType>UNIT_BARBARIAN_[B][COLOR="blue"]WARRIOR[/COLOR][/B]</UnitType>
          </Row>
          <Row>
                    <CivilizationType>CIVILIZATION_BARBARIAN</CivilizationType>
                    <UnitClassType>UNITCLASS_[B][COLOR="Blue"]SCOUT[/COLOR][/B]</UnitClassType>
                    <UnitType/>
          </Row>
     </Civilization_UnitClassOverrides>
</GameData>

Replace WARRIOR (in blue) with the name of the new unit that you created. If you want it to replace a different unit, then replace UNITCLASS_WARRIOR with whatever existing unit class you want for your new unit.

A lot of existing units are already disabled for the barbarian civilization but you can disable the ones that aren't already disabled by adding the code I referenced above for the SCOUT. Just replace SCOUT with the name of each unit you want to disable. You will need a separate row for each unit you want to disable. The unit is disabled by the <UnitType/> tag.

Obviously, this doesn't include any of the XML code you will need to get your new unit into the mod.
 
Top Bottom