Tutorial Beginners Tutorial to create a Codex

Discussion in 'Starbound Modding' started by Kayuko, May 15, 2015.

  1. Kayuko

    Kayuko Oxygen Tank

    Lil' fluffy fox here again.
    Since it was just requested and this is really really easy to write, here's the tutorial on creating your custom codex:

    First, as always, you need notepad++ or any other good program supporting utf-8 encoding (means DO NOT USE WORDPAD!)

    There will be several steps in this tutorial:

    1. Creating the Codex Item (the one you use to gain access to it)
    2. Creating the Codex entries (all the stuff you read in there)
    3. Creating recipes for the codex items
    4. Creating a patchfile to gain access to said recipe
    5. (Optional) How to add your codex to the initial codex entries
    =====================================================================

    Starting straight away.


    {
    "codexId" : "agaranhunt",
    "title" : "The Agaran Menace",
    "codexkind" : "codex",
    "inventoryIcon" : "shroombook.png",
    "itemName" : "agaranhuntCodex",
    "rarity" : "common",
    "description" : "A mysterious Agaran request.",
    "shortdescription" : "Agaran Menace"
    }


    So, first of all: These are mushroom people, yes.
    Explaining the columns all the way!

    "codexId" -- Case sensitive, later used in the recipe, patchfile, initial codex entries and the codex itself
    "title" -- Your books name!
    "codexkind" -- Uhm.... just... keep it at "codex"...
    "inventoryIcon" -- The path to the png used to show the item in your inventory (16x16, as always)
    "rarity" -- Rarity. Yep. Just influences the color of the border around the item. Viable values: "common", "uncommon", "rare", "legendary"
    "description" -- The actual description of the item itself (in the box under the png, when you hover with your mouse over the item)
    "shortdescription" -- Missleading as always, that's the item's name as displayed in the inventory

    That's enough knowledge to create your own item. :kitten2:

    ======================================================================

    Now, to the codex entries.
    Here's an example:


    {
    "id" : "agaranhunt",
    "title" : "The Agaran Menace",
    "contentPages" : [

    "Greetings, intrepid space explorer. Don't ask who we are, or how we've found you. You're better off not knowing. We'll get straight to the point. Mushrooms. Mushrooms are taking over the galaxy. Agarans, to be precise. I'm sure you've seen them, waddling about, making their terrifying pods, yelling in unknown tongues. What you may not be aware of is just how dangerous they are.",

    "We, an unknown organization in no way associated with Thornwing or Big Ape, are attempting to translate their speech patterns and quell their uprising. And that's where you come in. We need you to get close to the Agarans, to study them, to hit them with heavy weaponry until they surrender.",

    "To aid you in your unsolicited mission - which we are very grateful for, of course - we have provided you with a foolproof Agaran disguise that will let you get close to these vile fungi. Wear it, or don't, it's up to you. Oh, one thing. We've heard talk of giant pods appearing around the galaxy. Maybe avoid those, leave them to the experts."

    ]
    }


    The json values are less important then the explanation how to format your text right, but still, let's do that first.

    "id" -- This is used to link the codex itself to the codexitem, they have to match completely!
    "title" -- Your books name, as seen in the codex interface.
    "contentPages" -- This is just a parental function to declare the start of the codex entries.

    Now the fun part: formatting.
    There are several rules you should follow:

    " <-- Declares start and end of a page. Everything in those quotation marks is NOT PARSED! (So you can use everything in there, however, quotation marks can be tricky to use. \" is the right way to do this. (As far as I'm aware)

    A comma after the end-declaration quotation mark marks the end of a page and the start of a new one, telling the parser "Hey, you, theres another entry to come, don't die on me yet!" (Do NOT add a comma after the last written page. There is no entry to be found, so you will crash or at least error out)

    Spaces are spaces within the quotation marks. Theres no need for extras like &nbsp; here.

    New lines are new lines, line breaks are line breaks, as long as you keep them within those quotation marks.

    However, DO NOT USE TAB within them. This will get you a nasty bracket in your codex, not cool.

    So, did that? Cool thing. Now your codex is ready and also linked to your codexitem.

    ==============================================================================

    Recipes. Always needed to gain access (unless you'll use admin commands or any other method of directly obtaining the item).


    {
    "input" : [
    { "item" : "cobblestonematerial", "count" : 50 }
    ],
    "output" : {
    "item" : "stonechair",
    "count" : 1
    },
    "groups" : [ "craftingtable", "objects", "tools", "all" ]
    }


    So, as always, EXPLANATION TIME!

    "input" -- Defines an (array of) item(s) needed to craft the output item
    "output" -- Defines which item you get when you craft the recipe, as well as the item that's displayed as the recipes image
    "groups" -- Those are the filters used in the recipe. In this case it says the following:

    This item is craftable on a normal craftingtable (Wooden Crafting Table, Robotic Crafting Table etc.)
    This item is an object, so if you select the "objects" filter in the crafting window, this item will be there.
    This item is also a tool (heck, dun ask me why a chair is a tool), so if you select the filter "tools", this item will be there!
    "all" simply refers to race-restrictions. If you'd write "floran", only florans would see the items. I think. At least.

    So, add the codexitem ("codexId") to the output, set the count.
    Then, add something to the input, like "money" (that's pixels).
    And you might want to alter the groups as well, here's an example:

    ["plain", "objects", "all"]

    Is craftable in the normal crafting screen (the C button ingame).
    The objects filter applies to it.
    You can craft it, no matter your race.

    So, now you've got your codexitem, your codex and your recipe. We're making progress boys!

    =====================================================================

    Next up is a simple lesson you should keep in mind. Patching blueprints into the player.config
    In this case, we will apply a patch that's making the codex-recipe available right when you create your character.

    The lines are as following:

    [ {"op" : "add", "path" : "/defaultBlueprints/tier1/-", "value" : {"item" : "codexId"}}]

    This line is put into a file named player.config.patch. I don't think theres explanation needed in this case. It's simply adding the line {"item" : "codexId"} to the path "defaultBlueprints" - "tier1" to a new array index.

    Now you've got all your files, right? Here's the folder structure for your mod:

    xxx.codexitem, xxx.codex and xxx.png (You obviously need an icon for your codexitem, everything is fine as long as it's 16x16 px big) belong to "/yourCustomMod/codex/documents/"
    Your recipe belongs to "/yourCustomMod/recipes/"
    Your player.config.patch belongs to "/yourCustomMod/"

    And, since you want the mod to load, ultimately, you add a .modinfo file to it.
    I won't explain the content since it's generic and easily understood, but here's an example you can copy:


    {
    "name" : "SB+_Mining",
    "version" : "Spirited Giraffe v4",
    "path" : ".",
    "requires" : [],
    "includes" : [],
    "metadata":
    {
    "author" : "Kayuko",
    "version" : "0.4",
    "description" : "Extends the default gameplay",
    "support_url" : ""
    }
    }


    Alter it and you're fine. (You wouldn't actually need to alter it, but, just do it to get experience).

    ==========================================================================

    So, the big extra: Adding a codex to be immediately available once the character is created.
    Theres a file called "codex.config" in the "/codex/" directory.
    As before, we're creating a patch, this time a little different tho.


    {
    "refreshInterval" : 2.0,
    "initialcodex" : {
    "glitch" : [ "controls", "glitchprologue", "glitchorigins", "glitchnotes", "survivalguide" ],
    "human" : [ "controls", "humanprologue", "humanorigins", "humanescape", "survivalguide" ],
    "avian" : [ "controls", "avianprologue", "avianorigins", "aviannotes", "survivalguide" ],
    "apex" : [ "controls", "apexprologue", "apexorigins", "apexplea", "survivalguide" ],
    "floran" : [ "controls", "floranprologue", "floranorigins", "floranambition", "survivalguide" ],
    "hylotl" : [ "controls", "hylotlprologue", "hylotlorigins", "hylotldirective", "survivalguide" ],
    "novakid" : [ "controls", "novakidprologue", "novakidorigins", "survivalguide" ],
    "penguin" : [ "controls", "humanprologue", "humanorigins", "humanescape", "survivalguide" ]
    }
    }


    No, thats not the patch, thats an example. Or rather, the vanilla codex.config.

    [{"op" : "add", "path" : "/initialcodex/glitch/-", "value" : "codexId"}] (Note: Unverified patch, not tested yet.)

    This will make the codex available upon creation of a new glitch character.
    [​IMG]
    Raccoon approved.
    Is this even a raccoon?
    yenben1 said it's a Tanooki, so it's a Tanooki now!
    But since moose said it's a red panda, it just transformed into a red panda.
    Because mods are always right.
     
    Last edited: May 15, 2015
  2. user2345562

    user2345562 Guest

    I think it's a tanooki
     
    Kayuko likes this.
  3. haynesy566

    haynesy566 Heliosphere

    Thanks! pretty sure thats a Tanooki
     
  4. SleepySquidd

    SleepySquidd Tragically Magic Hands

    It's actually a Red Panda!
    im pretty sure...
     
  5. Kayuko

    Kayuko Oxygen Tank

    Okay, made him a red panda. o:
     
  6. user2345562

    user2345562 Guest

    oops, I forgot red pandas even existed xD
     
  7. haynesy566

    haynesy566 Heliosphere

    Surprised they haven't gone extinct yet

    Wonder if we could get a sticky on this thread? its really useful
     
  8. Kayuko

    Kayuko Oxygen Tank

    If they'd sticky all tutorials the forum would start at page 2, thats why there's a modguide compilation sticky by molly. :p
     
  9. haynesy566

    haynesy566 Heliosphere

    oh...right silly me:D btw I'm in the process of writin some bounty hunter codex's probs gonna advertise later if people wanna work with me to make a bounty hunter mod where the player completes bounty's to gain rare(and useful) rewards
     
    Kayuko likes this.
  10. user2345562

    user2345562 Guest

    If you do start making the mod with other people, I'd gladly help or at least try to make a couple sprites or animations for it :3
     
    haynesy566 and Kayuko like this.
  11. haynesy566

    haynesy566 Heliosphere

    Thanks, um where should I post a request for it?
     
  12. user2345562

    user2345562 Guest

    haynesy566 likes this.
  13. haynesy566

    haynesy566 Heliosphere

  14. The | Suit

    The | Suit Agent S. Forum Moderator

    Don't forget the color codes.
    Code:
    ^color;
    example
    "^white;Bob is really ^green;sick"
    
    In the game it would look like
    Bob is really sick.

    color = red, blue, green, yellow, white, pink, orange
    Also hex codes work [ if I remember right ]

    and it ends with a semi colon. This will continue with the color until you switch to a new color code.

    ==
    This works on any text string in the game - including those are added through Lua files.
     
    Last edited: May 15, 2015
    foxtails and Kayuko like this.
  15. haynesy566

    haynesy566 Heliosphere

    uhhhh wot dat mean? is it really important?
     
  16. The | Suit

    The | Suit Agent S. Forum Moderator

    When you play the game you will notice various texts in alternating colors.
    This is basically how it is done.
     
    Kayuko and haynesy566 like this.
  17. haynesy566

    haynesy566 Heliosphere

    Hahaha ohhh :facepalm: god damn I feel so stupid :unsure:
     
  18. Big J Money

    Big J Money Scruffy Nerf-Herder

    Anyone know if it's possible to include variables in codexes?
     
  19. Stiljoz

    Stiljoz Void-Bound Voyager

    Looks like they've moved where the codex files are stored. I've looked and searched the folders, but I cannot for the life of me find them anywhere. Anyone have any insight into where they might have gone?

    EDIT: Oh, wait. Looks like they're all packed up now. Guess I'm doing some diggin'!
     
    Last edited: Jan 31, 2017
  20. lazarus78

    lazarus78 The Waste of Time

    Once you get the assets unpacked, they are literally in the folder called "codex", so not much digging to do.
     

Share This Page