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

Making a recipe gated by a perk.

Long story short, I've made stun baton parts (meleeWpnT2StunBatonParts) craftable  and I have managed to gate it behind the Electrocutioner perk.

The only problem, I don't know how to specify at what level to get it to unlock. I've attempted to modify the Tags="meleeWpnT2StunBaton" to tags="meleeWpnT2StunBaton,meleeWpnT2StunBatonParts" under the 1,5 which had no avail of working (should have assumed that).

If anyone smarter than me could inform me of a line to add that would be helpful.

https://pastebin.com/z0MeMQ55 (items.xml)

https://pastebin.com/SYUih2R8  (progression.xml)   I couldn't figure out how to remove xpath here.. remove xpath="/progression/perk[@type='perkElectrocutioner']/> had no avail so I don't know what to do about that.

https://pastebin.com/bV0tmzAS (recipe.xml) Don't mind the low resource costs, its just a placeholder until I'm able to gate it properly otherwise its useless anyway

 
You can specify the perk level of the recipe unlock by changing this in progression.xml: level="1,5"

If you want it unlocked at rank 3, for example, you'd use this

Code:
<passive_effect name="RecipeTagUnlocked" operation="base_set" level="3,5" value="1" tags="meleeWpnBatonT2StunBatonParts"/>
 
Last edited by a moderator:
You can specify the perk level of the recipe unlock by changing this in progression.xml: level="1,5"

If you want it unlocked at rank 3, for example, you'd use this

<passive_effect name="RecipeTagUnlocked" operation="base_set" level="3,5" value="1" tags="meleeWpnBatonT2StunBatonParts"/>

That works if i modify the core file directly, I'm currently finding a way to implement it into the passive group through append.

The XML gods and their nodes have taken pity and it works perfectly!

Thank you for the information, in some way you inspired me to to copy your line and just paste it under the existing line. May you have good fortune!

 
Last edited by a moderator:
I'm glad it works, but there's a cleaner way of doing it than appending the entire perk. This will add a new recipe unlock tag below the existing one, you just need to change the required perk level.

<insertAfter xpath="/progression/perks/perk[@name='perkElectrocutioner']/effect_group/passive_effect[@name='RecipeTagUnlocked'][@tags='meleeWpnBatonT2StunBaton']">
<passive_effect name="RecipeTagUnlocked" operation="base_set" level="1,5" value="1" tags="meleeWpnBatonT2StunBatonParts"/>
</insertAfter>




If you still want to append the perk for whatever reason, you should remove the existing perk using the remove xpath. Append adds code, it doesn't change it, so simply appending the perk will add a second copy of the perk and could cause issues.

 
I'm glad it works, but there's a cleaner way of doing it than appending the entire perk. This will add a new recipe unlock tag below the existing one, you just need to change the required perk level.

<insertAfter xpath="/progression/perks/perk[@name='perkElectrocutioner']/effect_group/passive_effect[@name='RecipeTagUnlocked'][@tags='meleeWpnBatonT2StunBaton']">
<passive_effect name="RecipeTagUnlocked" operation="base_set" level="1,5" value="1" tags="meleeWpnBatonT2StunBatonParts"/>
</insertAfter>




If you still want to append the perk for whatever reason, you should remove the existing perk using the remove xpath. Append adds code, it doesn't change it, so simply appending the perk will add a second copy of the perk and could cause issues.


<append xpath="/progression/perks/perk[@name='perkElectrocutioner']/effect_group">

    <passive_effect name="RecipeTagUnlocked" operation="base_set" level="3,5" value="1" tags="meleeWpnBatonT2StunBatonParts"/>

</append>

that is currently what i am using. I reversed the core file change and everything is working perfectly! I have considered removing it with xpath but this seems to work exactly as expected with no issues. I am simply adding this line after all

 
<append xpath="/progression/perks/perk[@name='perkElectrocutioner']/effect_group">

    <passive_effect name="RecipeTagUnlocked" operation="base_set" level="3,5" value="1" tags="meleeWpnBatonT2StunBatonParts"/>

</append>

that is currently what i am using. I reversed the core file change and everything is working perfectly! I have considered removing it with xpath but this seems to work exactly as expected with no issues. I am simply adding this line after all
Ah, okay. I was assuming you had appended the entire perk as that's what your first post showed. I'm glad you got it working.

 
Back
Top