Modding:Advanced JSON Item: Difference between revisions

From Vintage Story Wiki
m
No edit summary
m (→‎Variant Groups: fix typo)
Line 37: Line 37:
First, we add a new variant group with a set of possible variants. The name of the new group is <code>tooltype</code> and possible values are <code>"shovel"</code>, <code>"pickaxe"</code>, <code>"axe"</code>:
First, we add a new variant group with a set of possible variants. The name of the new group is <code>tooltype</code> and possible values are <code>"shovel"</code>, <code>"pickaxe"</code>, <code>"axe"</code>:
And within the group, we include this bit of code to tell the game to actually create three wand variants:
And within the group, we include this bit of code to tell the game to actually create three wand variants:
* <code>item-wand-shovel</code>
* <code>item-wand-pickaxe</code>
* <code>item-wand-axe</code>


 
We do this like so:
<syntaxhighlight lang="json">
<syntaxhighlight lang="json">
variantgroups: [
variantgroups: [
{ code: "tooltype", states: ["shovel", "pickaxe", "axe" ] },
{ code: "tooltype", states: ["shovel", "pickaxe", "axe" ] },
],
],
* <code>item-wand-shovel</code>
* <code>item-wand-pickaxe</code>
* <code>item-wand-axe</code>
</syntaxhighlight>
</syntaxhighlight>
 
Every variant will be added after the previous variant to the item name <code>item-myitemname-mygroup-mysecondgroup</code>. You can add as many variants as you want.
Every variant will be added after the previous variant to the item name <code>item-myitemname-mygroup-mysecondgroup</code>. You can add as many variants as you want.


Confirmedusers, Bureaucrats, editor, Administrators
1,522

edits