HOW TO: Create a Crafting Station + create Custom Recipes

Discussion in 'Starbound Modding' started by Dragonchampion, Dec 6, 2013.

  1. Dragonchampion

    Dragonchampion Subatomic Cosmonaut

    Hello everyone! After fiddling around tonight, I managed to create my own crafting station, and give it its own specific recipes. This little tutorial will teach you how to do the same, meaning we will be able to see mods with custom ores, metallurgy, and much much more.


    STEP 1:
    Archives. You want an archive of everything. If you have Winrar or 7zip, right click your assets folder in steam/steamapps/common/Starbound folder, and zip it. this will create an archive copy in case anything goes wrong.


    STEP 2:
    First off, you will need to actually create the station item itself. This is the starting point of any item mod. To create this, all you do is go into your Starbound/assets/objects/generic and find the folder named "woodencraftingtable1". Right click this and copy it, renaming the copy to whatever you want. For the purposes of this tutorial, we will be making an alchemy table, so we will name it "woodenalchemytable".


    STEP 3:
    Next, you will need to go into that folder, and rename all four of the items in that folder. The four items are "woodencraftingtable1.frames", "woodencraftingtable1.object", and two picture files, named "woodencraftingtable1.png" and "woodencraftingtable1icon.png" Rename all of these to "woodenalchemytable" where nessessary. You should then have the four files renamed to "woodenalchemytable.frames", "woodenalchemytable.object", "woodenalchemytable.png" and "woodenalchemytableicon.png".


    STEP 4:
    You will need Notepad++ for the cleanest and easiest experience with modding. I STRONGLY suggest it. It' a free download that can be gotten here. After you get that, right click on the "woodenalchemytable.object" file, and click "Edit with Notepad++". it will open it up and you will see the following:

    Code:
    {
      "objectName" : "woodencraftingtable1",
      "rarity" : "Common",
      "objectType" : "interactable",
      "interactAction" : "OpenCraftingInterface",
      "interactData" : {
        "config" : "/interface/windowconfig/craftingtable.config",
        "filter" : [ "craftingtable", "plain" ]
      },
      "printable" : false,
      "description" : "An expert craftsman could make a great... crafting table... on this.",
      "shortdescription" : "Wooden Crafting Table",
      "race" : "generic",
      "category" : "crafting",
      "price" : "200",
    
      "apexDescription" : "A table with a bunch of tools for a craftsman.",
      "avianDescription" : "A chance to display one's ability to create.",
      "floranDescription" : "Floran ussse table. Make nice thingss.",
      "glitchDescription" : "Inspired. Crafting module activated.",
      "humanDescription" : "I can use materials I've found here to create new things.",
      "hylotlDescription" : "A chance to create.",
    
      "inventoryIcon" : "woodencraftingtable1icon.png",
      "orientations" : [
        {
          "dualImage" : "woodencraftingtable1.png:<color>",
    
          "imagePosition" : [-16, 0],
          "frames" : 1,
          "animationCycle" : 1.0,
    
          "spaceScan" : 0.1,
          "anchors" : [ "bottom" ],
          "collision" : "platform"
    
        }
      ]
    }
    
    This will overwhelm a first time modder unless you know coding, but fear not! You don't have to mess with much at all! First, you will need to change the Objectname to "woodenalchemytable". This will tell the game what to recognize the object as. Next, you go down to "filter". This filter tells what the object will be used for. Since this is an alchemy table, remove "craftingtable" and "plain" and put in "alchemytable". Next is Description. Simply write in a bit of information for people to see when they select it. For now, let's put in "This is an Alchemy Table." Next, is shortdescription. Don't be fooled! This is actually the name of the object ingame! go ahead and change it to "Alchemy Table". Of course next are the race descriptions, for when someone clicks it in view mode. You can change those to what you want. Next, you need to change the "InventoryIcon" to "woodenalchemytableicon.png" and the "dualImage" to "woodenalchemytable.png". And after that is done, save, and you're done with that file!


    STEP 5:
    Now that we have actually made the object, we need to tell the game how to allow us to craft it. To do this, we need to go into the Starbounds/assets folder, and find the file "Player.config" This file is VERY important. It tells the game what recipies you unlock and at what time, and it even controls stuff like racials and genders! But for now, we just need to scroll down in the file, to find the following lines:

    Code:
    "tier1" : [
          { "item" : "copperarmorhead" },
          { "item" : "copperarmorchest" },
          { "item" : "copperarmorpants" },
          { "item" : "darkwoodmaterial" },
          { "item" : "yarnspinner" },
          { "item" : "campfire" },
          { "item" : "platform" },
          { "item" : "torch" },
          { "item" : "woodencraftingtable1" },
          { "item" : "fence" },
          etc
    This portion of the file contains your tier 1 (starter) recipes. All we need to do is add {"item" : "woodenclahemytable" }, to the file, making sure to of course always keep the punctuation, spaces, and formatting. THE COMMA AT THE END IS IMPORTANT!


    STEP 6:
    Now that the game knows we can craft it we need to actually make the recipe to craft the table! This is just a matter of more copying and pasting, since we are again using something that was already given. Go to Starbound/assets/recipes, and click the folder "starter". Inside this folder, open the "plain" folder. each folder here is a crafting station. And Plain, you guessed it! is the folder used for when you are using only the "C"rafting menu. So, we go to our old friend, the file "woodencraftingtable1.recipe", and make a copy of him. Again, rename this new file to "woodenalchemytable.recipe". Then, when that is done, right click and open with Notepad++. You will see this:


    Code:
    {
      "input" : [
        { "item" : "darkwoodmaterial", "count" : 35 }
      ],
      "output" : {
        "item" : "woodencraftingtable1",
        "count" : 1
      },
      "groups" : [ "plain", "objects", "all", "tools" ]
    }
    All of the work is already done for us! All we have to do is rename "woodencraftingtable1" to "woodenalchemytable", modify the materials (if you are ever wondering what a material is named, simply go to assets/items/meterials), and the recipe is complete! However, once you start going in depth, you can also change the filters so that when someone clicks the crafting filter buttons they can find it in a hurry. But for now, we're done with this file, so save, and quit!


    STEP 7:
    Now, we have our Alchemy Table, the recipe to make it, and made it so we can get it at the beginning of the game. However we have a major issue... there's nothing we can do with it! That's right, now comes the time to make your items and their recipes as well! For this tutorial we will make a simple recipe to turn 2 copper into 1 Pure Copper, and then we will give ourselves the ability to smelt that Pure Copper in a Stone Furnace into 3 bars, adding a whopping 50% output! First of all, we will need to make our item itself, the Pure Copper. But it doesn't go into /objects. Nope! Instead, we have to go to the /items folder, and go to the "generic" folder, and then the "Crafting" folder. Once there, we want to make a copy of "copperore.item" and "copperore.png". Rename the copies to "copperpureore.item" and "copperpureore.png". Next, we will open up "copperpureore.item" in Notepad++, and we will see this:

    Code:
    {
      "itemName" : "copperore",
      "rarity" : "Common",
      "inventoryIcon" : "copperore.png",
      "description" : "Copper ore. Can be used for smelting or repairs. Select ore and right click pickaxe.",
      "shortdescription" : "Copper Ore"
    }
    Just like before, we want to rename "itemname" to "copperpureore", change the description, change the "inventoryIcon" to "copperpureore.png" and change the "shortdescription" to "Pure Copper Ore". After this is done, you have your pure ore item! Go ahead and save and quit.


    STEP 8:
    Just like before, we need to make a recipe for that item we just made! So we go back to the /recipes/starter folder, but this time, we need to do a little something different. Create a New Folder, and rename that folder to "alchemy table". Then, enter the "crafting table" folder, and copy the "fence.recipe" to your new alchemy table folder. Once that is done, go ahead and open it in Notepad++, and we will see this:

    Code:
    {
      "input" : [
        { "item" : "darkwoodmaterial", "count" : 2 }
      ],
      "output" : {
        "item" : "fence",
        "count" : 1
      },
      "groups" : [ "craftingtable", "materials", "all" ]
    }
    Now, as you did before, we go ahead and change the material, and the count to whatever we need. In this case, we change the material to "copperore", leaving the count to 2, and then, we move don to groups. This is VERY important. Do you see that little tag named "craftingtable"? Well, that is what is telling the game what object makes it! change that tag to "alchemytable", and you should remember, we changed the Alchemy Table's filter to "alchemytable" that means the game will recognize the alchemy table as the location to craft the recipe! So after we do that, we go ahead and save and exit, going to the next step.


    STEP 9:
    Now that we have made it so that your Pure Copper Ore can be made, we need to give it a purpose! to do this, we poke our heads into the assets/recipe/starter folder, and go into the "stonefurnace" folder. Inside here, we make a copy of "copperbar.recipe", and rename that copy to "copperbarfrompureore.recipe". A long name, but you want to know exactly what it is. Then we go to edit it, and see:


    Code:
    {
      "input" : [
        { "item" : "copperore", "count" : 2 }
      ],
      "output" : {
        "item" : "copperbar",
        "count" : 1
      },
      "groups" : [ "stonefurnace", "all" ]
    }
    Again, this is jut a matter of changing a bit. Change the "item" to "copperpureore", and the "count" to 1. Then, we go down to the "output" and change the "count" to 3. And with that, we now have a recipe to turn Pure Copper Ore into 3 Copper Bars! And now, we have one final step... if you've been paying attention you should know what this step is!


    STEP 10:
    You guessed it! We need to make it so we can make the Pure Copper Ore recipe from the beginning of the game! To do this we need to go back to /assets, and find the "Player.config" again. Just like before, we want to add {"item" : "copperpureore" }, to the list, making sure to keep formatting and of course the comma. With that, we've done it! We have made it so we can make an Alchemy Table at the beginning of the game, and then turn 2 Copper Ore into Pure Copper, and then smelt it into 3 ingots! If you want, you can repeat this with the other ores, using the steps 7 through 10 for each ore. Hey, no one said modding would be easy!


    STEP 11:
    (OPTIONAL) Multiplayer Compatibility
    Currently, as of the Perturbed Koala Beta Version, Multiplayer has no securities, so you can use these items ingame. However, other players will not be able to see them! To fix this, you will need to have them install the mod, by giving them all of the files you created, as well as your Player.config file. For now, this is how to install mods but maybe we'll get an easier method in the future! And don't forget, if anything goes wrong, you did archive everything, right?






    Protips:
    • ALL MODS TO PLAYER.CONFIG TIER 1 RECIPES REQUIRES A BRAND NEW CHARACTER. Recipes modifying a tier that a character hasn't reached yet does NOT require a restart. There is also a method to cause the recipes to be given when you pick up an item, mentioned in the comments.
    • The assets/objects folder is for placeable objects. the items folder is for materials and weapons and armor and such.
    • The .frames file is for items that have multiple colors or animations. Since we are copy-pasted from an exiting icon and sprite, e don't need to mess with it, but if you plan on using custom icons, you will need to pay attention to it! Information pertaining to that can be found elsewhere on the forums.
    • The .object or .item file contains all major information about the object/item. Very important!
    • The commas at the end of everything in code means that the code is to continue to the next line. If you forget a comma or any other formatting, it WILL crash the game! PAY ATTENTION TO FORMATTING!
    • Remember, the important thing is to not let yourself get overwhelmed by the mountains of code. Focus only on what you need to focus on, trying to figure out what each little portion of code does immediately can really make you confused!
     
    Last edited: Dec 8, 2013
    kenhan, hutzie, CackleEel and 13 others like this.
  2. Delta9Church

    Delta9Church Subatomic Cosmonaut

    Wow, good show sir. I will be playing around with this for sure. Haven't done any modding in a long time, so might be fun at first lol. Thanks for the great tutorial :)
     
  3. Dragonchampion

    Dragonchampion Subatomic Cosmonaut

    No problem! I'm glad to be of whatever help I can.
     
  4. Dragonchampion

    Dragonchampion Subatomic Cosmonaut

    Updated the post to fix a few errors.
     
  5. Vib Rib

    Vib Rib Tentacle Wrangler

    This is a great resource, and by establishing a whole new crafting table instead of just new recipes it goes above any beyond.
    Since you seem really knowledgeable about this I thought I might as well ask here: If universal starting recipes are established in player.config, where are race-specific recipes triggered? I want to add new recipes that are unique to each playable race, but I'm not sure how to give a Hylotl something and a Human something else. Any insight on where this is established?

    For that matter, do you know where other starter recipes are initialized? For instance, normal ore smelting is available from the start, but there are no smelting recipes in player.config. Yet when adding pure ore smelting, that recipe has to be added to player.config? Why? At what point, or in what file, is the normal smelting being added where it doesn't have to show up in player.config?

    Sorry for the load of questions. Just trying to follow up on this.
     
    Last edited: Dec 7, 2013
  6. Dragonchampion

    Dragonchampion Subatomic Cosmonaut

    Looking at the files, I can't seem to find any indication of how the game recognizes the race and restricts the race to their weapons and armor; that is a very good question. As I mod, I'll be sure to keep an eye out; I am sorry I can't offer any advice other than to scan the recipe folder carefully, it has to be in there somewhere!
     
  7. Dragonchampion

    Dragonchampion Subatomic Cosmonaut

    Looking at the files, I can't seem to find any indication of how the game recognizes the race and restricts the race to their weapons and armor; that is a very good question. As I mod, I'll be sure to keep an eye out; I am sorry I can't offer any advice other than to scan the recipe folder carefully, it has to be in there somewhere!
     
  8. Aralicia Moran

    Aralicia Moran Void-Bound Voyager

    AFAIK :
    - player.config contains the known starting blueprints ("defaultBlueprints" section) for any race.
    - species/*.species contains the race-specific blueprints ("defaultBlueprints" section again)
    - an item/object can have a section "learnBlueprintsOnPickup" that make the player learn new blueprints when picking up the item.

    The game seems to use the term "blueprint" to sometimes reference a recipe.
     
  9. Vib Rib

    Vib Rib Tentacle Wrangler

    Thank you very much. This is incredibly helpful!
     
  10. demiant

    demiant Astral Cartographer

    Great work!
     
  11. Ghoul159

    Ghoul159 Scruffy Nerf-Herder

    hey great tutorial just saw this after i made my own xP

    but here some important infos:
    1. i dont need a new character for new mods and recipes at least for objects and items
    i tried it even with a deleted mod item in a player inventory it will just turn into a green blank object which you can simply delte
    2. it doesn't matter where you put your files it is in fact better to keep them organized in your own mod folder

    nevertheless nice tutorial!
     
  12. Dragonchampion

    Dragonchampion Subatomic Cosmonaut

    What do you mean with 2? Are you saying we don't need to organize our files into their appropriate folders?
     
  13. Vib Rib

    Vib Rib Tentacle Wrangler

    Ghoul's right. When you add a recipe to assets/recipes, it doesn't matter what subfolder it's in, or even what the name of the file is. You could have bigfatfakerecipe.recipe in an assets/recipes/fakerecipes folder, and as long as as the contents of that recipe file were properly formatted, it would be read automatically. The game parses the entire contents of the folder and subfolders, so it's easy to keep the recipes sorted by mods this way.
     
  14. Ghoul159

    Ghoul159 Scruffy Nerf-Herder

    exactly like Vib Rib said
     
  15. Dragonchampion

    Dragonchampion Subatomic Cosmonaut

    That's excellent news for modders who want to organize themselves. Are the objects and items handled the same way? Could we have a mods folder in each of those three folders?
     
  16. Ghoul159

    Ghoul159 Scruffy Nerf-Herder

    i'm pretty shure it works with all of them...
    i didn't try it with all things but i can say it works definitely with objects and items ...
    i would make a central MyMod folder in the asset folder (like in my tutorials) to keep everything organized..
     
  17. Etgfrog

    Etgfrog Master Chief

    Wrong...there are ways of adding recipes onto existing characters, you can modify the matermanipulator to have learn a blueprint on pickup, then you can get the recipes on existing characters, look at the crystal or ice as an example to how you can do this.
     
  18. ooooooooooorrrrrrr.... Just at it to the Default Blueprints in the player.config file.
     
  19. Vib Rib

    Vib Rib Tentacle Wrangler

    It would be nice if there were some way to add started recipes without having to edit player.config or adding a blueprint-on-pickup to an existing item. As it is, any mod that adds any new craftables will have to edit those files. There's no way to just throw in a brand new recipe file and have it initialize itself.
     
    Aralicia Moran likes this.
  20. SaintPanda

    SaintPanda Cosmic Narwhal

    Is it possible to create a gun as a craftable item?
     

Share This Page