Results 1 to 17 of 17

Thread: How to add a new unit ingame

  1. #1

    Default How to add a new unit ingame

    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
    Last edited by drking; April 25, 2011 at 12:00 PM.
    Nothing is True, Everything is Permitted
    Altaïr Ibn-La'Ahad

  2. #2
    Valkar's Avatar Senator
    Join Date
    Jun 2010
    Location
    The Netherlands,
    Posts
    1,133

    Default Re: How to add a new unit ingame

    Nice job!

  3. #3
    Squid's Avatar Opifex
    Patrician Artifex Technical Staff

    Join Date
    Feb 2007
    Location
    Frozen waste lands of the north
    Posts
    17,760
    Blog Entries
    3

    Default Re: How to add a new unit ingame

    Nice tutorial but slightly incomplete. This one Tutorial: Adding new units for beginners by ER over at the org is the one I always use, if I could bring it here I would but . . .
    Under the patronage of Roman_Man#3, Patron of Ishan
    Click for my tools and tutorials
    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe." -----Albert Einstein

  4. #4

    Default Re: How to add a new unit ingame

    Thanks for the feedback Squid, ive you would like to, you might give me some advice on how to expand this tutorial even further. Every help to make this tutorial even better is welcome
    Nothing is True, Everything is Permitted
    Altaïr Ibn-La'Ahad

  5. #5

    Default Re: How to add a new unit ingame

    good tutorual,...

    One thing:
    It is also important to give units sounds.
    Sorry for my English...

    top 10 favourite mods: RTRVII, RSII, 300WOS, LOTRTW, FATW, HCT, EB, ROP, ARISTEIA, IBFD

  6. #6
    Antiokhos Euergetes's Avatar Protector Domesticus
    Join Date
    Sep 2011
    Location
    Antiokheia
    Posts
    4,274

    Default Re: How to add a new unit ingame

    I think I understand, but how does this, for example, add a different model/skin from another mod. Which part adds the new model?

  7. #7
    Raritу's Avatar Glück auf!
    Artifex

    Join Date
    Aug 2010
    Location
    Veltins Arena
    Posts
    2,464

    Default Re: How to add a new unit ingame

    You can add new models by making new entries in descr_model_battle.txt, or changing from an available one.

    For example from the OP:

    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

    The bold red parts are the model of the unit, and bold blue's are texture/skin of the model. You can change them with the name of your files.
    Honored filly of M and happily taking my glance over Milner and Diamat

  8. #8
    Antiokhos Euergetes's Avatar Protector Domesticus
    Join Date
    Sep 2011
    Location
    Antiokheia
    Posts
    4,274

    Default Re: How to add a new unit ingame

    Thankyou, so if I wanted to add a unit from mod A...I would copy the bold part and add to mod B ?
    Thank you have some REP

  9. #9
    Raritу's Avatar Glück auf!
    Artifex

    Join Date
    Aug 2010
    Location
    Veltins Arena
    Posts
    2,464

    Default Re: How to add a new unit ingame

    Indeed you would. Also, you'll need to copy the model and texture of that unit from mod A to mod B's suitable folder.
    Honored filly of M and happily taking my glance over Milner and Diamat

  10. #10
    Antiokhos Euergetes's Avatar Protector Domesticus
    Join Date
    Sep 2011
    Location
    Antiokheia
    Posts
    4,274

    Default Re: How to add a new unit ingame

    Excellent...and where would I find that? oh and thanks for being so helpful

  11. #11
    Raritу's Avatar Glück auf!
    Artifex

    Join Date
    Aug 2010
    Location
    Veltins Arena
    Posts
    2,464

    Default Re: How to add a new unit ingame

    Hm, to make it more simple, without copying files and all, perhaps you should just copy the DMB entry of the model from mod A to mod B.

    It's really no problem at all. I just find it quite hard to explain if you have yet to know how to add an unit in game, which might give you an idea or two about porting units.
    Squid posted a link in a few posts above. That's a very helpful tutorial for new modders to learn
    Honored filly of M and happily taking my glance over Milner and Diamat

  12. #12

    Default Re: How to add a new unit ingame

    Quote Originally Posted by Raritу View Post
    Hm, to make it more simple, without copying files and all, perhaps you should just copy the DMB entry of the model from mod A to mod B.

    It's really no problem at all. I just find it quite hard to explain if you have yet to know how to add an unit in game, which might give you an idea or two about porting units.
    Squid posted a link in a few posts above. That's a very helpful tutorial for new modders to learn
    what if I want to change the look of an existing unit but not add a new unit? Example, Spartan in RTW to a better looking one perhaps a Greek Hopelite from BI. Or Hastati from RTW to one of the very many excellent ones to choose from on this site.
    I am not a modder, so I am unfamiliar with the basics, I hope its ok to ask that on this thread.
    Ordoprinceps
    Semper Ferox

  13. #13
    Antiokhos Euergetes's Avatar Protector Domesticus
    Join Date
    Sep 2011
    Location
    Antiokheia
    Posts
    4,274

    Default Re: How to add a new unit ingame

    please delete double post
    Last edited by Antiokhos Euergetes; August 27, 2012 at 03:12 AM.

  14. #14
    Antiokhos Euergetes's Avatar Protector Domesticus
    Join Date
    Sep 2011
    Location
    Antiokheia
    Posts
    4,274

    Default Re: How to add a new unit ingame

    Quote Originally Posted by Raritу View Post
    Hm, to make it more simple, without copying files and all, perhaps you should just copy the DMB entry of the model from mod A to mod B.

    It's really no problem at all. I just find it quite hard to explain if you have yet to know how to add an unit in game, which might give you an idea or two about porting units.
    Squid posted a link in a few posts above. That's a very helpful tutorial for new modders to learn
    Well I think I got just need to know which. folders to find models and textures. My plan is to add RTR and RSII units to the 77bc mod http://www.twcenter.net/forums/showt...7#post11915747 to give it a face lift...I have received permissions. just have to attempt it one unit at a time

  15. #15

    Default Re: How to add a new unit ingame

    This tutorial was more than crystal clear to me! Thanks for the excellent tutorial. 5/5.

    "It's me, Smeagol."
    Spoiler Alert, click show to read: 

  16. #16

    Default Re: How to add a new unit ingame

    hi drking and all people.

    I added the unit 'roman wardogs' (with the roman handlers) in my EB mod.
    The friend Ludens once gave me a warning:


    keep in mind that R:TW has limit to the number of units and models it allows, and EB1 is already very close to those limits.


    well, he was right


    i followed all the given instructions and added Roman wardogs (plus the roman_handler)


    but at the moment to play. it crashed and show_err told me that there were too many units


    so i tried to delete 2 units (belgae taramonnos and celtic cavalry myrcharn); and i went on and on deleting ALL the connected files i could find (while i passed through crash after crash).


    but in the end, i got:
    ''DATABASE_TABLE error found: unrecognized record id belgae cavalry taramonnos requested.''


    then, i surrended. :wall:

    the more i delete, the more still remain....



    SO, now i ask exactly the opposite:


    how can i delete/uninstall some units to give space to the new ones? is there any tutorial about it?


    thx again

  17. #17

    Default Re: How to add a new unit ingame

    I did exactly,but got this error message DATA_BASE_TABLET ERROR max records exceeded from file


    Could anyone help?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •