[I will add some images of the process and expand some parts of the tutorial once the forum starts to behave, I lost part of my post two times before I managed to post it ]
Hey, guys!! Since a lot of people are wondering about this and I have made some progress, I will try to guide you through the process. English is not my native language and I have never done a tutorial before so bear with me.
Before we begin you should read daniu's Warscape Modding Primer, especially if you have not meddled with warscape and PFM before.
So, let's start
1) What you will need.
From the data_rome2.pack the absolutely necessary db tables you will need to extract and add to your mod are the following:
buildings_units_allowed --> Which buildings are required to recruit your unit.
land_units --> Contains important unit stats will, be discussed below.
land_units_to_units_ability_junctions --> What abilities the unit has.
main_land_units --> More unit stuff such as cap limits, recruitment times, types etc.
naval_units --> same as three rows above but for naval (add this only if you want to add naval units)
naval_units_to_units_ability_junctions --> same as three rows above but for naval (add this only if you want to add naval units)
unit_set_to_units_junctions --> In which unit groups the unit belongs to.
unit_variants --> Which variantmeshes, UI icons etc the unit uses.
units_custom_battle_permissions --> Which factions can use the unit in custom battles.
units_to_groupings_military_permissions --> Which factions can use the unit.
Other tables you might need depending on what you want to do with your new unit:
From the local_en.pack you will need some text\db files, namely:
land_units.loc --> all land units are listed here. If a unit is not here it won't be in the game.
naval_units.loc --> guess what?? same for naval units
unit_description_short_texts.loc --> a mini customized description of the unit. If you make one you will need to add the unit_description_short_texts db table and add its entry there.
unit_description_historical_texts.loc --> a more detailed description of a unit or a class of units. If you make one you will need to add the unit_description_historical_texts db table and add its entry there.
For custom unit textures: (I will expand this one with another example soon)
2) A simple example
So we will create a basic Periokoi cavarly unit for the spartan faction that is so popular right now.
First we extract all the db files from part 1, except from those in the spoilers and those for the naval units, and add them to our mod.
Note: On all tables click on top of the unit/unit key etc column so they will be placed in alphabetical order. This will make your life a lot easier since you can then fight units fast by their national prefix.
Now we will go to our first db table, that would be buildings_units_allowed. There are four improtant columns here: building (the building which is required to recruit the unit), unit (the key of your unit), xp ( the starting xp of the unit) and key (a unique number that indentifies each row).To make our life easier we will find a line that has the building we need and click clone row. Then in the unit field we will type the key of our unit, lets make it Gre_Periokoi_ Cav.
Our unit will be recruited from the second level of main military buildings and above. Search among the greek units to find a suitable building entry and use it. We have to repeat the process for all the buildings in the chain. We will leave the starting xp to zero except for the hero shrine building. Finally we will set the keys to each row. What I usually do is quickly find the largest first digid and go some thousands upwards.
Now to the second table, land_units. The order of this table's columns is a little messy. Move the bottom par right until you find the unit key and sort it out again alphabetically. Many things to see here and most columns do something. I will skip those with stat values as they are pretty much self-explanatory and will briefly describe some of the other to the best of my ability.
We will find a unit with the general qualities we want and clone its row. Gre_Light_Cav seems like a good choice. We change the key to Gre_Periokoi_Cav and tweak the stat values to our liking.
Some more specific info:
Third table, land_units_to_units_abilities_junction is one of the easiest tables. Simply we will clone the rows with the abilities we want and paste our unit key. Let's give our low level cavalry unit the diamond formation.
Fourth table is main_land units. The second most tiresome table but still easy compared to land_units. Things that can be done here is set recruitment limits, time and costs. We will find the Gre_Light_Cav and clone it then proceed to make our changes. Here we will put our unit key to both land_unit and unit columns.
Fifth table is unit_set_to_unit_junctions. Again this is straight forward. We will find the sets are unit belongs to, clone the rows and paste our key.Our Periokoi caralry will need cavalry_units_hellenic and melee_units_spear. Check other units to get an idea of which units go where.(units_sets table contains the available sets)
For now skip variant_units and go to units_custom_battle_permissions. Again things are pretty easy. We will find the entry of a spartan unit, clone it and change the key to Gre_Periokoi_Cav.NOTE: Units that are recruitable both normally and as general's bodyguard need to entries here one with true and one with false in that column.
Second last table, units_to_groupings_military_permissions. Another easy table. We are getting spoiled!!! Just copy a spartan unit and paste in our key.
Now to the final db table, unit_variants. Here we can set our units variantmeshes and unit cards, as well as change its predetermined from the man_entiry column height. For this expample we will use variantmeshes and unit cards that are already in the game, cause you are probably tired and possibly frustrated or bored by now and want to end this. I know I am frustrated cause the forum ate my post and I had to re-write some stuff. Once more we will copy the Gre_Light_Cav unit, leave its unit card and variant untouched and change the unit and name columns to Gre_Periokoi_Cav.
That's it!!! We are done!!! ...With the db tables. I am joking we are almost done here .
Now we will go to text\db and open land_units.loc
We will add a new row and write exactly the text of a vanilla entry: land_units_onscreen_name_Gre_Periokoi_Cav. In the localized string entry we will put our units in-game name. Lets name it Periokoi Cavalry!! Yeah, that is so unique!!!
Time to save the pack. Go to the postprocess menu and click rename all. Use any prefix you like. Then again from the postprocess menu click minimize db files. During those to operations PFM might seem to freeze but that is normal. It will add the prefix optimized_ to you mods name.
Alright let's test the pack. Place it in your ROME II data folder, the run Mod Manager, select it and run the game.
That is believe. I hope I did not tire you. Please let me know of any mistakes so I can correct them or inform me on things to add.
Infinite credits to daniu for PFM and all the people who worked for the schema files. Also to .Mitch. for his great Mod_Manager.