• If you have a mod, tool or prefab, please use the Resources section. Click Mods at the top of the forums.

Adding schematic locked items

dalves69

New member
I usually find a solution to modding problems online. However, this one I cannot find what I'm doing wrong. I am adding schematics for each of the Pipe-Based guns in A20. The schematics are there and work, but the guns themselves are unlocked even though in-game it says that you need that gun's schematic to unlock it. Below is a clip of the code I have currently. Any feedback is appreciated.

<append xpath="/items">

    <item name="gunHandgunT0PipePistolSchematic">
    <property name="Extends" value="schematicMaster"/>
    <property name="CreativeMode" value="Player"/>
    <property name="CustomIcon" value="gunHandgunT0PipePistol"/>
    <property name="Unlocks" value="gunHandgunT0PipePistol"/>
    <effect_group tiered="false">
        <triggered_effect trigger="onSelfPrimaryActionEnd" action="ModifyCVar" cvar="gunHandgunT0PipePistol" operation="set" value="1"/>
        <triggered_effect trigger="onSelfPrimaryActionEnd" action="GiveExp" exp="50"/>
    </effect_group>
    </item>
   </append>

<append xpath="/items/item[@name='gunHandgunT0PipePistol']">
    <property name="UnlockedBy" value="perkGunslinger,gunHandgunT0PipePistolSchematic"/>
</append>

 
You need to add the tag learnable to the item in the recipe file

<recipe name="ammo9mmBulletBallDummy" count="1" craft_area="workbench" tags="learnable,workbenchCrafting">




Then the game creates a cvar for it that can be unlocked via a schematic (or in my case, a note I created)

 
Thank you. I will give that a shot.

I was referencing how another mod schematic worked, but was looking for clues to something I missed in the "Items" XML.

 
For your reference, this is what I did for vanilla iron arrows in my mod

Code in vanilla

<recipe name="ammoArrowIron" count="1">




My code

    <setattribute xpath="/recipes/recipe[@name='ammoArrowIron']" name="tags">learnable,workbenchCrafting</setattribute>

    <setattribute xpath="/recipes/recipe[@name='ammoArrowIron']" name="craft_area">workbench</setattribute>




It added tags to the recipe line and made iron arrows a learnable recipe that now needs to be crafted at the workbench.  You can do the same thing with pipe weapons (but drop the workbenchCrafting and second line so it is not required to be crafted in a workbench).

 
Thanks, I will try this.

I made a mod with a Basic Crafting Bench for the beginning of the game that you would use to build items at the start of the game. I may try having it so the pipe guns will be built there too.

 
Back
Top