Jump to content

Checking wether a tool is in inventory for recipe in backback


Pvt_Per

Recommended Posts

Hi all,

 

only recently started modding the game, and I've gotten pretty far with the XML's. Now I run into a problem that the internet can't help me on, so it seems. So I pose the question here.

 

I wanna have a recipe for creation in my backpack, that CHECK wether or not a certain tool or item is in my backpack, without consuming it in creation of the recipe item.

 

Like how certain forge recipe's check if there is an Anvil there. I want for instance, a wire tool to be present in my backpack in order to create a (custom recipe for) lockpicks.

 

Please help, this has been eluding me for hours now.

 

Pvt.

Link to comment
Share on other sites

So what I would do here is lock the recipe by default. As in add a learnable tag to the recipe. Then I would make an effect group inside one of the status check buffs. This effect group would do something like this:

<effect_group>
           <passive_effect name="RecipeTagUnlocked" operation="base_set" value="1" tags="yourrecipehere">
              <requirement name="PlayerItemCount" item_name="youritemhere" operation="GTE" value="1"/>
          </passive_effect>

           <passive_effect name="RecipeTagUnlocked" operation="base_set" value="0" tags="yourrecipehere">
              <requirement name="PlayerItemCount" item_name="youritemhere" operation="LTE" value="0"/>
          </passive_effect>
</effect_group>

This would make it so if you have that item in your inventory, it unlocks the recipe. If you don't have the item, the recipe will be locked / relocked. Note I havent tested this exact code, but I've done something like this before, so it should work.

Link to comment
Share on other sites

Hi Telric,

 

thank you so much for your reply. I see the train of thinking you are on, and I understand the way you are trying to do it, and I really like it. But I would request a little help on the details.

You mention adding the effect group inside a 'status check buffs'. I don't understand what this means? What part of the code is that? Is it within the recipe itself?
Within the effect group there is mention of operation="GTE/LTE". Just for my better understanding, what does this attribute mean?

Basically what I am trying to do: I've created an item called a 'Whetstone'. My intention is to use this for repairing stone tools (axe, spear etc). I want the player to craft this item once. Then have one in their inventory, with which they can permanently keep repairing their stone tools.

 

I hope you can assist me once more.

 

Pvt.

Edited by Pvt_Per (see edit history)
Link to comment
Share on other sites

buffStatusCheck01
buffStatusCheck02

Look for those buffs in buffs.xml. They are always on the player, so adding an effect group to that buff would always be active.

The GTE stuff is greater than or equals. A few other options for that can be found in buffs.xml.

I'm not sure this method would work for a repair function though. I haven't really tried locking a repair behind something. Not even sure how to go about that really.

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...