Results 1 to 6 of 6

Thread: Help adding a new unit

  1. #1

    Default Help adding a new unit

    Hello all,

    Firstly, the obligatry apology if I've posted this in the wrong place. It's my first post and there are so many subforums I got confused!

    I've been trying to make a new unit for Medieval 2. I want to make a unit called Italian Pike Militia, to replace the existing Pike Militia that the Italian factions (Milan, Venice, Sicily and Papal States) can recruit as I find it strange that these factions get more powerful 'Italian' versions of the standard Town and Spear militia, but have the same Pike Militia that other factions get. I have followed this guide to unpacking the game files (http://medieval2.heavengames.com/m2t...de/index.shtml) and read through what the different values in the export_units_descr file mean. I then used this guide (http://medieval2.heavengames.com/m2t...ts/index.shtml) to make a unit profile for Italian Pike Militia and alter the export_units.txt file. However when I load Medieval 2 and go to the custom battle screen the Italian Pike militia unit does not show up. What have I done wrong?

    I have added the following to the bottom of the export_descr_units file
    type Italian Pike Militia
    dictionary Italian_Pike_Militia ; Italian Pike Militia
    category infantry
    class spearmen
    voice_type Light
    banner faction main_spear
    banner holy crusade
    soldier Pike_Militia_ug1, 60, 0, 1
    attributes sea_faring, hide_forest, can_withdraw, free_upkeep_unit, pike
    formation 1.2, 1.2, 2.4, 2.4, 8, square, phalanx
    stat_health 1, 0
    stat_pri 8, 2, no, 0, 0, melee, melee_blade, piercing, spear, 25, 1
    ;stat_pri_ex 0, 0, 0
    stat_pri_attr spear, long_pike, spear_bonus_8
    stat_sec 6, 1, no, 0, 0, melee, melee_blade, piercing, sword, 25, 1
    ;stat_sec_ex 0, 0, 0
    stat_sec_attr no
    stat_pri_armour 4, 3, 0, leather
    ;stat_armour_ex 4, 5, 7, 0, 3, 0, 0, leather
    stat_sec_armour 0, 0, flesh
    stat_heat 1
    stat_ground 1, 0, 2, 0
    stat_mental 5, normal, highly_trained
    stat_charge_dist 40
    stat_fire_delay 0
    stat_food 60, 300
    stat_cost 1, 200, 125, 75, 60, 150, 4, 30
    armour_ug_levels 1, 2, 3
    armour_ug_models Pike_Militia_ug1, Pike_Militia_ug2, Pike_Militia_ug3
    ownership milan, venice, papal_states, sicily, slave
    era 0 milan, venice, papal_states, sicily
    era 1 milan, venice, papal_states, sicily
    era 2 venice, papal_states, sicily, milan
    ;unit_info 7, 0, 1

    And I have added this to the end of the export_units.txt file

    {Italian_Pike_Militia}Italian Pike Militia
    {Italian_Pike_Militia_descr}In Italy the armies are often formed by local militias, organised around city quarters and surrounding towns. Whilst service is compulsory, it tends to be short and most serving it are sustained by a strong element of civic pride. Italian pike militia have training and armour close to that of professional soldiers and can hold a defensive position very well, though they need good support.
    {Italian_Pike_Militia_descr_short} Militia pikemen with good training and armour, able to hold a position for a long time.

  2. #2
    Lusitanio's Avatar Content Staff
    Join Date
    Jan 2018
    Location
    Portugal
    Posts
    851

    Default Re: Help adding a new unit

    I think that you also have to add that unit entry in the battle_models file, don't forget to increase the number of units in the beggining by one. You can mostly just copy the data from the original pike militia. You also will need to add them to the export_descr_buildings file so that Italy may be able to recruit them in the campaign.

  3. #3

    Default Re: Help adding a new unit

    Quote Originally Posted by Lusitanio View Post
    I think that you also have to add that unit entry in the battle_models file, don't forget to increase the number of units in the beggining by one. You can mostly just copy the data from the original pike militia. You also will need to add them to the export_descr_buildings file so that Italy may be able to recruit them in the campaign.
    Thanks for the reply Lusitanio. Would you be able to walk me through altering the battle_models file?

    I will need to alter the export_descr_building file, though I want to get the unit functional first. I believe I should just need to alter the appropriate building to read recruit_pool "Italian Pike Militia" instead of recruit_pool "Pike Militia".

    I should have mentioned I am using the Steam version of the game. Does this make any difference?

  4. #4
    AntonisTheGreek's Avatar Senator
    Join Date
    Dec 2013
    Location
    Athens,Greece
    Posts
    1,344

    Default Re: Help adding a new unit

    From what I see here,you didn't add any new model into the game.You just used an existing one,so there is no need to alter the battle_models file.

    Do this:Find a file called medieval2.preference.cfg(in your game's directory).Right click it,select properties,and uncheck "read-only".Press OK,then open the file,and add this:
    Code:
    [io]
    file_first = true
    Save,close,then go again to the file's properties,and check "read-only" again.

  5. #5

    Default Re: Help adding a new unit

    Thank you Antonis, that's worked perfectly! Yes I was just wanting the to look like standard pike militia with an armour upgrade, so no new model needed. Now I need to get a unit card made up so they don't look like Rome peasants and alter the building file so they can be recruited in a campaign.

    After this I might try to make some more mercenary units available.

  6. #6
    Lusitanio's Avatar Content Staff
    Join Date
    Jan 2018
    Location
    Portugal
    Posts
    851

    Default Re: Help adding a new unit

    Quote Originally Posted by Galacien View Post
    Thank you Antonis, that's worked perfectly! Yes I was just wanting the to look like standard pike militia with an armour upgrade, so no new model needed. Now I need to get a unit card made up so they don't look like Rome peasants and alter the building file so they can be recruited in a campaign.

    After this I might try to make some more mercenary units available.
    Sorry, I misunderstood what you actually meant
    Anyway, in case you need help with making the unit recruitable in a campaign pm me and I will help you. But you will just need to copy an existing line for a different unit and change their name to what you call your new unit

Posting Permissions

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