Page 1 of 9 12345 ... LastLast
Results 1 to 30 of 268

Thread: Tutorial - Adding a unit to the game

  1. #1
    Member Member Musashi's Avatar
    Join Date
    Nov 2002
    Location
    The Mists of Legend
    Posts
    811

    Default Tutorial - Adding a unit to the game

    Ok. This is a LONG and involved process, and it will probably be made significantly easier when CA releases a few more tools. However, this is the process required to get a new unit into the game at the current time.

    I'm going to be using a unit I created as an example throughout this process. My Byzantine Dragoons are sort of a cross between Reiters and Camel Gunners. They're nasty and very powerful, but keep in mind they're for an alternate history fantasy type mod I'm working on. This is a picture of the finished product:


    I'm also going to be assuming you've already run the unpacker.

    Step One: The Unit File

    Go into your data folder and open export_descr_unit.txt. We'll be adding a new unit block to this file. I like to keep the file somewhat organized, so I generally group my additions by type and faction and so on, but it doesn't really matter much where you place them.

    We're going to be creating a unit similar to Reiters, so the simplest thing is to start with the entry for Reiters:
    Code:
    type             Reiters
    dictionary       Reiters      ; Reiters
    category         cavalry
    class            missile
    voice_type       Heavy
    banner faction   main_cavalry
    banner holy      crusade_cavalry
    soldier          Reiters, 32, 0, 1
    mount            heavy horse
    mount_effect     elephant -4, camel -4
    attributes       sea_faring, hide_forest, hardy, can_withdraw, can_formed_charge, cantabrian_circle, gunpowder_unit, start_not_skirmishing, guncavalry
    formation        2, 4.4, 3, 6, 4, square
    stat_health      1, 0
    stat_pri         20, 3, pistol_bullet, 45, 20, missile, missile_gunpowder, piercing, none, musket_shot_set, 25, 1
    ;stat_pri_ex      0, 0, 0
    stat_pri_attr    ap
    stat_sec         11, 5, no, 0, 0, melee, melee_blade, piercing, spear, 25, 1
    ;stat_sec_ex      0, 0, 0
    stat_sec_attr    no
    stat_pri_armour  7, 6, 0, metal
    ;stat_armour_ex   7, 8, 0, 0, 6, 0, 0, metal
    stat_sec_armour  0, 0, flesh
    stat_heat        5
    stat_ground      0, -2, -4, 0
    stat_mental      9, normal, trained
    stat_charge_dist 45
    stat_fire_delay  0
    stat_food        60, 300
    stat_cost        1, 920, 250, 120, 95, 920, 4, 230
    armour_ug_levels 3, 4
    armour_ug_models Reiters, Reiters_ug1
    ownership        hre
    era 2            hre
    ;unit_info        11, 20, 13
    So what we will do is copy and paste that block into the file in another spot, and then make some small changes to it to get it exactly the way we want it.

    The first thing to do is change the type variable. This is the label the game uses for the unit internally. The main thing we need to concern ourselves with for our current purposes is that the game will try to find a unit icon based on this name.

    I've decided to call my troops Byzantine Dragoons, and the game tends to use ES_ or GR_ to designate a Byzantine unit (Although in this case I could simply call them Byzantine Dragoons, that would work just as well), so I've chosen to set the type to GR_Dragoons like so:
    Code:
    type             GR_Dragoons
    Next we have to set the Dictionary entry. The game looks for an entry in the export_units.txt.bin file in order to find the display name and description of the unit. There can't be any spaces in this entry. If I'd called my new unit "Byzantine Dragoons" I'd have had to use a dictionary entry of "Byzantine_Dragoons", or some other one word string.

    The next few lines we leave alone... It's still cavalry, still a missile troop, no need to change the voice or banners... But we do need to change the Soldier entry.

    Experience modding the model db file allows me to say with certainty that the soldier type sets the skeleton and animation sets, while the model and textures are taken from the armour_ug_models line. Technically we could leave the soldier line alone, since we're going to be using the Reiters' animation set. But just for the sake of continuity I'm setting it to GR_Dragoons like so:
    Code:
    soldier          GR_Dragoons, 32, 0, 1
    I also changed the "mount" entry, because I wanted to have them riding the Kataphractoi's horses, but it didn't take. I'll be looking into this later.

    The next thing I changed was the "stat_pri" line. This sets the stats of the primary weapon, in this case, a musket. I didn't want this unit to be an exact clone of the Reiters, rather I wanted it to be a long range skirmisher like the Camel Gunners, so I copied the line from the Camel Gunners' entry.

    I wanted their secondary weapon and armor to match Reiters, so I didn't change any of that. Basically I went all the way down to the armour_ug_models line before making any more changes. This is critical because if we don't change this line, the game is going to look in the model db file for Reiters models, and not find any texture entries for byzantium, and we'll end up with invisible troops even though we did all the hard Model DB work.

    In the end, the entry for my new unit looks like this:
    Code:
    type             GR_Dragoons
    dictionary       GR_Dragoons      ; Byzantine Dragoons
    category         cavalry
    class            missile
    voice_type       Heavy
    banner faction   main_cavalry
    banner holy      crusade_cavalry
    soldier          GR_Dragoons, 32, 0, 1
    mount            eastern armoured horse
    mount_effect     elephant -4, camel -4
    attributes       sea_faring, hide_forest, hardy, can_withdraw, can_formed_charge, cantabrian_circle, gunpowder_unit, start_not_skirmishing, guncavalry
    formation        2, 4.4, 3, 6, 4, square
    stat_health      1, 0
    stat_pri         16, 3, musket_bullet, 180, 20, missile, missile_gunpowder, piercing, none, musket_shot_set, 25, 1
    ;stat_pri_ex      0, 0, 0
    stat_pri_attr    ap
    stat_sec         11, 5, no, 0, 0, melee, melee_blade, piercing, spear, 25, 1
    ;stat_sec_ex      0, 0, 0
    stat_sec_attr    no
    stat_pri_armour  7, 6, 0, metal
    ;stat_armour_ex   7, 8, 0, 0, 6, 0, 0, metal
    stat_sec_armour  0, 0, flesh
    stat_heat        5
    stat_ground      0, -2, -4, 0
    stat_mental      9, normal, trained
    stat_charge_dist 45
    stat_fire_delay  0
    stat_food        60, 300
    stat_cost        1, 920, 250, 120, 95, 920, 4, 230
    armour_ug_levels 3, 4
    armour_ug_models GR_Dragoons, GR_Dragoons_ug1
    ownership        byzantium
    era 2            byzantium
    ;unit_info        11, 20, 13
    Step Two: The EEEEVIL Model DB File

    Now it's time to move on to the next, and hardest step. Coding an entry in the data/unit_models/battle_models.modeldb file, which was obviously never meant to be alterable by hand.

    Be aware that this file ONLY works in the base data/unit_models folder and will NOT work from a mod folder. This obviously has unfortunate implications for our ability to allow mod users to maintain multiple mod installations simultaneously, but there's basically nothing we can do about it until CA gives us some manner of fix or workaround.

    You will need to add --io.file_first to your batch file to get it working.

    What you do is you open the file in notepad. It will look like chaos to the untrained eye (And even to the trained eye it's a royal... erm... well you get the idea).

    Since our unit will actually be using the Reiter model with different textures, prudence dictates that we start by copying the entry for Reiters:
    Code:
    7 reiters 1 4 53 unit_models/_Units/RN_Half_3Q_Plate/reiters_lod0.mesh 121 53 unit_models/_Units/RN_Half_3Q_Plate/reiters_lod1.mesh 900 53 unit_models/_Units/RN_Half_3Q_Plate/reiters_lod2.mesh 2500 53 unit_models/_Units/RN_Half_3Q_Plate/reiters_lod3.mesh 6400 1 3 hre 73 unit_models/_Units/RN_Half_3Q_Plate/textures/rn_half_3q_plate_hre.texture 76 unit_models/_Units/RN_Half_3Q_Plate/textures/rn_half_3q_plate_normal.texture 35 unit_sprites/hre_Reiters_sprite.spr 1 3 hre 65 unit_models/AttachmentSets/Final European CB Gun_hre_diff.texture 65 unit_models/AttachmentSets/Final European CB Gun_hre_norm.texture 0  1 5 Horse 14 MTW2_HR_Pistol 13 MTW2_HR_Spear 1 22 MTW2_HR_Pistol_Primary 1 21 MTW2_HR_spear_Primary 16 -0.090000004 0 0 -0.34999999 0.80000001 0.60000002 11 reiters_ug1 1 4 57 unit_models/_Units/RN_Half_3Q_Plate/reiters_ug1_lod0.mesh 121 57 unit_models/_Units/RN_Half_3Q_Plate/reiters_ug1_lod1.mesh 900 57 unit_models/_Units/RN_Half_3Q_Plate/reiters_ug1_lod2.mesh 2500 57 unit_models/_Units/RN_Half_3Q_Plate/reiters_ug1_lod3.mesh 6400 1 3 hre 73 unit_models/_Units/RN_Half_3Q_Plate/textures/rn_half_3q_plate_hre.texture 76 unit_models/_Units/RN_Half_3Q_Plate/textures/rn_half_3q_plate_normal.texture 39 unit_sprites/hre_Reiters_ug1_sprite.spr 1 3 hre 65 unit_models/AttachmentSets/Final European CB Gun_hre_diff.texture 65 unit_models/AttachmentSets/Final European CB Gun_hre_norm.texture 0  1 5 Horse 14 MTW2_HR_Pistol 13 MTW2_HR_Spear 1 22 MTW2_HR_Pistol_Primary 1 21 MTW2_HR_spear_Primary 16 -0.090000004 0 0 -0.34999999 0.80000001 0.60000002
    Ugly, isn't it?

    So what can we make of all this? Let's take it one step at a time.

    The first thing to remember is that almost every entry in the file is in the format of "n xxxxx" where n is the number of characters in the string that follows it, and xxxxx is the string.

    Our first entry is "7 reiters". That's 7, the number of characters in the word reiters, and then the word itself. Personally I assume they are using some sort of serialization library that reads all these values into dynamically allocated memory, using the string length numbers to know how many characters to read in, and then looking for another string length directive. But that's really only interesting to nerds like me ;)

    The next entry is "1 4". 4 is naturally a one character string. What this represents is the number of LOD entries the game should be trying to load. This is only really important to know if you're changing the actual meshes for a unit (But it did bite me in the butt once, which is naturally how I figured out what the number does hehe).

    The next three entries:
    Code:
    53 unit_models/_Units/RN_Half_3Q_Plate/reiters_lod0.mesh 121 53 unit_models/_Units/RN_Half_3Q_Plate/reiters_lod1.mesh 900 53 unit_models/_Units/RN_Half_3Q_Plate/reiters_lod2.mesh 2500 53 unit_models/_Units/RN_Half_3Q_Plate/reiters_lod3.mesh 6400
    These are meshes to use at various distances from the unit. Note the mesh string, and then the distance. It's fairly straightforward.

    Next up is the start of an actual texture block.
    Code:
    1 3 hre 73 unit_models/_Units/RN_Half_3Q_Plate/textures/rn_half_3q_plate_hre.texture 76 unit_models/_Units/RN_Half_3Q_Plate/textures/rn_half_3q_plate_normal.texture 35 unit_sprites/hre_Reiters_sprite.spr
    The 1 is the number of texture blocks it should try to read in. The easiest way to think of this is just as the number of factions who can use the unit. In the case of Reiters, only the HRE can use this soldier type, so the number is one, and there is only one texture block.

    3 is the number of letters in the name of the faction the following texture block is for. In this case, the HRE. hre is of course the faction name. This is followed by the length of the next string, which will be the path of the texture which should be used for this unit when it is being employed by the given faction. The next path is to what I think is some kind of alpha map or transparency guide. Don't worry, there's one in every texture directory, so just link to the one that corresponds to the model and texture you're attempting to use.

    The last path is to the sprite file, which is used to render the unit when it's farther away than the distance set for the lowest LOD.

    The next block of code is this:
    Code:
    1 3 hre 65 unit_models/AttachmentSets/Final European CB Gun_hre_diff.texture 65 unit_models/AttachmentSets/Final European CB Gun_hre_norm.texture 0  1 5 Horse 14 MTW2_HR_Pistol 13 MTW2_HR_Spear 1 22 MTW2_HR_Pistol_Primary 1 21 MTW2_HR_spear_Primary 16 -0.090000004 0 0 -0.34999999 0.80000001 0.60000002
    This is a set of attachments your unit uses. I'm not really 100% sure what any of this stuff does, except that you need to start this block with the number of such blocks it's reading in (Again, the number of factions that use the unit), and the faction name in the usual length-string format.

    And as you can see the whole thing is repeated for the armor upgrade model(s).

    Now lets see what this looks like after we edit it for our new unit (My personal suggestion is to copy the whole block, paste it into a separate notepad window, edit it there, and then paste it back into the file. Be SURE that when you paste it back in, you put the block at the end of another block, and have a single space at both ends).

    Code:
    11 GR_Dragoons 1 4 53 unit_models/_Units/RN_Half_3Q_Plate/reiters_lod0.mesh 121 53 unit_models/_Units/RN_Half_3Q_Plate/reiters_lod1.mesh 900 53 unit_models/_Units/RN_Half_3Q_Plate/reiters_lod2.mesh 2500 53 unit_models/_Units/RN_Half_3Q_Plate/reiters_lod3.mesh 6400 1 9 byzantium 79 unit_models/_Units/RN_Half_3Q_Plate/textures/rn_half_3q_plate_byzantium.texture 76 unit_models/_Units/RN_Half_3Q_Plate/textures/rn_half_3q_plate_normal.texture 41 unit_sprites/byzantium_Reiters_sprite.spr 1 9 byzantium 65 unit_models/AttachmentSets/Final European CB Gun_hre_diff.texture 65 unit_models/AttachmentSets/Final European CB Gun_hre_norm.texture 0  1 5 Horse 14 MTW2_HR_Pistol 13 MTW2_HR_Spear 1 22 MTW2_HR_Pistol_Primary 1 21 MTW2_HR_spear_Primary 16 -0.090000004 0 0 -0.34999999 0.80000001 0.60000002 11 reiters_ug1 1 4 57 unit_models/_Units/RN_Half_3Q_Plate/reiters_ug1_lod0.mesh 121 57 unit_models/_Units/RN_Half_3Q_Plate/reiters_ug1_lod1.mesh 900 57 unit_models/_Units/RN_Half_3Q_Plate/reiters_ug1_lod2.mesh 2500 57 unit_models/_Units/RN_Half_3Q_Plate/reiters_ug1_lod3.mesh 6400 1 9 byzantium 79 unit_models/_Units/RN_Half_3Q_Plate/textures/rn_half_3q_plate_byzantium.texture 76 unit_models/_Units/RN_Half_3Q_Plate/textures/rn_half_3q_plate_normal.texture 45 unit_sprites/byzantium_Reiters_ug1_sprite.spr 1 9 byzantium 65 unit_models/AttachmentSets/Final European CB Gun_hre_diff.texture 65 unit_models/AttachmentSets/Final European CB Gun_hre_norm.texture 0  1 5 Horse 14 MTW2_HR_Pistol 13 MTW2_HR_Spear 1 22 MTW2_HR_Pistol_Primary 1 21 MTW2_HR_spear_Primary 16 -0.090000004 0 0 -0.34999999 0.80000001 0.60000002
    As you can see, a few changes have been made. I kept the meshes, because I want to use the Reiter models. I've changed the faction name, and the texture as well. Note that there is no unit_models/_Units/RN_Half_3Q_Plate/textures/rn_half_3q_plate_byzantium.texture , so we'll have to create one. If you read through the section above you should be able to see what's been changed and why.

    Step Three: Texture Alteration

    So, now we have to create our texture! No wait... it's not quite as hard as it sounds.

    First you go to unit_models/_Units/RN_Half_3Q_Plate/textures. In here you'll see textures for this model type for a bunch of different factions. What you need to do is open one, say rn_half_3q_plate_england.texture, with a hex editor, and cut (Cut to the clipboard, you're going to need to paste it back in later) the first 48 bytes. Now rename the file from .texture to .dds, and load it up in your favorite image processing software. I'm going to be talking about how to work with it in Photoshop CS2, because that's what I own.

    What you do now is turn all those areas of British red into Byzantine purple. The way we do that is to go to image->adjustments->replace color, and use the cursor to select a bright red spot. Now use the HSB sliders on the bottom to adjust that bright red to a bright purple. Now adjust the threshold slider at the top until the image looks the way you want it. Presto!

    If you're anal you can work your faction emblem into it the purple fields now, but it will look good as is. Just save the file, change the file extension back to .texture, and paste those 48 bytes back into the beginning of the file.

    You can now start the game and use your new unit in custom games! Aren't you proud of yourself?

    You might notice there are some things missing though. Like their icon looks like a peasant, and when you mouse over the unit it says "unlocalized placement text". We should probably fix that huh?

    Of course we should!

    Step Four: Giving Your Unit An Icon

    So go to data/ui/units/hre and copy #reiters.tga over to the data/ui/units/byzantium folder, and rename it #gr_dragoons.tga. Optionally you can go in and color parts of the icon purple. It's up to you.

    Your unit now has it's very own shiny icon!

    All that's left is the text.

    Step Five: Editing the Unit Text File

    So, what you're going to do is get Alpaca's txt.bin converter from the thread here in this forum, place it in your data/text folder, and run it!

    Now you can edit export_units.txt. Just copy the entry for some other unit, Reiters for instance, and change the labels.

    In other words copy and paste this:
    Code:
    {Reiters}	Reiters
    {Reiters_descr}	Reiters derive their name from the German word reiter, meaning horseman. Generally from German states, Reiters are armed with a pistol and spear, and well protected by plate armour. They often employ the shooting circle tactic to create a continuous cycle of firing and reloading. Once the enemy are softened up by this treatment, they charge in and finish them off the old fashioned way.
    {Reiters_descr_short}	Effective gunpowder units, Reiters are armed with a pistol and spear, and protected by plate armour.
    And change it to this:
    Code:
    {GR_Dragoons}	Reiters
    {GR_Dragoons_descr}	Reiters derive their name from the German word reiter, meaning horseman. Generally from German states, Reiters are armed with a pistol and spear, and well protected by plate armour. They often employ the shooting circle tactic to create a continuous cycle of firing and reloading. Once the enemy are softened up by this treatment, they charge in and finish them off the old fashioned way.
    {GR_Dragoons_descr_short}	Effective gunpowder units, Reiters are armed with a pistol and spear, and protected by plate armour.
    And you're all finished.

    You might want to change the actual text to something more appropriate of course. But my fingers are getting tired from typing all this.

    Thank you for flying Musashi mod lines, we hope you have a pleasant modding experience.
    Last edited by Musashi; 12-22-2006 at 01:24. Reason: Added Unit Portrait + Info about DB file
    Fear nothing except in the certainty that you are your enemy's begetter and its only hope of healing. For everything that does evil is in pain.
    -The Maestro Sartori, Imajica by Clive Barker

  2. #2
    the G-Diffuser Senior Member pevergreen's Avatar
    Join Date
    Nov 2006
    Location
    Brisbane, Australia
    Posts
    11,585
    Blog Entries
    2

    Default Re: Tutorial - Adding a unit to the game

    Clap clap clap etc. Great work there! Will help many a budding modder.
    Quote Originally Posted by TosaInu
    The org will be org until everyone calls it a day.

    Quote Originally Posted by KukriKhan View Post
    but I joke. Some of my best friends are Vietnamese villages.
    Quote Originally Posted by Lemur
    Anyone who wishes to refer to me as peverlemur is free to do so.

  3. #3
    Member Member Musashi's Avatar
    Join Date
    Nov 2002
    Location
    The Mists of Legend
    Posts
    811

    Default Re: Tutorial - Adding a unit to the game

    Thanks... it only took me... 2 and a half hours or so to type it all up and edit it... O.o
    Fear nothing except in the certainty that you are your enemy's begetter and its only hope of healing. For everything that does evil is in pain.
    -The Maestro Sartori, Imajica by Clive Barker

  4. #4

    Default Re: Tutorial - Adding a unit to the game

    Excellent work Musashi!

    Might I suggest an alternate name, albeit not historical or correct name? Byzantine Dragonarioi. What do you think?

    Cataphract Of The City

  5. #5
    Member Member Varyar's Avatar
    Join Date
    Aug 2003
    Location
    Europe
    Posts
    50

    Default Re: Tutorial - Adding a unit to the game

    A question: which of these steps do you need to undertake to simply make an already existent unit available to a new faction? In my case I want to give the Naffatun to the Moors. I don't even care about the texture as long as the guys are there and visible.
    Yalla! My Sultan wishes you dead!

  6. #6
    Member Member the_mango55's Avatar
    Join Date
    Apr 2004
    Location
    Raleigh, North Carolina
    Posts
    94

    Default Re: Tutorial - Adding a unit to the game

    Yeah, I can't get this to work >.<

    Good info though.

    I'm pretty sure its the Model file that's getting me screwed up, because I have created new units for factions by putting mounted unit from one faction on another mount from the same faction, changing the stats, text files, and unit info.



    Do you have to do this in the base game, in a mod folder, or can you do it in either (I have tried both and neither worked)

    BTW, can you post a screenshot of your unit?
    "You're drunk again!"
    "Na Im just exhausted from staying up all night drinking!" - Family guy

  7. #7
    Amphibious Trebuchet Salesman Member Whacker's Avatar
    Join Date
    Nov 2006
    Location
    in ur city killin ur militias
    Posts
    2,934

    Default Re: Tutorial - Adding a unit to the game

    Outstanding work Musashi, we need more stuff like this. I think I might throw these guys in my next campaign as the Byzantines just for giggles.

    PS: @the_mango55, greetings fellow RDU resident.

    "Justice is the firm and continuous desire to render to everyone
    that which is his due."
    - Justinian I

  8. #8
    Member Member Musashi's Avatar
    Join Date
    Nov 2002
    Location
    The Mists of Legend
    Posts
    811

    Default Re: Tutorial - Adding a unit to the game

    Quote Originally Posted by the_mango55
    Yeah, I can't get this to work >.<

    Good info though.

    I'm pretty sure its the Model file that's getting me screwed up, because I have created new units for factions by putting mounted unit from one faction on another mount from the same faction, changing the stats, text files, and unit info.

    Do you have to do this in the base game, in a mod folder, or can you do it in either (I have tried both and neither worked)

    BTW, can you post a screenshot of your unit?
    Mango, I forgot to mention it. The battle_models.modeldb file will only be parsed in the BASE data/unit_models folder. To get the game to parse it you have to add --io.file_first to your command line or batch file.

    Naturally this has... disturbing... implications for our users' ability to install multiple mods at once :(

    I should point out though, that if you're just using an existing model and a different mount, there's an easier way to do it. Basically it can be done with just the EDU file. Just set the mount, soldier, and upgrade lines in your unit's entry in the EDU file to what you want them to be... No need to create a whole new model entry in the DB file unless you're trying to use a model that doesn't have textures for your faction :)
    Last edited by Musashi; 12-22-2006 at 00:36.
    Fear nothing except in the certainty that you are your enemy&#39;s begetter and its only hope of healing. For everything that does evil is in pain.
    -The Maestro Sartori, Imajica by Clive Barker

  9. #9
    Member Member Musashi's Avatar
    Join Date
    Nov 2002
    Location
    The Mists of Legend
    Posts
    811

    Default Re: Tutorial - Adding a unit to the game

    Quote Originally Posted by Varyar
    A question: which of these steps do you need to undertake to simply make an already existent unit available to a new faction? In my case I want to give the Naffatun to the Moors. I don't even care about the texture as long as the guys are there and visible.
    Well, since Naffatun don't have an entry in the model DB file for the moors, you'll have to either change the lines for the Turks to be for the Moors by changing the faction name (You're in luck, in that they're the same number of letters, so you can literally just change where you see "Turks" to "Moors"), or add texture lines for the Moors. The problem with changing the Turks lines, is that the Naffatun will become invisible when the Turks field them.
    Fear nothing except in the certainty that you are your enemy&#39;s begetter and its only hope of healing. For everything that does evil is in pain.
    -The Maestro Sartori, Imajica by Clive Barker

  10. #10
    Member Member the_mango55's Avatar
    Join Date
    Apr 2004
    Location
    Raleigh, North Carolina
    Posts
    94

    Default Re: Tutorial - Adding a unit to the game

    Quote Originally Posted by Musashi
    Mango, I forgot to mention it. The battle_models.modeldb file will only be parsed in the BASE data/unit_models folder. To get the game to parse it you have to add --io.file_first to your command line or batch file.

    Naturally this has... disturbing... implications for our users' ability to install multiple mods at once :(

    I should point out though, that if you're just using an existing model and a different mount, there's an easier way to do it. Basically it can be done with just the EDU file. Just set the mount, soldier, and upgrade lines in your unit's entry in the EDU file to what you want them to be... No need to create a whole new model entry in the DB file unless you're trying to use a model that doesn't have textures for your faction :)
    Ah I see, thanks.

    And I am aware about the horses, I made those units a few days ago, when I had no idea how to make heads or tails of the modeldb file.

    Well, I actually still don't really knnow how to make heads or tails of the modeldb file.

    @ Whacker: Greetings, but actually I'm no longer a triangle resident. I just graduated NCSU yesterday.
    Last edited by the_mango55; 12-22-2006 at 02:22.
    "You're drunk again!"
    "Na Im just exhausted from staying up all night drinking!" - Family guy

  11. #11
    Member Member Musashi's Avatar
    Join Date
    Nov 2002
    Location
    The Mists of Legend
    Posts
    811

    Default Re: Tutorial - Adding a unit to the game

    Yeah, I tried to explain the format, but really you just have to hack away at it awhile before you get to where you can "read" the file. And even then it's SO easy to miss something somewhere...

    PS: I put a picture of my Dragoons up in the tutorial. They're just so darn pretty :D

    Also I like the idea of calling them Dragonarioi, but I hate to go in and change something again at this point hehe. I might though :)

    Actually I should probably figure out what the name would really be in Greek... Presuming they referred to the carbine rifles as dragons, which should be drakon in greek I believe... Would it come out to Drakonarioi for wielders of them? Someone around here must know :)
    Last edited by Musashi; 12-22-2006 at 05:37.
    Fear nothing except in the certainty that you are your enemy&#39;s begetter and its only hope of healing. For everything that does evil is in pain.
    -The Maestro Sartori, Imajica by Clive Barker

  12. #12

    Default Re: Tutorial - Adding a unit to the game

    WHAT???In my data folder there isn't any export_descr_unit.txt.!!!

  13. #13
    Member Member scsscsfanfan's Avatar
    Join Date
    Sep 2002
    Location
    Adelaide, Australia
    Posts
    145

    Default Re: Tutorial - Adding a unit to the game

    good information, i'm not very good on modding, could you explain a bit more in details how to add the "--io.file_first " please?

    also, currently I still keep the original data folder unchanged, ie, still packed, and use a mod folder to play the game. to allow this to work, dose it mean I have to unpack the data folder?

    many thanks

  14. #14

    Default Re: Tutorial - Adding a unit to the game

    ok, but..how to use "unique" units....bohemian hussites, bohemian wagon fort, etc..all is in data folder,bud nothing dont used in game :(

  15. #15

    Default some prob

    hello i have some questions.
    i edited that battle_models.txt file to add some units
    but it dint work. just i start play.bat file and got CTD

    what i edited is here

    10 longbowmen 1 4 57 unit_models/_Units/EN_Peasant_Padded/longbowmen_lod0.mesh
    121 57 unit_models/_Units/EN_Peasant_Padded/longbowmen_lod1.mesh
    900 57 unit_models/_Units/EN_Peasant_Padded/longbowmen_lod2.mesh
    2500 57 unit_models/_Units/EN_Peasant_Padded/longbowmen_lod3.mesh 6

    400 3 7 england 79 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_england.texture
    78 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_normal.texture
    48 unit_sprites/england_Dummy_EN_Archers_sprite.spr

    5 slave 78 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_rebels.texture
    78 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_normal.texture
    46 unit_sprites/slave_Dummy_EN_Archers_sprite.spr

    6 france unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_rebels.texture
    78 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_normal.texture
    46 unit_sprites/slave_Dummy_EN_Archers_sprite.spr

    3 7 england 69 unit_models/AttachmentSets/Final European Archer_england_diff.texture
    69 unit_models/AttachmentSets/Final European Archer_england_norm.texture

    0 5 slave 67 unit_models/AttachmentSets/Final European Archer_slave_diff.texture
    67 unit_models/AttachmentSets/Final European Archer_slave_norm.texture

    0 6 france 67 unit_models/AttachmentSets/Final European Archer_slave_diff.texture
    67 unit_models/AttachmentSets/Final European Archer_slave_norm.texture


    0 1 4 None 16 MTW2_Fast_Bowman 14 MTW2_Fast_Mace

    i hit enter key to look easy.
    i added longbowmen to france to use rebel's one. i cant find wrong constructions. what is my mistakes? sorry for pool english

  16. #16

    Default Re: some prob

    ah. sorry i've mistake. but i cant edit my reply. hmm?

    this construction

    6 france unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_rebels.texture

    to

    6 78 france unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_rebels.texture

    got CTD too.

  17. #17
    Member Member Musashi's Avatar
    Join Date
    Nov 2002
    Location
    The Mists of Legend
    Posts
    811

    Default Re: some prob

    6 france 78 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_rebels.texture
    Fear nothing except in the certainty that you are your enemy&#39;s begetter and its only hope of healing. For everything that does evil is in pain.
    -The Maestro Sartori, Imajica by Clive Barker

  18. #18

    Default Re: Tutorial - Adding a unit to the game

    yes. i noticed it but coulnt edit my reply.
    since i post i editing battle_model.txt but still it dint work

    here it is

    10 longbowmen 1 4 57 unit_models/_Units/EN_Peasant_Padded/longbowmen_lod0.mesh
    121 57 unit_models/_Units/EN_Peasant_Padded/longbowmen_lod1.mesh
    900 57 unit_models/_Units/EN_Peasant_Padded/longbowmen_lod2.mesh
    2500 57 unit_models/_Units/EN_Peasant_Padded/longbowmen_lod3.mesh

    6400 3 7 england 79 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_england.texture
    78 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_normal.texture
    48 unit_sprites/england_Dummy_EN_Archers_sprite.spr

    5 slave 78 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_rebels.texture
    78 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_normal.texture
    46 unit_sprites/slave_Dummy_EN_Archers_sprite.spr

    6 france 78 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_rebels.texture
    78 unit_models/_Units/EN_Peasant_Padded/textures/EN_Peasant_Padded_normal.texture
    46 unit_sprites/slave_Dummy_EN_Archers_sprite.spr

    3 7 england 69 unit_models/AttachmentSets/Final European Archer_england_diff.texture
    69 unit_models/AttachmentSets/Final European Archer_england_norm.texture

    0 5 slave 67 unit_models/AttachmentSets/Final European Archer_slave_diff.texture
    67 unit_models/AttachmentSets/Final European Archer_slave_norm.texture

    0 6 france 67 unit_models/AttachmentSets/Final European Archer_slave_diff.texture
    67 unit_models/AttachmentSets/Final European Archer_slave_norm.texture


    0 1 4 None 16 MTW2_Fast_Bowman 14 MTW2_Fast_Mace 2 19
    MTW2_Bowman_Primary 14 fs_test_shield 2 17 MTW2_Mace_Primary 14 fs_test_shield 16 -0.090000004 0 0 -0.34999999 0.80000001 0.60000002

    what's wrong?

  19. #19
    Member Member Musashi's Avatar
    Join Date
    Nov 2002
    Location
    The Mists of Legend
    Posts
    811

    Default Re: Tutorial - Adding a unit to the game

    Looking at it I don't know. You do have a double space between the 0 and the 1 in the line "0 1 4 None 16 MTW2_Fast_Bowman 14 MTW2_Fast_Mace 2 19" right?
    Fear nothing except in the certainty that you are your enemy&#39;s begetter and its only hope of healing. For everything that does evil is in pain.
    -The Maestro Sartori, Imajica by Clive Barker

  20. #20
    Member Member Musashi's Avatar
    Join Date
    Nov 2002
    Location
    The Mists of Legend
    Posts
    811

    Default Re: Tutorial - Adding a unit to the game

    More bad news. Texture files have to be in base/data/unit_models/_units/<model type>/textures/ and NOT in a mod folder. Things are looking grim on the modding front I'm afraid.
    Fear nothing except in the certainty that you are your enemy&#39;s begetter and its only hope of healing. For everything that does evil is in pain.
    -The Maestro Sartori, Imajica by Clive Barker

  21. #21
    Member Member the_mango55's Avatar
    Join Date
    Apr 2004
    Location
    Raleigh, North Carolina
    Posts
    94

    Default Re: Tutorial - Adding a unit to the game

    Quote Originally Posted by Musashi
    More bad news. Texture files have to be in base/data/unit_models/_units/<model type>/textures/ and NOT in a mod folder. Things are looking grim on the modding front I'm afraid.
    why so?

    Mods can still use stuff put into the main data folder, you just have to add the file_first = true to the mod .cfg file as well.

    As long as the battle_models file doesn't have limits on the number of soldiers, then there will be no problems.
    "You're drunk again!"
    "Na Im just exhausted from staying up all night drinking!" - Family guy

  22. #22
    Member Member Musashi's Avatar
    Join Date
    Nov 2002
    Location
    The Mists of Legend
    Posts
    811

    Default Re: Tutorial - Adding a unit to the game

    No, there's lots of problems. They just only crop up when someone wants to install two mods that both use custom models.
    Fear nothing except in the certainty that you are your enemy&#39;s begetter and its only hope of healing. For everything that does evil is in pain.
    -The Maestro Sartori, Imajica by Clive Barker

  23. #23
    Member Member the_mango55's Avatar
    Join Date
    Apr 2004
    Location
    Raleigh, North Carolina
    Posts
    94

    Default Re: Tutorial - Adding a unit to the game

    Quote Originally Posted by Musashi
    No, there's lots of problems. They just only crop up when someone wants to install two mods that both use custom models.
    Possibly, however what I was getting at is that it could be manually worked around by pasting all the model info from one mod into the battle_models file, then pasting all the model info from another mod directly after it.

    Since they all reference the same file, and as far as I know it doesn't hurt to have models in there that aren't in use, what would problems be?

    It's a tad burdensome, but compared to MTW and RTW (separate installs for every mod) I will take it any day.
    "You're drunk again!"
    "Na Im just exhausted from staying up all night drinking!" - Family guy

  24. #24
    Member Member Musashi's Avatar
    Join Date
    Nov 2002
    Location
    The Mists of Legend
    Posts
    811

    Default Re: Tutorial - Adding a unit to the game

    Sure, it'd work, but how many users would you trust to do that and not be emailing you asking why their game won't load anymore?

    I was thinking of having the batch file that runs the mod (Which would be included in the zipped distro) back up the original model db file (If it exists) and copy the mod's file from a special directory in the mod folder, and then restore the original before exiting. Simple enough solution if every modder sticks to it...

    But it would entail fairly long batch files if we have to copy every texture over...
    Fear nothing except in the certainty that you are your enemy&#39;s begetter and its only hope of healing. For everything that does evil is in pain.
    -The Maestro Sartori, Imajica by Clive Barker

  25. #25
    Guardian of the Fleet Senior Member Shahed's Avatar
    Join Date
    Oct 2002
    Location
    Leading the formation !
    Posts
    7,918

    Default Re: Tutorial - Adding a unit to the game

    Good job Musashi ! THANKS a lot for typing this up for up !
    A Gamecenter with a dedicated Total War fanbase!
    Check out our Facebook!
    Email: shahed@outpost.be


  26. #26
    Member Member scsscsfanfan's Avatar
    Join Date
    Sep 2002
    Location
    Adelaide, Australia
    Posts
    145

    Default Re: Tutorial - Adding a unit to the game

    hi, I still has problem to get the un packed files to work, here is what I've done:

    I unpacked the data folder, deleted the 2 geographic files, then following various suggestions, I tried a few different ways:

    1. add in .cfg file,

    [features]
    --io.file_first

    or 2. add in .cfg file

    [io]
    file_first = True

    or 3. Creating bat file and open it:

    medieval2.exe --io.file_first

    however, non of them work at all.
    the game dosen't even load - gives a blank screen.
    Could someone help please?

    thanks

  27. #27
    Member Member Varyar's Avatar
    Join Date
    Aug 2003
    Location
    Europe
    Posts
    50

    Default Re: Tutorial - Adding a unit to the game

    Quote Originally Posted by Musashi
    Well, since Naffatun don't have an entry in the model DB file for the moors, you'll have to either change the lines for the Turks to be for the Moors by changing the faction name (You're in luck, in that they're the same number of letters, so you can literally just change where you see "Turks" to "Moors"), or add texture lines for the Moors. The problem with changing the Turks lines, is that the Naffatun will become invisible when the Turks field them.
    Thanks for the info, I think I got the hang of it now. Once you get through the code jungle the system is surprisingly straight-forward and intuitive.

    That being said, being a noob and all, a 'Musashi's Guide to Unit Modding - for Dummies' could've been useful
    Yalla! My Sultan wishes you dead!

  28. #28
    Member Member Musashi's Avatar
    Join Date
    Nov 2002
    Location
    The Mists of Legend
    Posts
    811

    Default Re: Tutorial - Adding a unit to the game

    Unfortunately I'm incapable of effective communication with dummies.
    Fear nothing except in the certainty that you are your enemy&#39;s begetter and its only hope of healing. For everything that does evil is in pain.
    -The Maestro Sartori, Imajica by Clive Barker

  29. #29

    Default Re: Tutorial - Adding a unit to the game

    Since its such a long process maybe someone can make a program that creates/edits units sort of like how the trait editor crates/edits traits.

    Nice tutorial tho!

  30. #30
    Hiding in a bush near you Member Sir Robin the Brave's Avatar
    Join Date
    Dec 2006
    Location
    Ol' Blighty (England)
    Posts
    72

    Default Re: Tutorial - Adding a unit to the game

    I'm getting a blank screen on loadup now, would this mean I've done something wrong in the model.db file?
    Brave Sir Robin ran away.
    Bravely ran away, away!
    When danger reared its ugly head,
    He bravely turned his tail and fled.
    Yes, brave Sir Robin turned about
    And gallantly he chickened out.
    Bravely taking to his feet
    He beat a very brave retreat,
    Bravest of the brave, Sir Robin!

Page 1 of 9 12345 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Single Sign On provided by vBSSO