Results 1 to 10 of 10

Thread: How to create a new unit (for new modders): which guides and PFMs work for me

  1. #1
    Alwyn's Avatar Frothy Goodness
    Content Director Patrician Citizen

    Join Date
    Feb 2014
    Location
    United Kingdom
    Posts
    9,340

    Default How to create a new unit (for new modders): which guides and PFMs work for me

    Would you like to create a new unit? Do you follow tutorials only to get stuck and wonder what has gone wrong? Here are the results of my limited experience in this area.

    Step One: Create a mod pack file

    I used: Pack File Manager 1.5.9 (it is for Napoleon: Total War but it works for Empire Total War as well) and Erasmus777's instructions on how to make a mod.

    To make a mod which would create a new unit (a clone of a Line Infantry unit with some edited statistics) I made a mod file which included the following database tables:-

    building_units_allowed_tables
    unit_required_technology_junctions_tables
    unit_stats_land (if you want to make new ships, you will need unit_stats_naval)
    unit_to_unit_abilities_junctions_tables
    units_tables
    units_to_exclusive_factions_permissions_tables

    I extracted these tables from a copy of the game's patch2.pack file, which you can find in C:/ProgramFiles(x86)/Steam/steamapps/common/Empire Total War/data; I extract files from copies of the game's files, not from the original files, in case I accidentally mess up the original game files.) Pack File Manager (PFM) crashed when I extracted unit_stats_land. I clicked 'continue' and was able to save the file. I found that I was still able to edit the mod file using PFM 1.5.3, as I explain in Step Two below.

    When I extracted the database tables, I saved a copy of that mod file (so that I can use this to create other mod packs in future). I then deleted every row except for the rows relating to the unit which I was cloning to create a new unit - in this case, euro_line_infantry.

    I then renamed the database tables, e.g. units became minor_units (I chose 'minor' simply because I am experimenting with creating a mod that will add units to the rosters of minor factions). The renamed database tables looked like this:-



    Step Two: edit the database tables

    So far, I have cloned a unit, euro_line_infantry. Now it is time to create a new unit.

    I did this using Pack File Manager 1.5.3, because PFM 1.5.9 (which I used for the previous step) crashed when I tried to edit the unit_stats_land table. If you would like to try PFM 1.5.3, it is available as a component of husserlTW's EasyDB resource. To use PFM 1.5.3, simply install EasyDB, open EasyDB and select 'PFM' from the options along the top - PFM 1.5.3 will open in a separate window.

    This is the step where you need to edit the database entries such as unit_stats_land (e.g. to adjust your unit's accuracy, reloading, morale and melee fighting scores) and units table (e.g. to adjust the cost of the unit, the region where it can be recruited and the unit card which the game will use. I look at the units tables in copies of the vanilla game's patch.pack files to see what entries are possible for the region of recruitment, unit cards etc. (I have not learned how to create unit cards or unit skins - you would need a different set of tutorials and software for that.)

    The other essential things to do are:-

    - Rename your cloned unit. To create my unit, I renamed euro_line_infantry to euro_line_infantry_old (I'm creating a unit which will be called the Old Guard Regiment). You need to do this in every entry relating to your unit in all of the database tables in your mod file (for an example, see the image above - in the right hand column, you can see that euro_line_infantry_old can be recruited in all types of military barracks in large cities as well as the military buildings in smaller cities.)

    - Decide how your mod file will be activated. Will you use a user script file (if so, you will need to right-click on the mod in the left panel, select 'Change Pack Type' and set it to Mod)? Or will you make this a 'movie' type mod so that it activates automatically without the need for a user script file (of so, you will need to right-click on the mod in the left panel, select 'Change Pack Type' and set it to Movie).

    Step Three: name your unit and (optional) add a description

    For this step, I used Pack File Manager 1.5.9 to create a new mod pack (using the same instructions as in step one, above). Into this mod pack, I extracted the 'localisation' database table from patch_en.pack ('en' stands for English, because I play the English-language version of the game; if you play a different version then you will have a file with a slightly different name).

    I did not change the name of the database table.

    I tried using four different versions of Pack File Manager to edit this mod file without success - it crashed every time. Then I used Pack File Manager 1.9 and it worked. Another option would be to follow the advice of Quintus Hortensius Hortalus here (use option "Export TSV" choose a location for your loc and then edit the file with the windows text editor. If you made the changes import your updated file and save).

    To create a name for my new unit in Pack File Manager 1.9, I first clicked 'Tag' (above the database table entries) to sort them in alphabetical order, which made it easier to find the existing entries which indicate what units are called and which text appears in the unit card.

    To create a name for my unit, I added a line with an entry on in the left-hand column, units_on_screen_name_name_euro_line_infantry_old (obviously, you would replace the part in the bold type with your unit) and, in the right-hand column, Old Guard Regiment (the name of my unit).

    It should also be possible to add 'long' and 'short' descriptions for a unit, by adding similar entries with the following text on the left:

    unit_description_texts_description_text_euro_line_infantry_old
    unit_description_texts_long_description_text_euro_line_infantry_old

    Obviously, you would need to replace euro_line_infantry_old with your unit in the left hand column and type the description of your unit in the right hand column.


    Would you like to see an example of a working mod?

    You can download, below, four zipped files which provide a demonstration:-

    - Minor 1a.pack is the mod pack at an early stage of development. The dabatase files listed above have been extracted into the mod pack but the rows which I do not intend to use have not been deleted. This is a resource for new modders who would like help with making a mod which creates new units. It is not a mod pack.

    - The other files are the components of a simple mini-mod which activates a new unit for minor factions, the Old Guard Regiment.



    This unit is a clone of Line Infantry with a few simple changes (reloading score of 30 rather than 25, morale increased from 7 to 9, slightly more expensive recruitment and upkeep and minor factions can recruit only one of this unit). These changes were made by editing the unit_stats_land and units_tables. This is just a simple demonstration of a basic mod which adds a new unit. To make a proper, well-developed mod, it would be helpful to add a unit description (this unit still uses the standard Line Infantry description) and to use a different unit card (this unit still uses the standard Line Infantry unit card).

    How to use the demonstration mod

    To use this mod, you would need to:-

    - Download and unzip it (it was zipped using the free software 7zip, so you could download the same software to unzip it, if you do not already have suitable software). Ignore Minors 1a.pack, as it is a resources for modders, not a component of the demonstration mod.

    - Copy Minors 1i.pack into your C:/ProgramFiles(x86)/Steam/steamapps/common/empire total war/data folder (that is the path on this Windows 7 PC; if your computer is different, then the path may vary). This is a 'mod' pack, so it needs to be activated using the user script file, which I explain below.

    - Copy the user.empire_script.text file into your
    C:/Users/[your user name]/AppData/Roaming/The Creative Assembly/Empire (if you already use a user script file to activate mods, simply add a semicolon after the previous entry and, on a new line, add the text in this user script file: mod "Minors 1i.pack")

    - Copy the Minors3_en.pack file into your C:/ProgramFiles(x86)/Steam/steamapps/common/empire total war/data folder. (This is a 'movie' type mod, so it does not need to be activated by a user script file)

    To uninstall, simply cut and paste the mod files somewhere else. Don't forget to remove the user.empire_script file, or to edit it to remove the line which refers to the Minors 1i.pack. (If you have a user script file which refers to a mod file which is not in your

    C:/ProgramFiles(x86)/Steam/steamapps/common/empire total war/data folder then the game will crash when launching.)
    What the demonstration mod does

    The demonstration mod allows minor factions to recruit one Old Guard Regiment. To do this, they must:-
    - Research the 'Carbines' technology
    - Have a military barracks in Europe

    This demonstration mod does not unlock minor factions for the player - you would need to use a separate mod to do that, such as All Factions Unlocked No FoW or Empire Total Factions.

    Permission

    Modders are welcome to use these mod files to create your own mods (or components for your own mods).

    Known issues

    As you can see from the image above, I managed to create a new unit using the steps above. Unfortunately, when I followed the same steps in my next attempt to make a mod which creates a new unit, the game crashed when launching every time. I found (and corrected) a typing error in one of the database tables, but the game continued to crash when launching until I deleted the mod files. I do not know how to fix this problem. So these steps are not guaranteed to work. If anyone can add suggestions or advice on what to do, and what not to do, when creating new units, please post your comments on this thread.

    If modding causes problems with your game

    In my experience modding sometimes causes unexpected side effects and crashes. For example, you might experience saved game corruption or what I call the '1703 bug' (where every new campaign crashes at the end of 1703). When such problems happen, sometimes you can fix them simply by taking out your mod file and going back to an earlier version. But sometimes that doesn't work. Some people have reported that even reinstalling the game did not fix problems. If you have gone back to an earlier version of a mod and a problem remains, here is a solution which works for me:

    - Find your scripts folder. On my Windows 7 PC, this is in: C:/Users/[my user name]/AppData/Roaming/The Creative Assembly/Empire/scripts

    - Make a copy of the preferences_empire_script.txt file and put that copy somewhere else in case you ever want to put it back (I never have, but it seems wise in principle to copy a file you are about to delete)

    - Delete the preferences_empire_script.txt file

    - Start the game normally; you don't need to replace the preferences_empire_script.txt file beforehand, because the game should automatically detect that you don't have a preferences file and should create a new one for you.

    - Select your preferred options (e.g. no advice in battles)

    - If you had previously edited your the preferences_empire_script.txt file to implement mods such as the developers battle camera
    and Bran Mac Born's Preferences Script Setting for better battle AI and You can't play in high? Here is solution, then you will need to (a) edit the preferences script to add those settings and then (b) right-click on the preferences_empire_script.txt file and select 'read only'.

    (Reinstalling the game appears to cause the game to replace all of the files in the folder C:/ProgramFiles(x86)/Steam/steamapps/common/empire total war - however, if the problem is located in the other folder which the game uses, C:/Users/[my user name]/AppData/Roaming/The Creative Assembly/Empire, then re-installing the game won't fix it. I have a Windows 7 PC - if your computer is different, the paths to the folders may vary.)

    *** The mod resource pack Minors 1a.pack, below, has been edited so that the unit_stats_land table does not include units from the DLC packs (since, obviously, we are not supposed to provide mod files which enable people to use the DLC units without buying them) ***


    My other basic guides to modding ETW are listed here.
    Attached Files Attached Files
    Last edited by Alwyn; July 23, 2016 at 05:21 AM.

  2. #2

    Default Re: How to create a new unit (for new modders): which guides and PFMs work for me

    Cant see PFM 1.9 for looking Alwyn, but that may be because I have been on this for hours and am going a bit goggle eyed! Can you provide a link please?

  3. #3
    Alwyn's Avatar Frothy Goodness
    Content Director Patrician Citizen

    Join Date
    Feb 2014
    Location
    United Kingdom
    Posts
    9,340

    Default Re: How to create a new unit (for new modders): which guides and PFMs work for me

    I'm sorry Ouchi Numbnuts - I cannot find where I got PFM 1.9 from (I've been collecting PFMs for a year now. I generally found the versions of PFM which I have by searching through the threads on modding and by searching online. If I can find the source, I will post a link.)

    I still have the downloaded zip file which I used to install PFM 1.9. Please can a moderator advise me - would it be okay for me to make that file available here (or on another thread, if that would be more appropriate)? I would, of course, be very clear that I was not involved at all in creating PFM 1.9.

    [Edit] various versions of PFM are available via a link from the post on Pack File Manager 3.2.1 which goes to this page where you can download versions 2.0.2 to 3.2.1. So you could try PFM 2.02 (or other earlier versions from that collection) and see whether it can do what PFM 1.9 does (edit the localisation file for Empire in a mod pack without crashing).
    Last edited by Alwyn; February 08, 2015 at 06:19 AM.

  4. #4
    Alwyn's Avatar Frothy Goodness
    Content Director Patrician Citizen

    Join Date
    Feb 2014
    Location
    United Kingdom
    Posts
    9,340

    Default Re: How to create a new unit (for new modders): which guides and PFMs work for me

    How to create a new naval unit

    It is possible to add custom naval units. There are several mods which do that. I recommend some navy mods, including some which add new ships, here. As far as I know, no-one has managed to add new ship models. There have been mods with improved ship textures (Pdguru's Briney Ships Mod and the optional graphics pack for the Additional Units Mod both offer better ship textures. You can use an improved ship texture mod together with a mod which which add new ships.)

    If you would like to see a mod which creates a new naval unit, I suggest downloading and having a look (using Pack File Manager) at the 'tuc_new_ships' file which belongs to my These United Colonies mod, here. That mod adds two types of ship - 24-gun frigates (I used the carronade frigate model and gave the ship cannon rather than carronades) and schooners (I used the bomb ketch model, removing the naval mortars). For both ships, I adjusted the statistics (for example, top speed and acceleration) to give them scores which seemed to fit the type of vessel I wanted them to be.

    To create new ship types, you'll need two things:-

    1. A modded pack file containing the following database tables:-

    building_units_allowed_tables
    unit_required_technology_junctions_tables
    units_stats_naval_tables
    units_tables
    units_to_exclusive_factions_permissions_tables

    2. A modded pack file (which can be the same file as above, although I use a different file) containing the localisation (which the game uses to name everything, including units.). If you do not now how to do that, look at the original post of this thread, above (on how to create land units) and read the instructions on 'Step Three - name your unit'.

    For (1) above, you will probably just want database tables containing the lines which you need to add units, not the complete tables (unless you also want to edit the statistics of the vanilla units).

    I recommend Bethencourt's thread on Naval Modding (in the 'Tools, Tutorials and Resources' part of the Mod Workshop) for expert advice on ship modding - I just know basic stuff.

    If you make a ship mod and intend to post it on TWC, it's worth knowing that modders must not distribute mods which unlock DLC units - and there are DLC ships, as you may well know, the USS Constitution and HMS Victory.

    How to unlock naval units

    There are a few ship types which are in the game's database tables and which are not available in the Grand Campaign without modding - in particular, Fourth Rate Frigates (which, by default, have identical statistics as Fourth Rate ships of the line and use the same model), Civilian Luggers and two 32-gun frigates, HMS Shannon and USS Chesapeake. If you would like to see a mod which unlocks these units, then you could look at my Fourth Rate Frigate Unlock mini-mod. Some versions of this mod unlock all of those units. (Having tried that version, I prefer using a different version which does not unlock Civilian Luggers. Civilian Luggers are unarmed cargo ships, but the AI factions include them in their fleets and they behave as if they were warships, sailing towards your fleet even though they have no chance of winning. I reduced their morale to 1, so that they normally flee after taking a single hit, but this seems to unbalance naval battles in favour of the player - you can easily cause part of their fleet, the Luggers, to rout, which could have a negative effect on the morale of the other units in the AI fleet. I tried giving the Luggers cannon, but this did not seem to work properly).

    It is possible to unlock naval units which already exist in the game's database by creating a modded pack file containing the following database tables:-

    building_units_allowed_tables
    units_tables
    units_to_exclusive_factions_permissions_tables

    If you do that, I suggest adding the unit_stats_naval_tables as well, since it seems likely that you will want to edit the statistics of the unlocked ships.

    My other basic guides to modding ETW are listed here.
    Last edited by Alwyn; September 06, 2015 at 02:20 AM.

  5. #5

    Default Re: How to create a new unit (for new modders): which guides and PFMs work for me

    Alwyn. May you please send me a tutorial on how to edit a unit, or even better make a new unit, on PFM 3.5.2, since each time I even start it, ( I start with the buildings allowed) it wont let me name my unit other then what is already listed on there.

  6. #6

    Default Re: How to create a new unit (for new modders): which guides and PFMs work for me

    Followed your guide and am stuck at getting the unit into battle. I created a new unit based off of Morgans Rifle Corps, didn't change anything stat wise from it's original. However, when trying to play a quick battle with this unit it starts to load the battle then crashes. If I recruit the original Morgans Rifles along with my version, the battle loads and both units are there. Any ideas what's wrong?

  7. #7
    Alwyn's Avatar Frothy Goodness
    Content Director Patrician Citizen

    Join Date
    Feb 2014
    Location
    United Kingdom
    Posts
    9,340

    Default Re: How to create a new unit (for new modders): which guides and PFMs work for me

    Sorry, ZachariahOfLRep, I didn't see your post until now. I don't use PFM 3.5.2 to create new units for ETW. If 3.5.2 can create new units for ETW, then I would expect the method to be the same or very similar to the approach explained above. If the method with PFM 3.5.2 would be different from the one above, then I don't know what it going wrong for you.

    Sorry, ETR3(SS), I don't know why the game would crash under those circumstances. As you have experienced, when the game crashes when we test a mod, we receive no feedback on what caused the crash. I can only suggest trying again with a different unit (perhaps the crash was linked to something specific about this unit? When I created mods to unlock units which already exist in the game, there were some units which I was unable to unlock because the game crashed when I tried. This problem might or might not be linked to the unit's status as a DLC unit.) You might be able to start with a different unit (e.g. an ordinary riflemen unit) and improve statistics (e.g. morale) step by step, to make it more like Morgans Rifle Corps.

    Unfortunately, everything I know about creating units is in the posts above, and in discussion on this thread. If that information - plus some trial and error and improvisation - doesn't make your mods work, then sadly I won't know how to fix the problem. Of course, someone else might have an idea.

  8. #8

    Default Re: How to create a new unit (for new modders): which guides and PFMs work for me

    Quote Originally Posted by Alwyn View Post
    Sorry, ETR3(SS), I don't know why the game would crash under those circumstances. As you have experienced, when the game crashes when we test a mod, we receive no feedback on what caused the crash. I can only suggest trying again with a different unit (perhaps the crash was linked to something specific about this unit? When I created mods to unlock units which already exist in the game, there were some units which I was unable to unlock because the game crashed when I tried. This problem might or might not be linked to the unit's status as a DLC unit.) You might be able to start with a different unit (e.g. an ordinary riflemen unit) and improve statistics (e.g. morale) step by step, to make it more like Morgans Rifle Corps.

    Unfortunately, everything I know about creating units is in the posts above, and in discussion on this thread. If that information - plus some trial and error and improvisation - doesn't make your mods work, then sadly I won't know how to fix the problem. Of course, someone else might have an idea.
    My thinking was it may be related to its status as a DLC unit as well. I got a hold of a demo mod you made with the Old Guard Regiment and it worked. Strange indeed. Anything I come across that may further our understanding of the why or how I'll be sure to share though.

  9. #9

    Default Re: How to create a new unit (for new modders): which guides and PFMs work for me

    Well good news. Tried again using a vanilla unit (euro_late_rifleman) and everything seemed to work fine. Also it seems that 1.5.3 is more suitable for the task of modding ETW. Although, I did discover that once you formulate your mod in 1.5.3, you can edit it without consequence in the current 4.1.2. Of other note, I was thinking more on the reason the DLC unit would crash. It could be that you're unable to make a call out to a dlc file for models and animations. That may explain why it would work if I used both the DLC Morgans Rifles and my new Morgans Rifles.

  10. #10
    onmy6's Avatar Miles
    Join Date
    Nov 2007
    Location
    New Zealand
    Posts
    338

    Default Re: How to create a new unit (for new modders): which guides and PFMs work for me

    Thanks Alwyn I've been screwing up abit on building ships/boats, I've been like looking at other mods to try and figure out how others have done it and I think I've been over complicating things, your tut on ship building has helped me stream line the implementation process .... So thanks dude big help
    Last edited by onmy6; May 26, 2017 at 05:51 AM. Reason: Advice: never drink and write on a forum, just ends up like gibberish lol

Posting Permissions

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