Resource_node, how to read it?

relatively simple question, with a probably less simple answer!

lets talk resource nodes:
i want to have my charcoal mound harvestable (when its done, so think tree thats done growing)
for 8-9 ish coal, and 2-3 ish clay. im not particular if this is always the same, or more randomised.
so i reverse engineerde what i could, and made this:

 "stonehearth:resource_node": {
         "durability": 10,
         "resource": "nordlingmod:charcoal",
         "resource_loot_table": {
            "entries": {
               "optional": {
                  "num_rolls": {
                     "min": 2,
                     "max": 2
                  },
                  "items": {
                     "pelt": {
                        "uri": "stonehearth:resources:clay:clay_mound",
                        "weight": 1
                     }
                  }
               }
            }
         }
      }

am i reading this right and are the random rolls done once-per-harvest-action total. or is it x times-per-chop?
so the above would either give me 10 charcoal, and 2 clay, or would it give me 10 charcoal, and 20 clay :’)?

@max99x maybe?

I believe it’s once per chop, but best to just try it. Also see loot_table.lua for a detailed explanation of the loot table format to make it randomized and weighted.

1 Like
         "durability": 10

Durability defines how many times the items will be “chopped”.
Each time it is chopped it will drop the item in the resource field, in that case your nordlingmod:charcoal

         "resource_loot_table": {}

Also runs every chop.

                  "num_rolls": {}

Means that each chop, that code will run that amount of times, randomly between min and max. In your case, always twice every chop.
If you do min 0 and max 10 then sometimes when they chop it will drop nothing, sometimes 1, or 2, 3… up to 10.

So everything considered, your item will be chopped 10 times, will drop 10 charcoal, and 20 clay.

3 Likes

perfect answer, thanks bruno you are a hero! :slight_smile:
(and now i understand why often imtems have rolls for empty air with weight to it)