Jump to content

Unlocking recipes with skill increase?


Trosski

Recommended Posts

I have a mod that adds new food to the campfire and I have it showing up in all the correct places. I don't get any warnings and the food icon shows up in the craftingFood skill window,, but attaining the correct skill level doesn't unlock the recipe. I have been wracking my brain and scouring the code for mistakes, but everything looks correct. Anyone else have this problem, and maybe found a solution to get the recipe unlock to work?

 

This is the Items.xml code

<append xpath="items">
		<item name="foodCornDogs">
			<property name="CustomIcon"         value="foodCornDogs"/>
			<property name="Tags"          		value="food,foodSkill"/>
			<property name="HoldType"      		value="31"/>
			<property name="DisplayType"   		value="food"/>
			<property name="Meshfile"      		value="#Other/Items?Misc/parcelPrefab.prefab"/>
			<property name="DropMeshfile"  		value="#Other/Items?Misc/sack_droppedPrefab.prefab"/>
			<property name="Material"       	value="Morganic"/>
			<property name="Stacknumber"   		value="10"/>
			<property name="EconomicValue" 		value="63"/>
			<property name="UnlockedBy"     	value="craftingFood"/>
	
			<property class="Action0">
				<property name="Class"       	value="Eat"/>
				<property name="Delay"      	value="1.0"/>
				<property name="Sound_start" 	value="player_eating"/>
			</property>
	
			<property name="Group"         		value="Food/Cooking,CFFood/Cooking"/>
	
			<effect_group tiered="false" name="Food Tier 2">
				<triggered_effect trigger="onSelfPrimaryActionEnd" action="ModifyCVar" cvar="$foodAmountAdd"           		operation="add" value="44"/>
				<triggered_effect trigger="onSelfPrimaryActionEnd" action="ModifyCVar" cvar=".foodStaminaBonusAdd"      	operation="add" value="20"/>
				<triggered_effect trigger="onSelfPrimaryActionEnd" action="AddBuff"    buff="buffProcessConsumables"/>
			</effect_group>
		</item>
	</append>

Here is the Recipes.xml code

<append     xpath="/recipes">
	<recipe     name="foodCornDogs" count="1" craft_area="campfire" craft_tool="toolCookingPot" craft_time="20" tags="perkMasterChef,learnable">
		<ingredient 	name="foodRawMeat"             count="1"/>
		<ingredient 	name="resourceAnimalFat"       count="1"/>
		<ingredient 	name="foodCornMeal"            count="1"/>	
		<ingredient 	name="resourceWood"            count="1"/>		
	</recipe>   
</append>

And this is the Progression.xml code

<append xpath="//crafting_skill[@name='craftingFood']/display_entry[@icon='foodPumpkinBread,foodPumpkinPie,foodPumpkinCheesecake,foodMeatStew,foodSteakAndPotato']">

	<unlock_entry item="foodCornDogs,resourceAnimalFat" unlock_tier="1" />

</append>

 

Like I said. everything shows up correctly, and all of the code looks fine to me, but the recipe just doesn't unlock. I am stumped. if anyone could help me see what I am missing, that would be much appreciated.

Link to comment
Share on other sites

Your progression path is wrong

 

You are putting the unlock entry in the display entry section.

 

path should be

 

"//crafting_skill[@name='craftingFood']/effect_group/passive_effect[@tags='foodCornOnTheCob,foodBakedPotato']"

 

Would recommend using insertBefore if you want it to start unlock.

 

Also the correct code for setting it up to unlock is not unlock_entry but

 

<passive_effect name="RecipeTagUnlocked" operation="base_set" level="1,100" value="1" tags="foodCornDogs,resourceAnimalFat"/>

 

where the first number in level would be the number of magazines to unlock

 

Also why do you have resourceAnimalFat there?  Are you able to make it now (didn't see an example of the recipe)?  If not, it doesn't have to be unlocked.

Link to comment
Share on other sites

I was going off what the vanilla unlock looked like. There is no <passive_effect> in the vanilla code. I will give it a try, but the <unlock_entry> is and extended branch of the <display_entry> line.

 

Are you perhaps saying, the <unlock_entry> only adds the icons to the skill window, and I need the <passive_effect> in the main <effect_group> branch to do the actual unlocking? This is why I hate the xml code for this game.... every mod I look at for code examples is different, and none of them are doing exactly what I am looking for. Thanks for the suggestion. I will try it.

 

Also the Animal fat is another recipe that I added. It's required for a lot of recipes I am implementing. The modlet my firends and I made reduces the meat requirements for all of the recipes in the game, and greatly reduces the amount of meat you get from animals. It's just a QOL mod that my friends and I play with. It's not something we are considering releasing, because it is kind of a Frankenstein's Monster of various mods patch worked together. I am just updating it for A21 and was having trouble with this one piece. There are other recipes that I was having this same problem with as well, like Dye crafting, and recipes to make canned food. I was just using the corn dog recipe as an example, because all of the entries are pretty much the same.

Edited by Trosski
spelling correction and addition of context. (see edit history)
Link to comment
Share on other sites

Everything works. New code looks like this.

<append xpath="//crafting_skill[@name='craftingFood']/display_entry[@icon='foodPumpkinBread,foodPumpkinPie,foodPumpkinCheesecake,foodMeatStew,foodSteakAndPotato']">

		<unlock_entry item="foodCornDogs,resourceAnimalFat" unlock_tier="1" />

</append>

<append xpath="//crafting_skill[@name='craftingFood']">
	
	<effect_group>
		<passive_effect name="RecipeTagUnlocked" operation="base_set" level="11,100" value="1" tags="foodCornDogs,resourceAnimalFat"/>
	</effect_group>

</append>

Thanks for the help! I'm glad it was just something I was overlooking.

Still needed the display_entry path to make the icons show up in the skill window.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...