Results 1 to 12 of 12

Thread: Quick and dirty method for enabling units for all factions

  1. #1
    /|\/|\/|\/|\/|\/|\/
    Join Date
    Jun 2005
    Posts
    10,770

    Default Quick and dirty method for enabling units for all factions

    First I need to explain that this method has one important drawback:

    This method will cause all factions using the unit to use the same textures


    OK, now I assume you read the readme for the unpacker, so you can already edit files, and the results of your editing shows up in the game.

    We're going to be editing 3 files and copying some files around. There are four steps and it doesn't matter which order we do them in.


    Step 1 - battlemodels.modeldb

    The first file we want is battle_models.modeldb and it's a notoriously horrible file to work with. The first horrible thing about it's vanilla form is it's format, and in the examples that follow I'm using a battle_models.modeldb which has been nicely rearranged. But what we're about to do is so simple that even the horrible vanilla format isn't going to get in our way.

    So here is a unit entry in battle_models.modeldb that we want to make available to everyone. Now this is amazingly easy, just change it to this:

    Code:
    11 scots_guard 
    1 3 
    61 unit_models/_Units/LN_3QPlate_HalfPlate/scots_guard_lod0.mesh 121 
    61 unit_models/_Units/LN_3QPlate_HalfPlate/scots_guard_lod1.mesh 1225 
    61 unit_models/_Units/LN_3QPlate_HalfPlate/scots_guard_lod2.mesh 6400 
    1 
    4 merc 
    92 unit_models/_Units/LN_3QPlate_HalfPlate/textures/mtw2_LN_halfplate_scotsguard_france.texture 
    92 unit_models/_Units/LN_3QPlate_HalfPlate/textures/mtw2_LN_halfplate_scotsguard_normal.texture 
    42 unit_sprites/france_Scots_Guard_sprite.spr 
    1 
    4 merc  
    68 unit_models/AttachmentSets/Final European Archer_france_diff.texture 
    68 unit_models/AttachmentSets/Final European Archer_france_norm.texture 0  
    1 
    4 None 
    16 MTW2_Fast_Bowman 
    19 MTW2_Adv_Non_Shield 1 
    19 MTW2_Bowman_Primary 1 
    18 MTW2_Sword_Primary
    Where I've typed '4 merc' is where it used to have '6 france'. Faction names now don't matter as long as we edit the EDU accordingly.


    Step 2 - export_descr_units.txt

    So now to open export_descr_units.txt. Find the entry for the unit and add mercenary_unit, on the attributes line. This is the setting that forces the game to read from the 4 merc section of our battle_models.modeldb entry.

    Code:
    type			Scots Guard
    dictionary		Scots_Guard      ; Scots Guard
    category		infantry
    class			skirmish
    voice_type		Heavy
    banner faction		main_missile
    banner holy		crusade
    soldier			Scots_Guard, 56, 0, 0.9
    officer			Dismounted_Feudal_Knights_ug1
    officer			northern_captain_early_flag
    attributes		sea_faring, hide_forest, hardy, can_withdraw, start_not_skirmishing, stakes, mercenary_unit
    move_speed_mod		0.95
    formation		1.2, 1.2, 2.4, 2.4, 3, square
    stat_health		1, 7
    stat_pri		7, 1, composite_arrow4, 160, 30, missile, melee_blade, piercing, none, 0, 1 ;level 7
    stat_pri_attr		area
    stat_sec		10, 3, no, 0, 0, melee, melee_blade, slashing, sword, 40, 1 ;level 5
    stat_sec_attr		no
    stat_pri_armour		13, 16, 0, metal
    stat_sec_armour		0, 0, flesh
    stat_heat		6
    stat_ground		1, -3, 5, 3
    stat_mental		12, disciplined, highly_trained
    stat_charge_dist	10
    stat_fire_delay		0
    stat_food		60, 300
    stat_cost		1, 3000, 300, 300, 300, 1085, 4, 200
    armour_ug_levels	4
    armour_ug_models	Scots_Guard
    ownership		all
    era 0			all
    era 1			all
    era 2			all
    recruit_priority_offset    35
    If you want you can specify individual factions instead of using 'all' on the ownership line.

    And you can also set up individual factions for custom battles on the era lines. It prevents them showing up when the player clicks 'all eras' while they're making a custom battle, which in turn saves a lot of moving files around if, for example, the unit is only to be made available to one 1 new faction.


    Step 3 - export_descr_buildings.txt

    Now we're almost done, and it's time for export_descr_buildings.txt. All we have to do here is add the factions we want to the list of those that can produce the unit.

    You don't need to see examples of this, you just need to be able to find the unit in export_descr_buildings.txt, and then literally add the name of the faction where you find other factions listed on the same line.


    Step 4 - Unit cards and Unit info pictures

    The final thing to do is to copy the unit card pictures to the '...\UI\units\merc' folder.

    And the unit info scroll pictures to the '...\UI\unit_info\merc'



    So there we have it, the whole process is extremely easy!

    And I wonder how useful it is for mods like TA:TW that only have textures for one faction... Enjoy


    ---------------------------------------------------------------------------
    Please give me feedback, criticism, tips to improve, ask questions, etc. Thanks
    Last edited by Taiji; May 13, 2010 at 07:07 AM.

  2. #2
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,123
    Blog Entries
    35

    Default Re: Quick and dirty method for enabling units for all factions

    Just to confirm: if some factions had different skins allocated in the modeldb already, will they be using the merc skin now?










  3. #3
    konny's Avatar Artifex
    Join Date
    Jul 2007
    Location
    Germania Inferior
    Posts
    3,631

    Default Re: Quick and dirty method for enabling units for all factions

    Quote Originally Posted by Taiji View Post
    Step 4 - Unit cards and Unit info pictures

    The final thing to do is to copy the unit cards, and unit info pictures, from their folders in the 'UI' folder to the new factions' folders.
    It is the merc folder, not the one of the faction.


    I indeed highly recommend this method for implementation of all units that don't have different factional skins. That way it is rather easy to lock and unlock them for different factions by using EDB only.


    Quote Originally Posted by gigantus View Post
    Just to confirm: if some factions had different skins allocated in the modeldb already, will they be using the merc skin now?
    yes.

    Team member of: Das Heilige Römische Reich, Europa Barbarorum, Europa Barbarorum II, East of Rome
    Modding help by Konny: Excel Traitgenerator, Setting Heirs to your preference
    dHRR 0.8 beta released! get it here
    New: Native America! A mini-mod for Kingdoms America

  4. #4
    /|\/|\/|\/|\/|\/|\/
    Join Date
    Jun 2005
    Posts
    10,770

    Default Re: Quick and dirty method for enabling units for all factions

    Thanks Konny, that clearly saves us a lot of effort, I don't know why it didn't occur to me last night

  5. #5
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,123
    Blog Entries
    35

    Default Re: Quick and dirty method for enabling units for all factions

    Thanks konny, wasn't sure if that was the case. Too lazy to check, we have been using that method in 1648 while getting the skins ready. How else can one have fun in between modding frenzies?










  6. #6
    /|\/|\/|\/|\/|\/|\/
    Join Date
    Jun 2005
    Posts
    10,770

    Default Re: Quick and dirty method for enabling units for all factions

    Wow, I hope that wasn't a serious question, Gigantus!... 'Priorities' buddy (Actually I'm probably no better... )

    I guess I should mention in the OP that many mods can benefit from this tutorial by using the method to set up the units only used by one faction for use by the rebel faction. Saves a lot of messing around. And when armies in the field rebel, well honestly, where do they get their new rebel unifroms from? - It's just silly to force them to change clothes

    Many times I come across that situation, DLV is covered with it. If only I had made this tutorial long before I started modding...
    Last edited by Taiji; May 11, 2010 at 11:01 AM.

  7. #7
    Opifex
    Join Date
    Feb 2005
    Location
    New York, USA
    Posts
    15,154

    Default Re: Quick and dirty method for enabling units for all factions

    I should add that I generally don't approve of shortcuts. I firmly believe in good coding practices, and they've rewarded me time and time again. This is not to say I don't appreciate your work Taiji.


    "If ye love wealth greater than liberty,
    the tranquility of servitude greater than
    the animating contest for freedom, go
    home from us in peace. We seek not
    your counsel, nor your arms. Crouch
    down and lick the hand that feeds you,
    and may posterity forget that ye were
    our countrymen."
    -Samuel Adams

  8. #8
    /|\/|\/|\/|\/|\/|\/
    Join Date
    Jun 2005
    Posts
    10,770

    Default Re: Quick and dirty method for enabling units for all factions

    This actually isn't really a 'shortcut' in that sense at all. This is just how to set up a unit with a single texture set for use by all factions. There are certainly less efficient methods to get bogged down with, but I don't think that makes this a 'shortcut'. Not so much as I think of the other methods which achieve the exact same thing via more effort as simply being incorrect. It is a case of 'careful what you ask for' though, and so the coder must understand the limits of the function.

    It is a good point to raise, SO, and I agree with your principle. So thankyou


    BTW I think a good example of a bad shortcut in battle_models.modeldb is where we see stuff like this:

    Code:
    1 1
    61 unit_models/_Units/LN_3QPlate_HalfPlate/scots_guard_lod0.mesh 6400
    Instead of this:

    Code:
    1 3
    61 unit_models/_Units/LN_3QPlate_HalfPlate/scots_guard_lod0.mesh 121 
    61 unit_models/_Units/LN_3QPlate_HalfPlate/scots_guard_lod0.mesh 1225 
    61 unit_models/_Units/LN_3QPlate_HalfPlate/scots_guard_lod0.mesh 6400
    Changing the unit detail setting changes the range at which sprites are used. If there are no ranges less than 6400 then the user is stuck with sprites at 6400.

    That's a bad shortcut.
    Last edited by Taiji; May 12, 2010 at 05:48 AM.

  9. #9
    Darkstar's Avatar Senator
    Join Date
    Feb 2007
    Location
    Massachusetts, USA
    Posts
    1,032

    Default Re: Quick and dirty method for enabling units for all factions

    Quote Originally Posted by Taiji View Post
    If you want you can specify individual factions instead of using 'all' on the ownership line.

    And you can also set up individual factions for custom battles on the era line. It prevents them showing up when the player clicks 'all eras' while they're making a custom battle, which in turn saves a lot of moving files around if, for example, the unit is only to be made available to one 1 new faction.
    To clarify this, if I set the faction ownership to all on the ownership line and then specify individual factions on the era line will the unit still show up for all factions in custom battles?

    I want to use this for AoR but don't want the AoR units to show up in custom battles.

  10. #10
    /|\/|\/|\/|\/|\/|\/
    Join Date
    Jun 2005
    Posts
    10,770

    Default Re: Quick and dirty method for enabling units for all factions

    No it will only show for the factions specified on the era line. So it sounds like you'll get exactly what you want

    Saving work on an AoR is exactly the kind of thing I thought this method should help with

  11. #11
    Darkstar's Avatar Senator
    Join Date
    Feb 2007
    Location
    Massachusetts, USA
    Posts
    1,032

    Default Re: Quick and dirty method for enabling units for all factions

    Excellent. +rep

  12. #12

    Default Re: Quick and dirty method for enabling units for all factions

    Worked like a charm for giving Hussites to the HRE. Thanks. Rep.

    O.K. so this is an old thread, but it allowed me to make my first successful edits to the battlemodels.modeldb file. After seeing a vid on yt with a "how to" unpack I came back to this game after years and finally unpacked the files. Editing them has given the game a new lease of life for me. Thanks again.
    "War is an extension of diplomacy, but by other means." Karl von Clausewitz

Posting Permissions

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