Page 1 of 10 12345678910 LastLast
Results 1 to 20 of 204

Thread: How to create a custom unit in Pack File Manager

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default How to create a custom unit in Pack File Manager

    Hi all - first tutorial here, so hope it goes smoothly. I've been seeing requests for this, and since I figured out how to do it for myself, I figured I might as well write this up - now I'll be able to refer to it myself until I can do it from memory, too
    If there are any questions, feel free to post em, and I'll see what I can do to answer them.

    I tried to keep it from being a giant wall of text, but, there's not a whole lot of screenshotting I could do, so hopefully you can all follow along.


    Now, since adding new models is at present outside our (or at least my) abilities, this will deal with creating a unique vanilla unit. For this example, I'll be creating a special Uesugi version of the naginata warrior monk cavalry, and setting it up to be recruitable in-game.

    First, you're going to need the following tables:

    DBs:

    building_units_allowed (this tells the game what buildings are required for the unit to be created)
    cdir_unit_qualities (this tells the game what type of unit it is)
    uniforms (this tells the game where to find the models for the game)
    unit_required_technology_junctions (this tells the game what arts need to be mastered before you can recruit the unit)
    unit_stats_land (this tells the game what the units' combat stats are, as well as animation and other miscellaneous info)
    unit_to_unit_abilities_junctions (this tells the game what abilities the unit will have)
    units (this tells the game various info about the unit, mostly related to the campaign map and multiplayer. Essentially, the non-combat version of units_stats)
    units_to_exclusive_faction_permissions (this tells the game, predictably, who can use the unit. If it's not listed here, no one can use it)
    units_to_groupings_military_permissions (very similar to the above, this tells the game who can use the unit)

    as well as the text db units.loc (this tells the game the information about the unit, such as its name, and description)

    Extract all those, create a new pack, and add them to your mod. This will include all the entries in the respective tables, so you'll want to trim them down to the essentials after you're finished.

    Attachment 155968



    Normally, we'd start from the top. But if we jump to units first, that'll make things easier in the long run. So let's go there.

    Go to the entry of the unit you're making a variant of, and click Clone Row at the top. You then need to give your unit a unique name. Really, this can be anything, but it's easier to keep it the stock name system with _<faction's name> at the end. Next column over is the unit's screen name, but don't mistake this for the name of the unit showing up on the battlefield for instance, that's contained under unit localization. This is sort of an internal unit name.

    Category and class should be left as the default, or changed to whatever is the closest approximation for your unit.

    The rest of the info in this table is pretty self-explanatory, but a few things to note:

    For unique variants of units, the discount is typically 25-50 koku on recruitment in the campaign, and +25-50 koku for multiplayer recruitment. Upkeep is a 25-50 koku discount.

    Dojo Required allows you to set a second required building, not the primary. Like our case, where you need both a buddhist monastery and a naginata dojo. So, here is where I set the naginata dojo. Religion Required allows you to set only Christian, Buddhist, or Ikko-Ikki factions to be able to recruit this unit. I'm making it Buddhist.

    At the very end, is Index. This lists the number of the entry - you'll want to change it to a unique number. Doesn't matter if it's consecutive, so I tend to use high numbers that I know won't conflict with anything.



    That's it for units. Now, open up building_units_allowed.

    We're going to make our naginata cavalry recruitable, and it normally isn't. So here, you have to decide what you want the primary requisite building to be. For right now, just find an entry with your unit's building in the list. For instance, we're going to require a Buddhist Monastery. So, we find an entry with that requirement, and copy it.

    *Side note: The difference between primary and secondary required buildings is, primary buildings display the unit in the production queue even if you don't have the secondary dojo. It will be greyed out, and have a dojo icon in the corner. That is the secondary dojo required. If you only have the second dojo, the unit won't show up in the production queue.

    Now you should have a new row with all the same info. All you need to do is change the Unit ID Ref, and the third Unknown variable, another unique ID. Again, it doesn't have to be consecutive, so I start high.

    You need to do this for all the buildings in that chain, starting from the lowest level you want your unit to be recruitable at. So I have to have an entry for SHO_Buddhist_2_Monastery, SHO_Buddhist_3_Temple_Complex, and SHO_Buddhist_4_Legendary_Temple. For each level above the starting, you typically add 2 and 4 experience respectively. So a level 2 building adds 0 bonus levels, a level 3 building adds 2 bonud levels, etc. If you started at SHO_Buddhist_3_Temple_Complex though, you would only get 2 bonus levels with a legendary temple.

    That's it for building_units_allowed.


    Now, cdir_unit_qualities. This one's very simple. All you do, is copy an entry, and change the first entry to your faction's name, the second to its type, and the third to its unique ID. I don't think the last variable has any real significance, but if it does, feel free to let me know
    Best I can figure is it's a weighting variable for the AI to build it, a sort of prioritization number. The higher quality units, like katana heroes, have values of 1000 for some factions, and 900 for others. Meanwhile, Ashigaru typically have numbers in the 200's for everyone.
    You only need to add an entry for the factions you want to be able to recruit this, so I only need one for the Uesugi.



    Now, Uniforms!

    Uniforms allows you to set the look of your unit. Since we're using a standard unit, we just have to find and copy it. Set the Uniforms ID Ref to <default>_<unit name>_<faction>. In Uniform Variant, you can use a custom variant list to make, for example, a heavily armored monk with no exposed skin, a light monk with no armor, etc. This tutorial isn't about uniform_variants really, but suffice it to say, it's pretty straightforward. If you can edit it in PFM, all the better, but sometimes you have to use TAW's conversion tools to convert it to a txt. From there, it's a simple setup of adding in different parts and their textures which the game assembles a soldier out of randomly. One part in each category = cookie-cutter soldiers. A million parts in each = no two soldiers are the same.

    Unit ID Ref is obvious, and after that is - I believe - the unit that represents the general or captain of that unit. Setting it to Samurai_Gen_Mori_Motonari would make Motonari lead your unit, while Samurai_Inf_Matchlock_Ashigaru loads a samurai to lead a company of ashigaru.

    Next is - I believe - the model for the standard-bearer. This always seems to be some kind of ashigaru, and cavalry don't have standard bearers. So for our purposes, leave this blank.

    The final entry is the face of the leader of your entire army that's shown in the bottom left corner of the battle HUD. You only see this when you have an army led by a captain, not a general. Since our group is warrior monks, we set it to warrior_monk.



    Unit_required_technology_junctions is next. This is where you'd set whatever art you want mastered before you can recruit the unit - but since ours is already determined through the necessary dojos (which require arts to build), we won't mess with that. For the sake of example, gunpowder units would be set to shogun_military_musket_teppo_mastery. That way, even the required buildings wouldn't be enough to build the unit. Using all the requirements (and AI weighting) you can set exactly how common or rare you'd like the unit to be. Or at least, how soon before it shows up.



    Unit_stats_land is next, and it's a bit of a doozy. There's a lot of info in this bad boy. After creating your new entry with your Unit ID Ref, you can set the number of soldiers, number of horses for cavalry units, number of artillery pieces, etc. Officer, I'm not sure what it does. It may do the same thing as the entries we saw before in uniforms, it may not. I don't know for sure.
    Same with standard bearer.

    Model Name I don't believe is used anymore, considering it's shogun_samurai_test for so many of the entries.
    Infantry Battle Entity is related to the animations of the soldiers, I believe. Shogun_inf_samurai is what you want most of them to be.

    Further down, you come across horse 1, cavalry battle entity, and horse 3. These are all used to determine the models of the horses. Another holdover from Empire and Napoleon, there's only horses in this game.

    Even further, you'll come across Artillery 1, and Artillery 2. Artillery 2 is important because that's what determines ranged weaponry. You need Artillery 2 for ranged units, or they won't be very ranged.

    Drill Set and Training I don't believe really make a difference in-game. At least my testing hasn't shown anything.

    Then you get some spacing variables, to set how loose or close you want your units to stand to each other. I wouldn't mess with that for most purposes. I only mention it for future reference, I'm sure someone will want it sometime

    A few ability modifiers later, and you come across the Spotting Value variables. These determine how close or far you have to be to the army before you can see its unit card on the campaign map. I'm not sure which is which, but I believe one is for standard military troops, one is for agents who aren't ninja, and remaining one is for ninja.

    There's also an Immune to Attrition variable in here, which is usually reserved for rebels. If you wanted to make kisho ninja immune to attrition though, here's where to do it.

    The last part of this table is reserved for either sound effects, scripts, or general animation. I haven't tested it yet.



    Now we're finally done with units_stats_land. Onto unit_to_unit_abilities_junctions. The list of abilities can be found in unit_abilities, but usually you'll have what you need there. We're giving our guys wedge formation and warcry. A simple clone and change of the Unit ID, and we're done. Much simpler after the unit stats tables, eh?



    We're getting close to being done, now! Units_to_exclusive_faction_permissions is next. Another simple one, all we need to do is copy anything from our faction. Change your ID, make sure it's set to True, and then you're done. However, since our unit replaces another unit (or at least it would in theory) for this faction, we need to make another row. On this one, you copy the default version's ID, and set it to False. That way our faction will be able to recruit Cav_Spear_Naginata_Warrior_Monk_Cavalry_Uesugi, but not Cav_Spear_Naginata_Warrior_Monk_Cavalry.

    Attachment 155969


    Units_to_groupings_military_permissions is theoretically unecessary for the most part, but I can't seem to get the unit to be truly unique to a faction without it. Just copy a row, set the unit ID, and change the Group to your faction's name.



    Now, the very last table: units.loc! Getting tired yet?

    A note before we get started with this one: if you extract this from data.pack and use it in your own pack without renaming it, it will overwrite the default. However, unlike with most other tables, if an entry isn't here, it won't read it from data.pack either. In other words, if you use this without renaming it, and delete everything but your new unit's entry, that will be the only unit with a name. All others will be blank. So make sure you rename it!

    Now, the syntax here is as follows:

    units_on_screen_name_<unit ID>

    and

    unit_description_texts_description_text_<unit ID>

    On screen name is the actual name of the unit as it shows up on the battle map.

    Description text is the tool tip that shows up underneath the name. If you want to copy something from another unit, you can find the standard units.loc (for on screen name) and unit_description_texts.loc (for the tooltip) in the localisation_en.pack (or whatever your game's language).



    Now, with all those changes complete, save the pack! You may want to change it to a movie pack, or a mod, or whatever works for you. After that, you're ready to go! If everything is done correct, your new unit will show up on screen, in all its glory


    Shiny new unit...
    Attachment 155970


    ...That doesn't replace the original for all factions.
    Attachment 155971


    Troubleshooting:


    The easiest way to test this is in the custom battle setup. You'll have the opportunity to notice several problems along the way:


    • If your game doesn't load and crashes before reaching the cutscenes / main menu, you likely have the wrong pack type, or something's wrong with your user.scripts.


    • If your unit doesn't show up at all, check to make sure you set it to recruitable.


    • If your unit shows up, but doesn't have a portrait, I unfortunately don't know what to do - I've only run into that problem once, and I don't remember how I fixed it, unfortunately. It's fixable, and hopefully someone else can post exactly how


    • If you can add your unit to your custom army and it has its portrait, but the game crashes after you try and load the battle, there's an error in one of the tables. Usually something in the uniforms, units, or unit_stats_land. I've noticed that PFM can be rather finicky at times with what it saves - sometimes it forgets to set one or two changes you've made. It particularly seems to forget what you've set your horse models to under stats_land, for example.


    It'll almost never work 100% the very first time, so just remember to stick with it, and you'll get it. Also, for reference, I'm using the additional units mod, which is how the Mori got the monks. So you can mod even with other unit packs running, as long as everything has its own ID.

  2. #2

    Default Re: How to create a custom unit in Pack File Manager

    Very useful tutorial - I know a lot of people have been wondering how to do this with the new PFM. I would however like to point out a couple minors errors in the descriptions of the db files, hopefully to make things more clear

    building_units_allowed - defines what buildings a unit can be recruited from, slightly different from building required to create the unit. Dojos required to create a unit are found in the units table.
    uniforms - tells the game where to find the textures (I think) to use for the unit. The unit card (at least for custom battle...) is also designated here. The model to be used is also in the units table, not the uniforms table.
    units_to_exclusive_factions_permissions - entries here are only for units that are specific for one faction. It tells the game that a unit can only be recruited by one faction, and that the faction cannot recruit the vanilla version, since it has its own version. A unit does not need to be in this table to be usable.

    Also, if someone who knows for certain what they're talking about could explain what exactly the cdir_unit_qualities and units_to_groupings_military_permissions are for...I would really appreciate it. I know they aren't required for recruiting units or using them in custom battles, but I would really like to know what they do, and what the column headers are (if someone could add the headers to the PFM, that would be awesome).

    One other note: once you've created your unit(s), you should rename the files in your pack (ex: units to custom_units), and delete all of the vanilla entries from the tables, leaving only the new unit entries. This will make things a lot easier to read, and you won't risk overwriting any other changes that other mods may have made to the vanilla units.

    Otherwise the tutorial looks very good. Thanks for taking the time to make it
    Last edited by Aira; April 15, 2011 at 05:20 AM.

  3. #3
    Xorte-Renshe's Avatar Civis
    Join Date
    Jan 2011
    Location
    Newcastle, England
    Posts
    159

    Default Re: How to create a custom unit in Pack File Manager

    Ah, thank you very much. This is exactly what I've been looking for. ///_^
    (I haven't yet read through the entire tutorial, and I cant wait to learn how to get all this done.)

  4. #4
    Foederatus
    Join Date
    Jul 2010
    Location
    France
    Posts
    36

    Default Re: How to create a custom unit in Pack File Manager

    Thank you it's perfect

  5. #5
    Xorte-Renshe's Avatar Civis
    Join Date
    Jan 2011
    Location
    Newcastle, England
    Posts
    159

    Default Re: How to create a custom unit in Pack File Manager

    My unit_required_technology_junctions file only has naval units. There aren't any entries for land units at all. That cant be right, can it?

    Oh, and this is my 69th post. Giggity.
    Last edited by Xorte-Renshe; April 15, 2011 at 01:40 PM.

  6. #6

    Default Re: How to create a custom unit in Pack File Manager

    Quote Originally Posted by Xorte-Renshe View Post
    My unit_required_technology_junctions file only has naval units. There aren't any entries for land units at all. That cant be right, can it?
    Are you sure? Mine has some ships, but it also has matchlock infantry, like Inf_Missile_Matchlock_Ashigaru_Oda. Keep in mind, most of the units only have dojo requirements, and the tech requirements are secondary only to get the dojo. Hence why the Shimazu can recruit katana samurai on the first turn without researching bushido. So most units don't have entries there. It's pretty much exclusively gunpowder, because gunpowder units are trained from otherwise common buildings.

  7. #7
    Xorte-Renshe's Avatar Civis
    Join Date
    Jan 2011
    Location
    Newcastle, England
    Posts
    159

    Default Re: How to create a custom unit in Pack File Manager

    Quote Originally Posted by Ele View Post
    Are you sure? Mine has some ships, but it also has matchlock infantry, like Inf_Missile_Matchlock_Ashigaru_Oda. Keep in mind, most of the units only have dojo requirements, and the tech requirements are secondary only to get the dojo. Hence why the Shimazu can recruit katana samurai on the first turn without researching bushido. So most units don't have entries there. It's pretty much exclusively gunpowder, because gunpowder units are trained from otherwise common buildings.
    I'm sure. There are only 8 entries in there, all saying either "Heavy_ship" or "Light_ship".

    Ah, I just checked the original file (the one from the data.pack), and it had the missile units. I guess they just didn't load the first time. The file I put in the mod.pack didn't have them. Hmmm... oh well. That might be the fault of my computer.

    Thanks for the info. ///_^
    Last edited by Xorte-Renshe; April 15, 2011 at 08:17 PM.

  8. #8

    Default Re: How to create a custom unit in Pack File Manager

    TYVM Ele! I got it to work. I think it was the indexing numbers that threw everything off for me and the uniform tables.

  9. #9

    Default Re: How to create a custom unit in Pack File Manager

    Yep good work on the Tutorial

    On Uniforms - great find about the last entry as the face of the general left of screen bottom , i was thinking it was linked to the atlas.

    Im thinking that the line after Unit ID is linked to the ICons. Icons follow the same path as unit variants but seem to be also influenced by this column, Column after this being standard bearers is quiet intresting il give it a tweak,

  10. #10

    Default Re: How to create a custom unit in Pack File Manager

    It could be, yeah. I'll have to check it out later when I get a chance, good call.


    In the mean time, thanks for all the kind words everyone

    Glad it helps some people out. Now if only I knew how to use custom models, we'd be set

  11. #11

    Default Re: How to create a custom unit in Pack File Manager

    Hello, I have a problem.
    I created a custom unit and I can play battles with it, but in the battles the unit doesn't have any icon or picture.
    And in the campaign there's a cavalry picture although it is a ninja.

    I don't know how to solve this problem.

    Any suggestions?

    Another pretty funny problem occured...


    Any suggestions to fix that?
    Last edited by Yuri_ii; April 23, 2011 at 03:08 AM.

  12. #12

    Default Re: How to create a custom unit in Pack File Manager

    Quote Originally Posted by Yuri_ii View Post
    Hello, I have a problem.
    I created a custom unit and I can play battles with it, but in the battles the unit doesn't have any icon or picture.
    And in the campaign there's a cavalry picture although it is a ninja.

    I don't know how to solve this problem.

    Any suggestions?

    Another pretty funny problem occured...
    Any suggestions to fix that?
    Hey, sorry it took so long.

    The issue with the icon / picture is due to a missing or incorrect portrait entry. I still for the life of me can't locate which table / entry determines that, so unfortunately I can't help just yet :/
    I'm still looking, though.

    And what do you mean in the campaign? The soldier's 3d model, the unit info pic, the recruitment tab, etc?


    The samurai standing on their horses is most likely an animation problem - go into unit_stats_land and check to make sure you're using shogun_man_katana_cavalry for the animation table instead of shogun_man_katana.

  13. #13

    Default Re: How to create a custom unit in Pack File Manager

    I found out why portraits are missing!

    Silly thing about the Clone button on File Pack thing is that sometimes it doesn't clone everything

    So go back to UNIFORM and if your portraits are missing, you'll see that half of your entries are blank !
    Fill em up and tada! You'll have portraits~

  14. #14

    Default Re: How to create a custom unit in Pack File Manager

    Quote Originally Posted by MrHoon View Post
    I found out why portraits are missing!

    Silly thing about the Clone button on File Pack thing is that sometimes it doesn't clone everything

    So go back to UNIFORM and if your portraits are missing, you'll see that half of your entries are blank !
    Fill em up and tada! You'll have portraits~
    Hello from 2017! I doubt you will answer, but my uniform tables are full except for musician filename and standard bearer filename. I am trying to make the katana cav, yari cav, and bow cav for the ikko ikki look like warrior monks instead of samurai. It works just how i wanted, by basically making a seperate version of all, and making their uniform the same as the naginata warrior monk cav, but sadly the portraits are blank in custom battles, there is no unit name, and the portrait is of the naginata warrior monk cav mid battle.. D oyou know how to fix this?

  15. #15
    Hazbones's Avatar Senator
    Join Date
    May 2007
    Location
    Iwakuni, Japan
    Posts
    1,104

    Default Re: How to create a custom unit in Pack File Manager

    Hi, great tut here. I just wondered if you could add in one more thing to your OP that was left out.
    This is an optional step but goes a long way in helping to "de-clone" units between factions.

    Letting your units keep their natural colors

    1. Use PFM to open the uniforms_to_faction_colors table.
    2. Next, use PFM to open faction_uniform_colours table.
    3. Add your new custom unit to uniforms_to_faction_colors table and refer to the faction_uniform_colours table to fill in the blank RGB values in the faction colors table.
    4. Save your work and import into your mod

    What this does is for all units that you put into the uniforms_to_faction_colors table, no matter who recruits those units, they will always wear the same color as you set in the table.

    Cheers!
    Last edited by Hazbones; April 27, 2011 at 09:37 PM.

  16. #16

    Default Re: How to create a custom unit in Pack File Manager

    Hazbones, does that mean that theoretically we could make the units look like their portraits? The only faction diff being the sashimono? (Please say "yes")

  17. #17
    Hazbones's Avatar Senator
    Join Date
    May 2007
    Location
    Iwakuni, Japan
    Posts
    1,104

    Default Re: How to create a custom unit in Pack File Manager

    The sashimono is a new thing in TWS2 so I cannot speak to that but just like in ETW and NTW the units you put into the uniforms_to_faction_colors table should stay that color no matter who recruits them.

    For example: in NTW, I am playing as France and I conquer a Spanish region. If I have the Spanish units in the uniforms_to_faction_colors table, their uniform would stay the same and they would only be holding a French flag. Same thing should apply here.

    I say "should" because I have not tested it yet. It is just theory atm. I am working on a mod to test it though. Stay tuned unless someone can test for us real quick?

  18. #18

    Default Re: How to create a custom unit in Pack File Manager

    Quote Originally Posted by Ele View Post

    We're getting close to being done, now! Units_to_exclusive_faction_permissions is next. Another simple one, all we need to do is copy anything from our faction. Change your ID, make sure it's set to True, and then you're done. However, since our unit replaces another unit (or at least it would in theory) for this faction, we need to make another row. On this one, you copy the default version's ID, and set it to False. That way our faction will be able to recruit Cav_Spear_Naginata_Warrior_Monk_Cavalry_Uesugi, but not Cav_Spear_Naginata_Warrior_Monk_Cavalry.

    Attachment 155969
    Thanks for the tutorial, after following your instructions, the unit was created but the problem is I can recruit BOTH Naginata Warrior Monk Cavalry and Uesugi Naginata Warrior Monk Cavalry when playing as Uesugi, i checked Units_to_exclusive_faction_permissions and theres no problem

  19. #19
    Hazbones's Avatar Senator
    Join Date
    May 2007
    Location
    Iwakuni, Japan
    Posts
    1,104

    Default Re: How to create a custom unit in Pack File Manager

    Tachi, if the unit you don't want isn't already there, add the unit that you don't want to the Units_to_exclusive_faction_permissions table and set it to FALSE. This will prevent the faction from being able to recruit it.

  20. #20

    Default Re: How to create a custom unit in Pack File Manager

    I checked the Units_to_exclusive_faction_permissions table:

    Cav_Spear_Naginata_Warrior_Monk_Cavalry_Uesugi --- uesugi --- True
    Cav_Spear_Naginata_Warrior_Monk_Cavalry --- uesugi --- False

    but it I can still recruit Naginata Warrior Monk Cavalry
    Last edited by Tachi; April 29, 2011 at 01:54 PM.

Page 1 of 10 12345678910 LastLast

Posting Permissions

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