This is perhaps my first 'proper' mod and certainly my most involved mod to date.
The number of adjustments it makes would be too much to walk through step-by-step in its entirety here, so instead let's have a look at just one or two additions that it makes and you can extrapolate the rest from there!
This was written during A20. A21 made quite a few changes to how things are learnt, but the general premise is the same.
Make the Stone Club require learning
There are 3 files that require adjusting in order to make this most basic of items require learning:
recipes.xml:
<setattribute xpath="//recipe[@name='meleeWpnClubT0WoodenClub']" name="tags">learnable,perkPummelPete</setattribute>
Simple addition here, find the wooden club recipe and tag it as "learnable", this means it will need learnt before it can be used.
items.xml:
<item name="meleeWpnClubT0WoodenClubSchematic">
<property name="Extends" value="schematicMaster"/>
<property name="CreativeMode" value="Player"/>
<property name="CustomIcon" value="meleeWpnClubT0WoodenClub"/>
<property name="Unlocks" value="meleeWpnClubT0WoodenClub"/>
<effect_group tiered="false">
<triggered_effect trigger="onSelfPrimaryActionEnd" action="ModifyCVar" cvar="meleeWpnClubT0WoodenClub" operation="set" value="1"/>
<triggered_effect trigger="onSelfPrimaryActionEnd" action="GiveExp" exp="50"/>
</effect_group>
</item>
Above is the big one: create the schematic for the wooden club, mark that it unlocks the wooden club, and set the graphic for it to the wooden club image.
Localization.txt:
meleeWpnClubT0WoodenClubSchematic,items,Melee,,,Wooden Club Schematic
Finally, make sure the new schematic has an entry in the localization file so that it gets a proper name for labels.
Make the Frame Shapes require learning
Frame Shapes are slightly different from Stone Clubs in that they aren't considered items, they are blocks, so although we make similar additions to recipes.xml and Localization.txt, instead of editing items.xml we have to edit blocks.xml:
blocks.xml:
<append xpath="//block[@name='frameShapes']">
<property name="UnlockedBy" value="frameShapesSchematic"/>
</append>
To set what schematic a block is unlocked by we add the "UnlockedBy" property to it and add the schematic we want it to be.
Make the Schematics findable
It isn't enough to just create the schematics and make them require reading before the given items can be crafted, we also need to make it so the player can find them!
We do this 2 ways, first through looting:
loot.xml:
<!-- Create a group with all the new schematics -->
<insertAfter xpath="//lootgroup[@name='schematicsElectrical']">
<lootgroup name="schematicsEverythingNeedsLearntMod">
<item name="meleeWpnClubT0WoodenClubSchematic"/>
<item name="ammo9mmBulletBallSchematic"/>
...
</lootgroup>
</insertAfter>
<!-- Add the new group to this group -->
<append xpath="//lootgroup[@name='booksAllScaled']">
<item group="schematicsEverythingNeedsLearntMod" loot_prob_template="high"/>
</append>
<!-- And to this group -->
<append xpath="//lootgroup[@name='groupSchematicsAll']">
<item group="schematicsEverythingNeedsLearntMod" loot_prob_template="high"/>
</append>
<!-- And to this group -->
<append xpath="//lootgroup[@name='groupMailbox01']">
<item group="schematicsEverythingNeedsLearntMod" loot_prob_template="ProbT0"/>
</append>
First we create a new loot group that has all our new schematics, then we add that new loot group to two existing, book related loot groups so that it becomes part of them and finally we add it to a Mailbox group to give a reasonable chance of finding them in the early game.
Then we make the schematics obtainable through trading:
traders.xml:
<!-- Create a group with all the new schematics -->
<insertAfter xpath="//trader_item_group[@name='schematicsElectrical']">
<trader_item_group name="schematicsEverythingNeedsLearntMod">
<item name="meleeWpnClubT0WoodenClubSchematic"/>
<item name="ammo9mmBulletBallSchematic"/>
...
</trader_item_group>
</insertAfter>
<!-- Add the new group to this group -->
<append xpath="//trader_item_group[@name='commonBooks']">
<item group="schematicsEverythingNeedsLearntMod" prob="42"/>
</append>
Again we create a new loot group that has all our new schematics, then we add that new loot group to an existing, book related trader item group so that it becomes part of it.
And that's the jist of it!
I'll probably refine this over time, tweaking what does and doesn't required learnt and also adjusting the probabilities for finding certain items, but for now I'm happy with what is a pretty fun and challenging mod.