I'll be going over how to add a new Skill here. This includes introducing an item (Skillbook) that allows the Skill to be learned/used. This part uses knowledge from the above sections. The example I will be using is the custom Fire rain skill I added to the game in one of my other mods.
The first thing that all Skills need is a Stats/Generated/Data entry. Within a txt file within your mod's Stats/Generated/Data/ folder, you can copy/paste the pertinent information from the Main campaign's SkillData.txt file to use as a template to which you make changes.
This is the Skill entry I ended up with for my Fire Rain skill-
new entry "UNFAIR_Rain_Fire"
type "SkillData"
data "SkillType" "Rain"
data "Ability" "None"
data "Element" "Fire"
data "ActionPoints" "5"
data "Cooldown" "40"
data "ChargeDuration" "0"
data "Lifetime" "5"
data "SurfaceType" "Fire"
data "SurfaceLifetime" "12000"
data "SurfaceStatusChance" "100"
data "SkillProperties" "CreateSurface,2,5,Fire,100;TargetCreateSurface,1,5,Fire,100;Hasted,200,5"
data "TargetRadius" "15"
data "UseCharacterStats" "No"
data "UseWeaponDamage" "No"
data "AreaRadius" "15"
data "TotalSurfaceCells" "125"
data "SurfaceGrowStep" "5"
data "SurfaceGrowInterval" "150"
data "Icon" "Skill_Fire_Haste"
data "DisplayName" "UNFAIR_Rain_Fire_DisplayName"
data "Description" "UNFAIR_Rain_Fire_Description"
data "StatsDescription" "UNFAIR_Rain_Fire_StatsDescription"
data "FXScale" "100"
data "PrepareAnimationInit" "cast_long_start"
data "PrepareAnimationLoop" "cast_long_loop"
data "PrepareEffect" "FX_Skills_Fire_Summon_Prepare_A"
data "CastAnimation" "cast_long_cast"
data "CastTextEvent" "cast"
data "TargetEffect" "FX_GP_Target_Fire_A"
data "Magic Cost" "1"
data "RainEffect" "FX_Env_RainFire_A"
data "Atmosphere" "Rain"
data "ConsequencesStartTime" "1000"
data "Skillbook" "SKILLBOOK_UNFAIR_Rain_Fire"
new entry "UNFAIR_Rain_Fire_10"
type "SkillData"
using "UNFAIR_Rain_Fire"
data "Level" "10"
Now I won't be going over what every line does; it's just important to know that different skill types (Rain, Projectile, etc) make use of different parameters.
There are a few important lines though-
new entry "UNFAIR_Rain_Fire"
type "SkillData"
As before, this tells the game that this is a SkillData entry, as well as its name (UNFAIR_Rain_Fire).
Further down you see
new entry "UNFAIR_Rain_Fire_10"
type "SkillData"
using "UNFAIR_Rain_Fire"
data "Level" "10"
All skills have something similar; it tells the game which level the Skill is (important for determining how much your levels affect the skill effects), and the "data "Level" "10" " line says this Skill can be learned at Level 10.
Going back up a bit-
This tells the game that it belongs to the Pyrokinetic school of magic. If this were set to a different value, it would go into a different skill school instead.
data "DisplayName" "UNFAIR_Rain_Fire_DisplayName"
data "Description" "UNFAIR_Rain_Fire_Description"
data "StatsDescription" "UNFAIR_Rain_Fire_StatsDescription"
These lines are important for getting the game to display the name and description for your custom skills.
Within the Editor, at the top there is the button that says TranslatedStringKey. If you enter that menu, a window pops up. Create a new file.
You will then need to enter a series of Key and Content pairs. For your skills, the Keys are what you put after the "DisplayName" "Description" and "StatsDescription" of your SkillData. My TranslatedStringKey file for my custom Fire rain skill looks something like this-
Key: UNFAIR_Rain_Fire_DisplayName
Content: Wild Fire Rain
Key: UNFAIR_Rain_Fire_Description
Content: Bring forth a fire rain that hastens friend and foe alike.
Key:UNFAIR_Rain_Fire_StatsDescription
Content: Radius: 15m<br>Duration:5 turns<br><br>Creates fire on terrain. Hastens all targets for 5 turns, and creates fire underneath each target at the start of their turn for 5 turns.
The TranslatedStringKey goes into your Mod's Data/Mods/(Mod Name)/Localization/ folder.
----
After creating the SkillData entry (and its Localization file), the next part is to create a Skillbook RootTemplate with which it can be used. Because it's a fire skill, I can create a new RootTemplate from any existing Fire Skillbook Template.
In the Editor, I go to the Template viewer and search the Books_Scrolls for "Skill_Fire" I right click the "Book_Skill_Fire_Haste" entry, and click "Create new from selected." In the box that comes up, I set the FilePath to my mod's RootTemplate folder, and set the Displayname and File Name to whatever I'm wanting. Then I finish its creation.
Selecting the new RootTemplate that was just created, you can set various values for it. But there's one other step to do beforehand, which is to create a Stats entry for this book itself.
In my mod's Stats/Generated/Data folder, I add these to a new (or old) txt file-
new entry "_Skillbooks"
type "Object"
data "ModifierType" "Item"
data "Act" "1"
data "UseAPCost" "6"
data "Value" "7"
data "Weight" "500"
data "Requirements" "Level 4"
data "InventoryTab" "Magical"
new entry "SKILLBOOK_UNFAIR_Rain_Fire"
type "Object"
using "_Skillbooks"
data "Act part" "10"
data "Requirements" "Level 10"
Now I can set the RootTemplate's Stats to "SKILLBOOK_UNFAIR_Rain_Fire" and set it's OnUse action to learn the "UNFAIR_Rain_Fire" skill (note- you might have to reload the Editor to get these options to show up, since it needs to load the new Stats files)
The last step in getting a fully functional Skillbook into the game is to create a txt file in the Stats/Generated/Links/ folder. The Links folder is how the game can link a Stats entry to a RootTemplate.
Here is my mod's Links file for the Fire Rain skill-
object itemstat "SKILLBOOK_UNFAIR_Rain_Fire","ea880242-8ee0-4719-b969-325b252049d3","",0,0,"SkillbookFire",1,1,8,0,8,20
There are really three important parts to this line-
object itemstat "SKILLBOOK_UNFAIR_Rain_Fire","ea880242-8ee0-4719-b969-325b252049d3"
This part is what links my Stat entry to the RootTemplate's GUID (that string of letters and numbers).
This is what the game refers to as an "object category". It can be anything you want. This is what the game looks at when it's looking to add random items to something. For example, the Fire vendor will randomly add items with the object category "SkillbookFire" when its determining its inventory; this is what allows my custom item to show up in the game.
MinAmount | Max Amount | Priority | ??? | Min Level | Max Level |
The first two state how many can be stacked in your inventory I believe. I'm not sure about Priority (its 8 or 10 for skillbooks apparently). The Min Level and Max Level describe at what levels your item can be found. In my case, you can find the book starting at level 8. If you set this to 1, you would be able to purchase it from a vendor at the beginning of the game.