Recipe with ingredient X OR ingredient Y

Hello,

I am trying to make a recipe that can use all pelts, except for the wolf pelt.
If I could use the wolf pelt, then I could have written the ingredient list like this:

“ingredients” : {
“material” : “pelt_resource”
“count” : 18
}

And then all pelts could be used, but that doesn’t work now that I cannot use the wolf pelts.

Is there a way to specify that either of two (or more) ingredients can be used?


Aslo, is it possible to have a way to say that multiple items can be harvested out of one pile using stonehearth:task_group:harvest?


This is part of the solution: (@BrunoSupremo should receive credit as well )

Hello,

If you want to, you could mixin a material tag on all pelts you’d want to be able to use for your custom recipe.

As an example, I’ll call this custom material tag “small_pelt”.

"stonehearth:catalog": {
         "material_tags": "stockpile_animal_part resource animal_part pelt small_pelt"
      }

(edited according to Brunos’ response)
Imagine I add the code above into my versions of the rabbit_pelt.json, racoon_pelt.json, etc.
Then, in my custom recipe I add the following:

"ingredients": [
      {
         "material" : "small_pelt",
         "count" : 1
      }
  ],

This recipe will now be able to use any material which include the tag “small_pelt”.

May not be the best way to do this, but it would be my way about it as I don’t know any way to exclude a specific material that is included within a tag.

my mixin file should look like this then, right?

{
“entity_data” : {
“stonehearth:catalog”: {
“material_tags”: “small_pelt”
}
}
}

It worked, thanks @Hamnisu.

small question, could this material tag also be used to describe loot drops, like this
"stonehearth:resource_node": {
“task_group_name”: “stonehearth:task_group:harvest”,
“resource” or “material” : “small_pelt”,
“harvest_overlay_effect”: “stonehearth:effects:mine_overlay_effect”,
“harvester_effect”: “mine”,
“description”: “mine”,
“durability”: 18
}

Glad to hear it worked for you - any time!

Answer based upon totally misunderstanding the question.. At least that's what I thought

To be honest, I do not know. Never looked into any loot-code.
If I peek into the existing racoon.json, I see this code:

"entity_data": {
      "stonehearth:harvest_beast_loot_table": {
         "entries": {
            "default": {
               "num_rolls": {
                  "min": 1,
                  "max": 2
               },
               "items": {
                  "jerky": {
                     "uri": "stonehearth:racoon_jerky"
                  },
                  "pelt": {
                     "uri": "stonehearth:resources:racoon_pelt"
                  }
               }
            }
         }
      },

I believe this code means that upon the death of a Racoon, a combination of pelt and jerky may be droped (1 or 2 items).
It seems in this case the code points to the uri itself; but I’d say there’s no harm in trying, right? :slight_smile:
If you are not able to have it work using this tag of yours, my suggestion would be to add aliases into your manifest-file and call thease instead.

Edit:

Answer based upon misunderstanding the question on my 2nd read..

Yes, @nikosthefan, you should be able to use this tag.
If I peek upon existing copper_ore.json, I see this code:

"entity_data": {
      "stonehearth:catalog": {
         "display_name": "i18n(stonehearth:entities.resources.copper.copper_ore.display_name)",
         "description": "i18n(stonehearth:entities.resources.copper.copper_ore.description)",
         "icon": "file(copper_ore.png)",
         "is_item": true,
         "category": "resources",
         "material_tags": "stockpile_ore copper ore resource"
      }
   }

Note the “material_tags” - I believe this is where you should add your small_pelt-tag.
I’m not too sure where the code you provided would be located; I have never looked into any kind of loot drops before, sorry.

Your first way of interpreting the question was the right one, (sorry if i misformulated it). Thanks for the effort though.

The answer you gave is useful so far as that I now know that I would be able to use it if I wanted the “stonehearth:harvest_beast_loot_table” to do the loot dropping work. I am currently using “stonehearth:resource:node” : { “task_group_name” : “stonehearth:task_group:harvest” } to make it work, the same code used for log piles.

In the cod you gave me, the variable that conveyed what item was in the loot was called “uri”. I know from the recipe’s json that you can replace that with “material” and then you can use “material_tags” to define the loot. In the code I use, this variable is called “resource”, so I have no idea.

1 Like

Well, I’m glad I was able to help somewhat; sorry for misunderstanding your question.
I’m sure you did not misformulate it - I just didn’t read it properly (twice!) :slight_smile:

1 Like

I got something working! :grinning:
“stonehearth:resource_node”: {
“task_group_name”: “stonehearth:task_group:harvest”,

                                       "harvest_overlay_effect": "stonehearth:effects:mine_overlay_effect",
                                             "harvester_effect": "mine",
                                                  "description": "mine",

    				      "resource_loot_table": {
       							   "entries": {
           								    "default": {
             								     "num_rolls": {
                       									  "min": 18,
                       									  "max": 18
                 										   },
           										 "items": {
              									      "pelt_1": {
                 										            "uri": "stonehearth:resources:rabbit_pelt",
               										         "weight": 1
                											  },
              									      "pelt_2": {
                 										            "uri": "stonehearth:resources:racoon_pelt",
               										         "weight": 1
                											  },
              									      "pelt_3": {
                 										            "uri": "stonehearth:resources:red_fox_pelt",
               										         "weight": 1
                											  },
              									      "pelt_4": {
                 										            "uri": "stonehearth:resources:squirrel_pelt",
               										         "weight": 1
                											  }
              										    }
           										}
        								       }
     							     }
                                            }

},

