Jump to content

References in content script hurdle


Go to solution Solved by xXx_Ape_xXx,

Recommended Posts

  • Solution
Posted

Not entirely sure what you're asking here, but do you mean that the chisel should be of the same metal type, or better, when used in the recipe?

If so, you'll have to, unfortunately, make specific recipes for each metal type, and add a list of valid metals for the chisel via "allowedVariants".

       "C": { type: "item", code: "game:chisel-*", isTool: true, toolDurabilityCost:10, allowedVariants: ["copper","tinbronze","iron"],

 

  • Like 1
Posted
2 hours ago, xXx_Ape_xXx said:

Not entirely sure what you're asking here, but do you mean that the chisel should be of the same metal type, or better, when used in the recipe?

If so, you'll have to, unfortunately, make specific recipes for each metal type, and add a list of valid metals for the chisel via "allowedVariants".

       "C": { type: "item", code: "game:chisel-*", isTool: true, toolDurabilityCost:10, allowedVariants: ["copper","tinbronze","iron"],

 

Thanks for the reply! I like the notion of an array. That is, essentially, the rule I'd like to enforce.. You shouldn't be able to break down steel items with a copper chisel. And if you were able to break down a higher tier of metal with a lower tier, it should cost a good deal more durability to do it. 
In my imagination, I just pull the value of the metal tiers of C-I into a variable, and then if that number has a negative value, the recipe is invalidated. 
I mean, really, I'd like to be able to group all of the similar item types into an array to simplify the amount of code it seems to take to perform a similar operation on many different, but similar items.. It seems like there is a lot of redundancy in the JSON scripts, but what do I really know about JSON scripting? I'm sure there is a logical reason for the way everything is structured, but I've still a lot to learn how all of these gears here operate and fit together. I missed being able to replace "name" with the "allowedVariants", which should be fairly useful when I give it some time to culture.
Thanks again!

Posted

@ThornRanger

C is the variable name could be X y or Z. Does not really matter the letter. Its just a variable name. C and I represent the location in the Grid as well for the pattern you need to use to build the object. Ape showed you an array that has a structure you need to follow:

C = variable name or allies name

type = item because the tool chisel is a item and not a block

code: "game:chisel-*" - The game portion is you telling VS you want to use base game item chisel and not your own "chisel is the item name and -* means use any chisel copper, iron etc

istool Basically saying this item is a tool so it has a durability 

toolDurabilityCost - is how much durability you want to remove from the tool when crafting

allowedVariants are the different chisel variants or tool variants allowed to use to craft this object

 

If you look at other scripts in grid crafting, you will see similar "patterns" used. @xXx_Ape_xXx did a great job showing you a in depth sample of grid crafting. most recipes are pretty basic but this one is nice and in depth. JSON is a pretty literal scripting language. Just like learning any language, it will become second nature over time.  

 

  • Like 1
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.