Since there are alot of questions on forums of: "how to add new units", i thought about making a small, easily understandable but right tutorial on how to add new units ingame
For this tutorial, we will add a complete new unit to the game. This unit will be the Italian Hoplite from King Louise Assurbanipal (sorry for spell Errors)
Remember: ALWAYS make back-ups of something you are going to edit
First, we will strat with the export_descr_unit txt folder.
type greek levy pikemen
dictionary greek_levy_pikemen ; Levy Pikemen
category infantry
class spearmen
voice_type Light_1
soldier greek_levy_pikeman, 60, 0, 1
attributes sea_faring, hide_forest, can_sap
formation 1, 1, 2, 2, 8, square, phalanx
stat_health 1, 0
stat_pri 6, 2, no, 0, 0, melee, blade, piercing, spear, 25 ,1
stat_pri_attr spear, long_pike, spear_bonus_8
stat_sec 3, 1, no, 0, 0, melee, simple, piercing, sword, 25 ,1
stat_sec_attr no
stat_pri_armour 0, 3, 2, flesh
stat_sec_armour 0, 0, flesh
stat_heat 1
stat_ground 2, 0, 0, 0
stat_mental 2, normal, highly_trained
stat_charge_dist 30
stat_fire_delay 0
stat_food 60, 300
stat_cost 1, 310, 150, 40, 50, 310
ownership macedon, seleucid
as you cane see, whe will change the coloured text with the following one:
type Italian_Hoplite
dictionary Italian_Hoplite ; Levy Pikemen
category infantry
class spearmen
voice_type Light_1
soldier Italian_Hoplite, 60, 0, 1
attributes sea_faring, hide_forest, can_sap
formation 1, 1, 2, 2, 8, square, phalanx
stat_health 1, 0
stat_pri 6, 2, no, 0, 0, melee, blade, piercing, spear, 25 ,1
stat_pri_attr spear, long_pike, spear_bonus_8
stat_sec 3, 1, no, 0, 0, melee, simple, piercing, sword, 25 ,1
stat_sec_attr no
stat_pri_armour 0, 3, 2, flesh
stat_sec_armour 0, 0, flesh
stat_heat 1
stat_ground 2, 0, 0, 0
stat_mental 2, normal, highly_trained
stat_charge_dist 30
stat_fire_delay 0
stat_food 60, 300
stat_cost 1, 310, 150, 40, 50, 310
ownership macedon, seleucid
NOTE: whe use the basic unit greek levy pikeman. whe only copy the unit entry of the greek levy pikeman but we do NOT delete it
Next, we go to the export_descr_buildings text folder, to add the new unit in our building rooster. To keep the tutorial a litle bit fast, i will add the new hoplite to the highest barrack availbable. which means the royal barracks
construction 6
cost 4800
settlement_min large_city
upgrades
{
royal_barracks
}
}
royal_barracks requires factions { seleucid, roman, macedon, }
{
capability
{
recruit "carthaginian city militia" 0 requires factions { spain, }
recruit "carthaginian infantry" 0 requires factions { spain, }
recruit "spanish scutarii" 0 requires factions { spain, }
recruit "barb infantry briton" 0 requires factions { britons, }
recruit "barb infantry dacian" 0 requires factions { dacia, }
recruit "barb infantry gaul" 0 requires factions { gauls, }
recruit "warband spear german" 0 requires factions { germans, }
recruit "barb horse archers scythian" 0 requires factions { scythia, }
recruit "warband sword briton" 0 requires factions { britons, }
recruit "warband sword gaul" 0 requires factions { gauls, }
recruit "warband axe german" 0 requires factions { germans, }
recruit "warband falx dacian" 0 requires factions { dacia, }
recruit "barb warguard gaul" 0 requires factions { gauls, }
recruit "barb warguard briton" 0 requires factions { britons, }
recruit "barb warguard dacian" 0 requires factions { dacia, }
recruit "warband dhaxe german" 0 requires factions { germans, }
recruit "warband axe scythian" 1 requires factions { scythia, }
recruit "carthaginian city militia" 0 requires factions { carthage, }
recruit "numidian javelinmen" 0 requires factions { numidia, }
recruit "carthaginian infantry" 0 requires factions { carthage, }
recruit "numidian desert warriors" 1 requires factions { numidia, }
recruit "carthaginian medium infantry" 0 requires factions { carthage, }
recruit "carthaginian heavy infantry" 0 requires factions { carthage, }
recruit "numidian legionaries" 0 requires factions { numidia, }
recruit "east hillmen" 0 requires factions { eastern, }
recruit "east infantry" 0 requires factions { eastern, }
recruit "east heavy infantry" 0 requires factions { armenia, }
recruit "east hoplite" 0 requires factions { pontus, }
recruit "east hoplite brazen shield" 0 requires factions { pontus, }
recruit "east legionary" 0 requires factions { armenia, }
recruit "egyptian nubian spearmen" 0 requires factions { egyptian, }
recruit "egyptian nile infantry" 0 requires factions { egyptian, }
recruit "egyptian infantry" 0 requires factions { egyptian, }
recruit "egyptian elite guards" 0 requires factions { egyptian, }
recruit "greek hoplite militia" 0 requires factions { greek, }
recruit "greek levy pikemen" 0 requires factions { seleucid, macedon, }
recruit "Italian_Hoplite" 0 requires factions { seleucid, macedon, }
recruit "warband falx thracian" 0 requires factions { thrace, }
recruit "greek hoplite" 1 requires factions { greek_cities, }
recruit "greek pikemen" 0 requires factions { thrace, seleucid, macedon, }
recruit "greek hoplite elite" 0 requires factions { greek_cities, }
recruit "greek royal pikemen" 0 requires factions { macedon, }
recruit "greek silver shield pikemen" 0 requires factions { seleucid, }
recruit "greek hoplite spartan" 0 requires factions { greek_cities, } and hidden_resource sparta
recruit "greek bastarnae" 0 requires factions { thrace, }
recruit "greek argyraspid" 0 requires factions { seleucid, }
recruit "roman city militia" 0 requires factions { roman, }
recruit "roman hastati" 0 requires factions { roman, } and not marian_reforms
recruit "roman infantry auxillia" 0 requires factions { roman, } and marian_reforms
recruit "roman princeps" 0 requires factions { roman, } and not marian_reforms
recruit "roman legionary cohort i" 0 requires factions { roman, } and marian_reforms
recruit "roman legionary first cohort i" 0 requires factions { roman, } and hidden_resource rome and marian_reforms
recruit "roman triarii" 1 requires factions { roman, } and not marian_reforms
recruit "roman legionary cohort ii" 0 requires factions { roman, } and marian_reforms
recruit "roman legionary first cohort ii" 0 requires factions { roman, } and hidden_resource rome and marian_reforms
recruit "roman praetorian cohort urban i" 0 requires factions { roman, } and marian_reforms
recruit "roman praetorian cohort i" 0 requires factions { roman, } and marian_reforms
}
as you cane see, the new unit is highlighted in red. the unit while be available for for macedon and seleucid empire only. however, beacause macedon doenst have the ability to build royal barrack, whe will just add there name to the above line, which is also highlighted in red.
Now that our unit is fully recruitable, whe still need to add it in our descr_model_battle txt folder, so that you wont get a CTD when using it on the battlefield. So lets open up descr_model_battle.
type greek_levy_pikeman
skeleton fs_spearman, fs_swordsman ; combat spear
indiv_range 40
texture macedon, data/models_unit/textures/unit_macedon_levy_pikeman.tga
texture seleucid, data/models_unit/textures/unit_macedon_levy_pikeman_seleucid.tga
model_flexi_m data/models_unit/unit_greek_levy_pikeman_v2_400.cas, 8
model_flexi_m data/models_unit/unit_greek_levy_pikeman_v2_300.cas, 15
model_flexi_m data/models_unit/unit_greek_levy_pikeman_v2_200.cas, 30
model_flexi data/models_unit/unit_greek_levy_pikeman_v2_100.cas, max
model_sprite seleucid, 60.0, data/sprites/seleucid_greek_levy_pikeman_sprite.spr
model_sprite macedon, 60.0, data/sprites/macedon_greek_levy_pikeman_sprite.spr
model_tri 400, 0.5f, 0.5f, 0.5f
Now, as you see, we looked up the model of greek_levy_pikeman. we will just copy this one, and change greek_levy_pikeman with Italian_Hoplite
type Italian_Hoplite
skeleton fs_spearman, fs_swordsman ; combat spear
indiv_range 40
texture macedon,data/models_unit/textures/Italian_Hoplite.tga
texture seleucid, data/models_unit/textures/Italian_Hoplite.tga
model_flexi_m data/models_unit/Italian_Hoplite.cas, 8
model_flexi_m data/models_unit/Italian_Hoplite.cas, 15
model_flexi_m data/models_unit/Italian_Hoplite.cas, 30
model_flexi data/models_unit/Italian_Hoplite.cas, max
model_sprite seleucid, 60.0, data/sprites/seleucid_greek_levy_pikeman_sprite.spr
model_sprite macedon, 60.0, data/sprites/macedon_greek_levy_pikeman_sprite.spr
model_tri 400, 0.5f, 0.5f, 0.5f
We while just replace greek_levy_pikeman with Italian_Hoplite. now the unit model is ready, and u should be able to play with your new unit.
OPTIONAL:
The Following are Optional
You may add your own unit descriptions for your new unit, or add the vanilla ones. i recommend doing this.
To add unit description, go to data/text/export_unit. in here al of the unit descritption are found. you cane easily just copy an existing one. and change the old units name with the new one. for example, you may change this:
{barb_peasant_gaul} Barbarian Peasants
{barb_peasant_gaul_descr}
Expert at Hiding in Forests\n\nPeasants are reluctant warriors, but barbarian peasants are better fighters than most: hard lives produce hard men. Numbers are useful in all armies, and forcing peasants to fight is one way of getting lots of men in the field quickly and cheaply. They have little tactical sense, and even less willingness to fight - they would rather be defending their own homes than be dragged to a battle they neither care about nor understand. They are, however, experts at reading the land and hiding when there is cover.
{barb_peasant_gaul_descr_short}
Peasants are reluctant warriors, but barbarian peasants are better fighters than most: hard lives produce hard men.
With This
{Italian_Hoplite} Barbarian Peasants
{Italian_Hoplitel_descr}
Expert at Hiding in Forests\n\nPeasants are reluctant warriors, but barbarian peasants are better fighters than most: hard lives produce hard men. Numbers are useful in all armies, and forcing peasants to fight is one way of getting lots of men in the field quickly and cheaply. They have little tactical sense, and even less willingness to fight - they would rather be defending their own homes than be dragged to a battle they neither care about nor understand. They are, however, experts at reading the land and hiding when there is cover.
{Italian_Hoplite_descr_short}
Peasants are reluctant warriors, but barbarian peasants are better fighters than most: hard lives produce hard men.
Then, you go to data/export_descr_units_enums, and copy an existing one, and replace it with you new unit one, just like the example above.
I hope this tutorial will help you guys out with adding new units
Please, give any feedback or add-ons to this tutorial, to make it even better
drking