It is just that it doesn’t output just 18 pelts, but waaaay more. There is clearly something I don’t quite understand yet.

Good job! Now, all you have to do is to find that last issue :smiley:

Does it give you 72 items?
I’m thinking, perhaps the “num_rolls” is what you will get from each of the items. 72 = 18*4.

Perhaps something like this could work:

"resource_loot_table": {
   "entries": {
      "rabbit_pelt": {
           "num_rolls": {
               "min": 4,
               "max": 5
             },
           	"items": {
               "pelt": {
                  "uri": "stonehearth:resources:rabbit_pelt",
                  "weight": 1
              }
           	}
      },
      "racoon_pelt": {
           "num_rolls": {
               "min": 4,
               "max": 5
             },
           	"items": {
               "pelt": {
                  "uri": "stonehearth:resources:racoon_pelt",
                  "weight": 1
               }
           	}
      },

and so on?

Note: this is strictly based on guessing on my end.

If you do:

"stonehearth:catalog": {
    "material_tags": "small_pelt"
}

It will erase all the other tags and make it not work for other things that rely on them.
Change it to this:

"stonehearth:catalog": {
    "material_tags": "stockpile_animal_part resource animal_part pelt small_pelt"
}

So, a mixin of the “stonehearth:catalog” does not simply import the tag into the existing list of tags?
This is good to know! xD

Thank you Bruno!

Yep, that is because it is not a new key/value pair like in most of the json. It is just a string, a text.

It is like changing a name of an item, you just replace the text.

This is something I talked about in a post, suggesting it to change into a proper list of tags, so we can simple add them instead of replacing the whole text, here:

I was not aware of this - I was thinking “it must be implemented as a key/value pair”.
Thank you for pointing it out, Bruno; you’re ever so helpful!

Edit: after writing it, I now realize the material-tag is missing the [].
So, it should not have been too difficult to figure out it was a string in the first place…

I had way more than 72, i didn’t count but the numbers for individual pelts were sometimes in the 60’s. I changed the weights to 0.25 (which should work, were your theory to be true), but I still got a total amount of 216 pelts.

But that raises the question what number even determines how much pelts you get. It is not the weight, clearly, and also not the numroll. I mean 216 is 12*18(<-- numroll) but still, is that a connection. (I don’t believe so anyway)

You are getting a lot of items because you said it you roll 18 times, for each time a hearthling hits it to harvest

Just change the rolls to 1.

“durability”: 18 is how many hits a hearthling will do while harvesting it, each hit will drop the amount of “rolls” you set.

1 Like

It worked, kind of.
I did what you said, and setting the weights each back to 1, and I got out 12 pelts.

I have another question (I hope I am not too annoying :sweat_smile:). Is it necessary to output the same number of pelts every time?

The weights are the chances. If all weights are the same, they all have the same chance to drop. If one has 15 weight and another item just 3, this means it is more likely that the first item will drop instead of the second, with a 15:3 ratio.

Only one item will drop, based on the chances of their weights.

The num_rolls is how many times items will drop the items in each harvest.

The durability is how many times that item can be harvested until it breaks.

If you have 2 durability, and num_rolls min 3 and max 4, this means they will harvest it twice, and each harvest will drop 3 or 4 items, with those with higher weights having more chances to be the ones dropped instead of the ones with lower weights.

No, if you set the min and max values of the num_rolls to different values, it will vary randomly between the two intervals. A min 1 and max 10 means each harvest hit will sometimes have a value of 5, or 3, or 7, each harvest is random between those min and max values.

1 Like

Here is the thing, I didn’t. The min num_rolls was 1, and so was the max num_rolls. I understood everything you said the first time. I didn’t know for sure the first time that it would be consistent, but I assumed it was, when you had num_roll min and max at the same number. But when I tested it in game, I only got 12 pelts, and not 18, so maybe the system was not so consistent after all, and there is a chance that it sometimes doesn’t spawn things altogether. So I asked the question, but apparently it should actually have been 18 pelts. But the game does not agree with you, so it is just weird.

I guess I will do some experimenting…


So, after an experiment that didn’t work out, I tried how the old system behaved if I harvested more piles. The first one gave 12 pelts, again (this is the same in-game pile,
already in the save file when I loaded it to test), but all others (piles I spawned in after loading the game) consistently spat out 18 pelts.

So I guess the theory that explains all of this is that the changed loot_table only affect newly placed items, and not older ones. This still doesn’t explain why the 12 pelts came out of the first one, (I have no clue where that came from, the last time 12 was in that item was for how many pelts you needed for crafting and got when harvesting, before I changed it from 12 to 18, but that was already removed way before I started messing, or even introducing the new loot table) but it works now, so I won’t be complaining.

Thanks for the support @BrunoSupremo and @Hamnisu.

1 Like

What is your durability? That is what defines how many times the object will be harvested.
If it is not 12, then you probably have some item incorrect, as the game simple spawn nothing for those and in the end you get less items as result.

It once was 12, but I changed that long before I started messing with the loot_table. Scince I changed it, it has been 18.

Ohh, wait, I know what it is. If the durability only updates when you replace an item in the world, (which I didn’t do often, I would just have a save game where I stored a certain setup, and reloaded that over and over again to test the changes I made) then it may be that I never replaced the pile I was testing from since the era that it had a durability of 12.

The world makes sense again.

Yes, all the json files are saved in the objects, so everything that is already placed will not update. Just moving it around will not be enough. You need a new item.

1 Like