Tutorial Basic Patching Now With Path Guide [v1.9]

Discussion in 'Starbound Modding' started by The | Suit, Sep 19, 2014.

  1. The | Suit

    The | Suit Agent S. Forum Moderator




    The new patching system is a surgical instrument - yet things can go horribly wrong if not careful. There are some important things to keep in mind

    Now just as the merge system before it. The patch system requires you to have the same name file in parallel location with the same folder structure as the vanillia file you want to edit.
    The biggest difference though is you add .patch to the end of it.
    For example in the following guides below we will be editing player.config.
    I will create a new file player.config.patch and keep it in the root of my mod folder. The same place player.config is in the vanilla assets.

    The root of the mod folder would be starbound/giraffe_storage/mods/MOD_NAME_HERE/player.config.patch
    Keep in mind you will still need a modinfo file for it to be read. Which this tutorial does not cover.

    The following guides will be using this sample code from player.config
    Code:
    {
      "defaultBlueprints" : {
        "tier1" : [
          { "item" : "mininglantern" },
          { "item" : "copperarmorhead" },
          { "item" : "copperarmorchest" },
          { "item" : "copperarmorpants" }
    ] }
    }
    
    ADD
    ======
    Adding things is simple enough. For example say I want to add an item to Tier1 blue prints
    Code:
    [ {"op":"add","path":"/defaultBlueprints/tier1/-","value":{"item":"test"} } ]
    
    Result

    Code:
    {
      "defaultBlueprints" : {
        "tier1" : [
          { "item" : "testobject" },
          { "item" : "mininglantern" },
          { "item" : "copperarmorhead" },
          { "item" : "copperarmorchest" },
          { "item" : "test" }
    ] }
    }
    


    OP = operation. The operation you want to perform.
    The current operations available are:
    “test”, “add”, “remove”, “move”, “copy”, and “replace”

    Path = the location within the file you want to modify.
    To make it a bit more understandable - if you take a look at tier1 in your player.config the list of items will be displayed. The first item in the list corresponds to "0" and increases accordingly.
    If you want to add an item to the bottom of the list you use "-"
    In the current version of Starbound as this guide is written, mining lantern is the first one on the list. When this patch above is applied testobject will be the first one on the list. You will soon understand its relevance when we talk about replace and move, a little later.

    value = the data you want to enter,
    With the corresponding brackets.

    Code:
    [
    {
      "op": "add",
      "path": "/defaultBlueprints/tier1/0",
      "value": { "item" : "testobjct" }
    },
    {
      "op": "add",
      "path": "/defaultBlueprints/tier1/0",
      "value": { "item" : "testobjct02" }
    }
    ]

    Code:
    {
      "defaultBlueprints" : {
        "tier1" : [
          { "item" : "testobject" },
          { "item" : "mininglantern" },
          { "item" : "copperarmorhead" },
          { "item" : "copperarmorchest" },
          { "item" : "copperarmorpants" }
    ] }
    }
    



    Code:
    {
      "defaultBlueprints" : {
        "tier1" : [
          { "item" : "testobject02" },
          { "item" : "testobject" },
          { "item" : "mininglantern" },
          { "item" : "copperarmorhead" },
          { "item" : "copperarmorchest" },
          { "item" : "copperarmorpants" }
    ] }
    }
    


    In the above example testobject will be added first to the top of the list. Then Testobject02 will be the first on the list after that. If you understood the repercussions of what that means good. Otherwise the next section will make things more clear. Another thing to note ideally it is best to add things to the bottom of the list "-" instead of the top. This will allow for better compatibility as it at least wont change the vanilla order of the file.

    NEW ARRAY AND BATCH ADDING
    As of right now I do not know how to batch add items to an already existing array. If some one else does please share.
    Code:
    [
        { "op": "add", "path": "/defaultBlueprints/tierABC", "value": [
    { "item" : "mininglantern" },
    { "item" : "mininglantern2" },
    { "item" : "mininglantern3" }
    ]
    }
      ]
    

    Code:
    {
      "defaultBlueprints" : {
        "tier1" : [
          { "item" : "mininglantern" },
          { "item" : "copperarmorhead" },
          { "item" : "copperarmorchest" },
          { "item" : "copperarmorpants" }
    ]
      "TierABC": [
        { "item" : "mininglantern" },
        { "item" : "mininglantern2" },
        { "item" : "mininglantern3" }
    ] }
    }
    

    The following code creates a new array "TierABC" - which you can batch populate to make life easier. Using the same method on an already existing array will simply cause the entire array to overwrite instead. Keeping only the new values.

    ADDING A NON EXISTING VALUE TO ROOT

    In some cases you may want to add a new value to the root of the document.
    In that case you simply add the path as if existed for example

    Code:
    "path":"/exampleValue",
    Then add in the rest of the value as if that path existed.

    Code:
    [
      {
        "op":"add",
        "path":"/exampleValue",
        "value": { "item" : "example" }
      }
    ]
    REMOVE
    =========
    Remove can either remove a specific item or the entire array - if you are not careful.
    Code:
    [ {
      "op": "remove",
      "path": "/defaultBlueprints/tier1/0"
    } ]
    Would remove the first item on tier1 - which in my case is mining lantern


    Code:
    {
      "defaultBlueprints" : {
        "tier1" : [
          { "item" : "copperarmorhead" },
          { "item" : "copperarmorchest" },
          { "item" : "copperarmorpants" }
    ] }
    }
    


    Code:
    [ {
      "op": "remove",
      "path": "/defaultBlueprints/tier1"
    } ]

    Code:
    {
      "defaultBlueprints" : {
    }
    }
    


    Would remove the entire Tier1 array.

    Now if you understood - why sequential order of how you write your patch file is extremely important. It should dawn on you by now. By changing the order list numbering everytime you add or remove an item. The location of items may change accordingly. So make sure if you are doing things like replace, you do it earlier on. And make sure you add to the bottom of the list whenever possible - so the list order remains the same for other modders.


    REPLACE
    ==========
    Replace simply replaces one value with another

    Code:
    [
    {
            "op": "replace",
            "path": "/defaultBlueprints/tier1/0",
            "value": { "item" : "testobject" }
    }
    ]

    Code:
    {
      "defaultBlueprints" : {
        "tier1" : [
          { "item" : "testobject" },
          { "item" : "copperarmorhead" },
          { "item" : "copperarmorchest" },
          { "item" : "copperarmorpants" }
    ] }
    }
    


    As mining lantern is the first object in my list, it would replace mining lantern with testobject


    TEST
    =========
    Test is a wonderful thing - it causes the patch to stop if a certain value is not in a certain posistion.
    For example as I have said before mininglantern is the first one on my list

    Code:
    [
      {
            "op": "test",
            "path": "/defaultBlueprints/tier1/0",
            "value": { "item" : "mininglantern" }
    },
      {
            "op": "replace",
            "path": "/defaultBlueprints/tier1/0",
            "value": { "item" : "testobject" }
    }
    ]
    
    
    This patch would first check to make sure mininglantern is first on the list. If it is not. The patch aborts and does not complete. If mining lantern is first on the list, it continues and it replaces mininglantern with testobject.

    Test will prevent your patches from accidentally making erroneous edits.
    Deeper Explanation from @OmnipotentEntity : http://community.playstarbound.com/threads/april-21st-–-stable-update-notes.95106/page-5#post-2561028

    =========

    UNDERSTANDING PATH

    Now creating the proper path is one of the hardest aspects of the new patching system. To understand pathing is as simple as understanding your operating system directory structure. You have a directory and sub directories.

    [​IMG]

    We will be focusing on the ore distribution and biome files.
    Lets start with the ore distribution file.

    [​IMG]

    Now surface ores is essentially a root level directory. And it is defining its array with the colon.
    Now inside this array are 6 sets of data which is separated by a comma making it a list. Now since these are not a defined directory like surface ores with a colon. These will be numbered starting from 0.
    So in this case the data sets will automatically be numbered 0, 5 as shown in red letters.
    The entire data set is marked in a purple colored box.

    Now inside that data set. Includes 2 new data sets. One a number - indicating the level of planet in blue colored box.The other data set making the distribution profile in red color box.

    Now inside ore distribution data set, you have 10 additional sets ( only 5 of which are shown in the picture).
    These are numbered with the green color text and single one highlighted with a green box.

    So now lets take this into a practical approach.
    Say I want to modify uranium in the 3rd group. Lets look at the picture.

    First I would point to surface ores
    Then count where in the list it is [ red text ] - which would be 2.
    Now inside the set of data we have 2 sets, the planet level and the ore distribution we want to go to ore distribution which is 1.
    Then see where uranium is in the ore distribution list we look for where uranium is. Which would be 1.
    ( remember we start our count from 0 )

    Easy Sample Code to experiment with your self
    http://json-schema-validator.herokuapp.com/jsonpatch.jsp
    Code:
    {
    
      "surfaceOres" : [
        [0.5, [ [ "coal", 1.40], [ "uranium", 0.00], [ "plutonium", 0.00], [ "solarium", 0.00], [ "copper", 0.20], [ "silverore", 0.20], [ "gold", 0.20], [ "platinum", 0.20], [ "diamond", 0.20], [ "iron", 0.20] ] ],
        [1.5, [ [ "coal", 1.40], [ "uranium", 0.00], [ "plutonium", 0.00], [ "solarium", 0.00], [ "copper", 0.20], [ "silverore", 0.20], [ "gold", 0.20], [ "platinum", 0.20], [ "diamond", 0.20], [ "iron", 0.20] ] ],
        [2.5, [ [ "coal", 1.40], [ "uranium", 0.00], [ "plutonium", 0.00], [ "solarium", 0.00], [ "copper", 0.20], [ "silverore", 0.20], [ "gold", 0.20], [ "platinum", 0.20], [ "diamond", 0.20], [ "titanium", 0.20] ] ],
        [3.5, [ [ "coal", 1.40], [ "uranium", 0.50], [ "plutonium", 0.00], [ "solarium", 0.00], [ "copper", 0.20], [ "silverore", 0.20], [ "gold", 0.20], [ "platinum", 0.20], [ "diamond", 0.20], [ "titanium", 0.20] ] ],
        [4.5, [ [ "coal", 1.40], [ "uranium", 0.00], [ "plutonium", 0.00], [ "solarium", 0.00], [ "copper", 0.20], [ "silverore", 0.20], [ "gold", 0.20], [ "platinum", 0.20], [ "diamond", 0.20], [ "aegisalt", 0.20], [ "rubium", 0.20], [ "violium", 0.20] ] ],
        [5.5, [ [ "coal", 1.40], [ "uranium", 0.00], [ "plutonium", 0.00], [ "solarium", 0.20], [ "copper", 0.20], [ "silverore", 0.20], [ "gold", 0.20], [ "platinum", 0.20], [ "diamond", 0.20], [ "aegisalt", 0.20], [ "rubium", 0.20], [ "violium", 0.20] ] ]
    
      ]}
    So our patch would be.
    Code:
    [ {
    "op":"replace",
    "path":"/surfaceOres/2/1/1",
    "value":  [ "uranium", 11.00]
    }
    ]

    Now can you just edit the number directly? Sure you can. Now using the same understanding as above. And you know data sets are separated by comma's how would that patch look like?

    Code:
    [ {
    "op":"replace",
    "path":"/surfaceOres/2/1/1/1",
    "value":  11.00
    }
    ]
    Is there any advantage of doing one over the other? No. Since you are replacing that data set - both functionally do the same thing with the exact same degree of compatibility in respect to overwriting and patching. The only real advantage of the 2nd one instead of the first, it is less likely you will make a spelling mistake causing an error.



    Now lets take a look at the Desert Biome.
    I am going to be using this snippet as a guide

    Code:
      { "surfacePlaceables" : {
        "grassMod" : [ "sand" ],
        "grassModDensity" : 0.9,
    
        "items" : [
          {
            "mode" : "floor",
            "priority" : 3.0,
            "variants" : 1,
            "distribution" : "/biomes/distributions.config:tiyDist",
    
            "type" : "microdungeon",
    
            "microdungeons" : [ "block1platforms", "loops", "spiralspikes", "blocks", "stripeblocks", "blockpile", "reversepyramids", "flats", "spikes", "rods", "wiggles", "rockyshapes", "layeredspire", "blank", "none" ]
          },
          {
            "mode" : "floor",
            "priority" : 1.0,
            "variants" : 1,
            "distribution" : "/biomes/distributions.config:potsRare",
    
            "type" : "object",
            "objectSets" : [
              {
                "pool" : [ [0.35, "capsulesmall" ], [0.35, "capsulemed" ], [0.35, "capsulebig" ] ],
                "parameters" : { }
              }
            ]
          },
        ]
      } }


    Here we face various levels and nests. So lets look at the basic breakdown diagram.

    [​IMG]

    If you look at this example, all of a sudden you will notice something different. We are dealing with named lists now. So when you create your path you will start having to mix the two.

    For example say I want to access microdungeons and replace loops with Example
    Of course first we start with surface placeables.
    Now we notice that there are 3 things in that list GrassMod, grassModDensity, Items. Since Microdungeons is in items we do items next.
    Now when we look at items - we will notice we have 2 arrays. Microdungeons is in the first array. so our next path is 0.
    Next we again have named list which is microdungeons
    and loops is in the 2nd position. So that means it becomes 1. [ we always start count from 0 ]
    So our patch would look like

    Code:
    [ {
    "op":"replace",
    "path":"/surfacePlaceables/items/0/microdungeons/1",
    "value":  "Example"
    }
    ]
    Now how about this time we edit the pool value.
    Now most of it is the same - but you will notice that the pool value is located in the 2nd array set in items. So we will need to change that from 0 to 1. After which it is located inside object sets.
    Now you will notice that this pool value is encapsulated in another array - hence 0.
    Then pool
    Then the value in the array. Say I wanted 99 capsule small. How would you write that?


    Code:
    [ {
    "op":"replace",
    "path":"/surfacePlaceables/items/1/objectSets/0/pool/0",
    "value":  [ 0.99, "capsulesmall"]
    }
    ]
    or

    Code:
    [ {
    "op":"replace",
    "path":"/surfacePlaceables/items/1/objectSets/0/pool/0/0",
    "value":  0.99
    }
    ]


    EXAM QUESTION:
    To prove you have learned patching do the following test.
    Using the code provided in the spoiler below- create a patch which replaces the Apex error text.
    Code:
    "ERROR: ERROR: Info:'S.A.I.L.::run.innerLoop', 'Cnt#: ', 1198, 'Sum:ms:', ERROR: 'Min', 15, 'Max', 7199, 'Horse', 9899, 'Avg', 23, 'Last:::', '800b5', 'Var:avg,us: ERROR: ERROR: REBOOT REQUIRED!!!'"
    ai.config file

    Code:
    {
      "aiAnimations" : {
        "idle" : {
          "frames" : "<image>:idle.<index>",
          "mode" : "loopForever",
          "frameNumber" : 21,
          "animationCycle" : 3.0,
          "centered" : false
        },
    
        "blink" : {
          "frames" : "<image>:blink.<index>",
          "mode" : "stop",
          "frameNumber" : 1,
          "centered" : false
        },
    
        "talk" : {
          "frames" : "<image>:talk.<index>",
          "mode" : "loopForever",
          "frameNumber" : 2,
          "animationCycle" : 0.5,
          "centered" : false
        },
    
        "yell" : {
          "frames" : "<image>:yell.<index>",
          "mode" : "loopForever",
          "frameNumber" : 2,
          "animationCycle" : 0.5,
          "centered" : false
        },
    
        "refuse" : {
          "frames" : "<image>:refuse.<index>",
          "mode" : "loopForever",
          "frameNumber" : 8,
          "centered" : false
        },
    
        "unique" : {
          "frames" : "<image>:unique.<index>",
          "mode" : "loopForever",
          "frameNumber" : 8,
          "centered" : false
        }
      },
    
      "defaultAnimation" : "idle",
    
      "staticAnimation" : {
        "frames" : "<image>:<index>",
        "mode" : "loopForever",
        "animationCycle" : 0.111,
        "frameNumber" : 4,
        "centered" : false
      },
    
      "scanlineAnimation" : {
        "frames" : "scanlines.png:<index>",
        "mode" : "loopForever",
        "animationCycle" : 0.999,
        "frameNumber" : 14,
        "centered" : false
      },
    
      "staticOpacity" : 0.2,
      "scanlineOpacity" : 0.5,
      "charactersPerSecond" : 45,
    
      "species" : {
        "apex" : {
          "aiFrames" : "apexAi.png",
          "staticFrames" : "staticApex.png",
          "openSpeech" : {
            "0" : [
              {
                "animation" : "unique",
                "text" : "ERROR: ERROR: Info:'S.A.I.L.::run.innerLoop', 'Cnt#: ', 1198, 'Sum:ms:', ERROR: 'Min', 15, 'Max', 7199, 'Horse', 9899, 'Avg', 23, 'Last:::', '800b5', 'Var:avg,us: ERROR: ERROR: REBOOT REQUIRED!!!'",
                "speedModifier" : 0.5
              }
            ],
            "1" : [
              {
                "animation" : "talk",
                "text" : "The thrusters and FTL drive are offline. I can repair the thrusters with the ships auto repair module but I'll need ^orange;core fragments^green; from the core of the planet below.",
                "speedModifier" : 1.0
              }
            ],
            "2" : [
              {
                "animation" : "talk",
                "text" : "We've repaired the ships thrusters. Travel within this system is now available, ^green;did you investigate that gate yet? Next we need to fix the ship's FTL drive.",
                "speedModifier" : 1.0
              }
            ],
            "3" : [
              {
                "animation" : "talk",
                "text" : "The ship's FTL drive is now fully functional. The galaxy is yours to explore!",
                "speedModifier" : 1.0
              }
            ]
          },
          "techIntro" : [
            {
              "animation" : "talk",
              "text" : "Here you can augment your body with tech cards and nano suits. ^orange;Tech cards ^green;will give you unique abilities whilst ^orange;nano suits ^green;will allow you to survive in otherwise deadly environments.",
              "speedModifier" : 1.0
            }
          ]
        },
        "avian" : {
          "aiFrames" : "avianAi.png",
          "staticFrames" : "staticAvian.png",
          "openSpeech" : {
            "0" : [
              {
                "animation" : "unique",
                "text" : "ERROR: ERROR: Info:'S.A.I.L.::run.innerLoop', 'Cnt#: ', 1198, 'Sum:ms:', ERROR: 'Min', 15, 'Max', 7199, 'Horse', 9899, 'Avg', 23, 'Last:::', '800b5', 'Var:avg,us: ERROR: ERROR: REBOOT REQUIRED!!!'",
                "speedModifier" : 0.5
              }
            ],
            "1" : [
              {
                "animation" : "talk",
                "text" : "The thrusters and FTL drive are offline. I can repair the thrusters with the ships auto repair module but I'll need ^orange;core fragments^green; from the core of the planet below.",
                "speedModifier" : 1.0
              }
            ],
            "2" : [
              {
                "animation" : "talk",
                "text" : "We've repaired the ships thrusters. Travel within this system is now available, ^green;did you investigate that gate yet? Next we need to fix the ship's FTL drive.",
                "speedModifier" : 1.0
              }
            ],
            "3" : [
              {
                "animation" : "talk",
                "text" : "The ship's FTL drive is now fully functional. The galaxy is yours to explore!",
                "speedModifier" : 1.0
              }
            ]
          },
          "techIntro" : [
            {
              "animation" : "talk",
              "text" : "Here you can augment your body with tech cards and nano suits. ^orange;Tech cards ^green;will give you unique abilities whilst ^orange;nano suits ^green;will allow you to survive in otherwise deadly environments.",
              "speedModifier" : 1.0
            }
          ]
        },
        "floran" : {
          "aiFrames" : "floranAi.png",
          "staticFrames" : "staticAvian.png",
          "openSpeech" : {
            "0" : [
              {
                "animation" : "unique",
                "text" : "ERROR: ERROR: Info:'S.A.I.L.::run.innerLoop', 'Cnt#: ', 1198, 'Sum:ms:', ERROR: 'Min', 15, 'Max', 7199, 'Horse', 9899, 'Avg', 23, 'Last:::', '800b5', 'Var:avg,us: ERROR: ERROR: REBOOT REQUIRED!!!'",
                "speedModifier" : 0.5
              }
            ],
            "1" : [
              {
                "animation" : "talk",
                "text" : "The thrusters and FTL drive are offline. I can repair the thrusters with the ships auto repair module but I'll need ^orange;core fragments^green; from the core of the planet below.",
                "speedModifier" : 1.0
              }
            ],
            "2" : [
              {
                "animation" : "talk",
                "text" : "We've repaired the ships thrusters. Travel within this system is now available, ^green;did you investigate that gate yet? Next we need to fix the ship's FTL drive.",
                "speedModifier" : 1.0
              }
            ],
            "3" : [
              {
                "animation" : "talk",
                "text" : "The ship's FTL drive is now fully functional. The galaxy is yours to explore!",
                "speedModifier" : 1.0
              }
            ]
          },
          "techIntro" : [
            {
              "animation" : "talk",
              "text" : "Here you can augment your body with tech cards and nano suits. ^orange;Tech cards ^green;will give you unique abilities whilst ^orange;nano suits ^green;will allow you to survive in otherwise deadly environments.",
              "speedModifier" : 1.0
            }
          ]
        },
        "glitch" : {
          "aiFrames" : "glitchAi.png",
          "staticFrames" : "staticGlitch.png",
          "openSpeech" : {
            "0" : [
              {
                "animation" : "unique",
                "text" : "ERROR: ERROR: Info:'S.A.I.L.::run.innerLoop', 'Cnt#: ', 1198, 'Sum:ms:', ERROR: 'Min', 15, 'Max', 7199, 'Horse', 9899, 'Avg', 23, 'Last:::', '800b5', 'Var:avg,us: ERROR: ERROR: REBOOT REQUIRED!!!'",
                "speedModifier" : 0.5
              }
            ],
            "1" : [
              {
                "animation" : "talk",
                "text" : "The thrusters and FTL drive are offline. I can repair the thrusters with the ships auto repair module but I'll need ^orange;core fragments^green; from the core of the planet below.",
                "speedModifier" : 1.0
              }
            ],
            "2" : [
              {
                "animation" : "talk",
                "text" : "We've repaired the ships thrusters. Travel within this system is now available, ^green;did you investigate that gate yet? Next we need to fix the ship's FTL drive.",
                "speedModifier" : 1.0
              }
            ],
            "3" : [
              {
                "animation" : "talk",
                "text" : "The ship's FTL drive is now fully functional. The galaxy is yours to explore!",
                "speedModifier" : 1.0
              }
            ]
          },
          "techIntro" : [
            {
              "animation" : "talk",
              "text" : "Here you can augment your body with tech cards and nano suits. ^orange;Tech cards ^green;will give you unique abilities whilst ^orange;nano suits ^green;will allow you to survive in otherwise deadly environments.",
              "speedModifier" : 1.0
            }
          ]
        },
        "human" : {
          "aiFrames" : "humanAi.png",
          "staticFrames" : "staticHuman.png",
          "openSpeech" : {
            "0" : [
              {
                "animation" : "unique",
                "text" : "ERROR: ERROR: Info:'S.A.I.L.::run.innerLoop', 'Cnt#: ', 1198, 'Sum:ms:', ERROR: 'Min', 15, 'Max', 7199, 'Horse', 9899, 'Avg', 23, 'Last:::', '800b5', 'Var:avg,us: ERROR: ERROR: REBOOT REQUIRED!!!'",
                "speedModifier" : 0.5
              }
            ],
            "1" : [
              {
                "animation" : "talk",
                "text" : "The thrusters and FTL drive are offline. I can repair the thrusters with the ships auto repair module but I'll need ^orange;core fragments^green; from the core of the planet below.",
                "speedModifier" : 1.0
              }
            ],
            "2" : [
              {
                "animation" : "talk",
                "text" : "We've repaired the ships thrusters. Travel within this system is now available, ^green;did you investigate that gate yet? Next we need to fix the ship's FTL drive.",
                "speedModifier" : 1.0
              }
            ],
            "3" : [
              {
                "animation" : "talk",
                "text" : "The ship's FTL drive is now fully functional. The galaxy is yours to explore!",
                "speedModifier" : 1.0
              }
            ]
          },
          "techIntro" : [
            {
              "animation" : "talk",
              "text" : "Here you can augment your body with tech cards and nano suits. ^orange;Tech cards ^green;will give you unique abilities whilst ^orange;nano suits ^green;will allow you to survive in otherwise deadly environments.",
              "speedModifier" : 1.0
            }
          ]
        },
      "novakid" : {
          "aiFrames" : "NovakidAI.png",
          "staticFrames" : "staticGlitch.png",
          "openSpeech" : {
            "0" : [
              {
                "animation" : "unique",
                "text" : "ERROR: ERROR: Info:'S.A.I.L.::run.innerLoop', 'Cnt#: ', 1198, 'Sum:ms:', ERROR: 'Min', 15, 'Max', 7199, 'Horse', 9899, 'Avg', 23, 'Last:::', '800b5', 'Var:avg,us: ERROR: ERROR: REBOOT REQUIRED!!!'",
                "speedModifier" : 0.5
              }
            ],
            "1" : [
              {
                "animation" : "talk",
                "text" : "The thrusters and FTL drive are offline. I can repair the thrusters with the ships auto repair module but I'll need ^orange;core fragments^green; from the core of the planet below.",
                "speedModifier" : 1.0
              }
            ],
            "2" : [
              {
                "animation" : "talk",
                "text" : "We've repaired the ships thrusters. Travel within this system is now available, ^green;did you investigate that gate yet? Next we need to fix the ship's FTL drive.",
                "speedModifier" : 1.0
              }
            ],
            "3" : [
              {
                "animation" : "talk",
                "text" : "The ship's FTL drive is now fully functional. The galaxy is yours to explore!",
                "speedModifier" : 1.0
              }
            ]
          },
          "techIntro" : [
            {
              "animation" : "talk",
              "text" : "Here you can augment your body with tech cards and nano suits. ^orange;Tech cards ^green;will give you unique abilities whilst ^orange;nano suits ^green;will allow you to survive in otherwise deadly environments.",
              "speedModifier" : 1.0
            }
          ]
        },
      "penguin" : {
          "aiFrames" : "NovakidAI.png",
          "staticFrames" : "staticGlitch.png",
          "openSpeech" : {
            "0" : [
              {
                "animation" : "unique",
                "text" : "ERROR: ERROR: Info:'S.A.I.L.::run.innerLoop', 'Cnt#: ', 1198, 'Sum:ms:', ERROR: 'Min', 15, 'Max', 7199, 'Horse', 9899, 'Avg', 23, 'Last:::', '800b5', 'Var:avg,us: ERROR: ERROR: REBOOT REQUIRED!!!'",
                "speedModifier" : 0.5
              }
            ],
            "1" : [
              {
                "animation" : "talk",
                "text" : "The thrusters and FTL drive are offline. I can repair the thrusters with the ships auto repair module but I'll need ^orange;core fragments^green; from the core of the planet below.",
                "speedModifier" : 1.0
              }
            ],
            "2" : [
              {
                "animation" : "talk",
                "text" : "We've repaired the ships thrusters. Travel within this system is now available, ^green;did you investigate that gate yet? Next we need to fix the ship's FTL drive.",
                "speedModifier" : 1.0
              }
            ],
            "3" : [
              {
                "animation" : "talk",
                "text" : "The ship's FTL drive is now fully functional. The galaxy is yours to explore!",
                "speedModifier" : 1.0
              }
            ]
          },
          "techIntro" : [
            {
              "animation" : "talk",
              "text" : "Here you can augment your body with tech cards and nano suits. ^orange;Tech cards ^green;will give you unique abilities whilst ^orange;nano suits ^green;will allow you to survive in otherwise deadly environments.",
              "speedModifier" : 1.0
            }
          ]
        },
        "hylotl" : {
          "aiFrames" : "hylotlAi.png",
          "staticFrames" : "staticHylotl.png",
          "openSpeech" : {
            "0" : [
              {
                "animation" : "unique",
                "text" : "ERROR: ERROR: Info:'S.A.I.L.::run.innerLoop', 'Cnt#: ', 1198, 'Sum:ms:', ERROR: 'Min', 15, 'Max', 7199, 'Horse', 9899, 'Avg', 23, 'Last:::', '800b5', 'Var:avg,us: ERROR: ERROR: REBOOT REQUIRED!!!'",
                "speedModifier" : 0.5
              }
            ],
            "1" : [
              {
                "animation" : "talk",
                "text" : "The thrusters and FTL drive are offline. I can repair the thrusters with the ships auto repair module but I'll need ^orange;core fragments^green; from the core of the planet below.",
                "speedModifier" : 1.0
              }
            ],
            "2" : [
              {
                "animation" : "talk",
                "text" : "We've repaired the ships thrusters. Travel within this system is now available, ^green;did you investigate that gate yet? Next we need to fix the ship's FTL drive.",
                "speedModifier" : 1.0
              }
            ],
            "3" : [
              {
                "animation" : "talk",
                "text" : "The ship's FTL drive is now fully functional. The galaxy is yours to explore!",
                "speedModifier" : 1.0
              }
            ]
          },
          "techIntro" : [
            {
              "animation" : "talk",
              "text" : "Here you can augment your body with tech cards and nano suits. ^orange;Tech cards ^green;will give you unique abilities whilst ^orange;nano suits ^green;will allow you to survive in otherwise deadly environments.",
              "speedModifier" : 1.0
            }
          ]
        }
      },
    
      "enableCommandsAtLevel" : {
        "0" : ["upgradeShip1"],
        "1" : ["giveBeamaxe", "upgradeShip2"],
        "2" : ["upgradeShip3"],
        "3" : ["givePainttool"],
        "4" : ["giveWiretool"],
        "5" : [],
        "6" : [],
        "7" : []
      },
    
      "techPurchaseItem" : "blanktechcard"
    }
    


    ANSWER
    This is based on the honor system - only check answer when you are sure.

    Code:
    [{
    "op": "replace",
    "path" :  "/species/apex/openSpeech/0/0/text",
    "value" : "Good job"
    }]


    KNOWN ISSUES AS OF: Beta v. Upbeat Giraffe - Update 2
    • You can only add 1 item at a time into an existing array.

    =========
    OTHER USER EXAMPLES
    @Osoreshi explains copy examples here
    http://community.playstarbound.com/...ith-path-guide-v1-2.84496/page-2#post-2359651

    =========
    BUGS AND ISSUES
    @JohnColburn found an issue with add protocol where even though the Json patch tester shows a proper patch was done. The add function cannot overwrite an existing value as stated by the standards.
    You can find more about it here
    http://community.playstarbound.com/...ith-path-guide-v1-2.84496/page-2#post-2359048
     
    Last edited: Mar 21, 2020
  2. capizma

    capizma Cosmic Narwhal

    Thanks!
    This is going to be very useful to me.
     
  3. apinanaivot

    apinanaivot Cosmic Narwhal

    How do I make this for treasurepools?
     
  4. The | Suit

    The | Suit Agent S. Forum Moderator

    It is better you give it a try first - make sure the syntax checker confirms there are no mistakes, and finally see if it is working.
    The best treasure pool to test on is the dropship pool [ starting loot in ship locker] so you can easily check if you are doing it properly.

    If after a few tries you can't get it work, post your code and starbound.log
     
  5. apinanaivot

    apinanaivot Cosmic Narwhal

    It is not hard to make items generate in the shiplocker. Hard thing is to make them generate in a particular biome. PS. I am using the nightly build.
     
  6. The | Suit

    The | Suit Agent S. Forum Moderator

    The treasure pool file is the same for both.
    So what do you want to spawn in the biome?
     
  7. apinanaivot

    apinanaivot Cosmic Narwhal

    You can download my mod, More weapon types if you have the nightly build. Currently it replaces the file for biome treasurepool witch makes it incompatible with evry other mod that replaces that file.
     
  8. The | Suit

    The | Suit Agent S. Forum Moderator

    Ya the thing is you didn't even try to patch
    An chances are the "its not hard to add items to ship locker" you are probably doing it the same way you do the biome files, which is the wrong way to do it. You never use dirty edits for mods you release to public.
    Anyway - first try to properly patch the drop ship file, not just "replace" the file. The reason is - unless you attempt it, you will keep asking every time.

    If you are still having problems - you can read the spoiler below

    Code:
    [
    { "op": "add", "path": "/basicChestTreasure/0/1/pool/-", "value": {"weight" : 1.0, "pool" : "example"} }
    ]
    
     
    Last edited: Dec 2, 2014
    Dunto and Claith like this.
  9. The | Suit

    The | Suit Agent S. Forum Moderator

    Made a correction to spoiler incase you saw it already.
     
  10. apinanaivot

    apinanaivot Cosmic Narwhal

    Does not work.
     
  11. The | Suit

    The | Suit Agent S. Forum Moderator

    Did you make sure you added the .patch to the file extension?
     
    Dunto likes this.
  12. apinanaivot

    apinanaivot Cosmic Narwhal

    Yes. After i have done that what you showed in the spoiler. Now how do i add the weapons?

    [
    { "op": "add", "path": "/basicChestTreasure/0/1/pool/-", "value": {"weight" : 1.0, "pool" : "example"} } <-- over there i probably add the Treasure text, but the items are in different place as you can see from above.
    ]
     
  13. The | Suit

    The | Suit Agent S. Forum Moderator

    Code:
    {
      "gardenTreasure" : [ [ 1, {
        "pool" : [ {
          "weight" : 1,
          "item" : [ "darkwoodmaterial", 10 ]
        }, {
          "weight" : 1,
          "item" : [ "plantfibre", 10 ]
        }, {
          "weight" : 0.5,
          "item" : [ "bandage", 3 ]
        }, {
          "weight" : 0.5,
          "item" : [ "throwingspear", 3 ]
        }, {
          "weight" : 1,
          "item" : [ "test", 10 ]
        } ]
      } ] ]
    }
    I suggest practicing the basics first as the guide intended. So you can get more practice.

    Code:
    [
    { "op": "add", "path": "/gardenTreasure/0/1/pool/-", "value": {"weight" : 1.0, "item" : ["test", 10]} }
    ]
    You have to properly adapt to each value. Copying and pasting blindly will not work.
     
    Dunto likes this.
  14. AstralGhost

    AstralGhost Pangalactic Porcupine

    I figure he's not actually using the nightly build, and is in fact using the stable version.
    He just states it doesn't work. He doesn't explain why or what it is doing.

    apinanaivot, what version of Starbound are you on? Are you even using the nightly build?
     
  15. apinanaivot

    apinanaivot Cosmic Narwhal

    yes i am.[DOUBLEPOST=1417539872][/DOUBLEPOST]btw. I dont need help anymore. Armed Mosquito helped me.
     
  16. AstralGhost

    AstralGhost Pangalactic Porcupine

    Ah, then I guess I have no clue why it's not working for you.

    Did you use the link at the top of the page to test your patches first?
    http://json-schema-validator.herokuapp.com/jsonpatch.jsp

    Paste your patch file in the first box, and the contents of the file you're patching in the second, remove all comments, then run it.
    If it gives you an error then it means you're not doing it right, so try experimenting and re-reading xxswatelitexx's tutorial to figure it out. You'll get there eventually if you just try.
     
  17. MasterSaturday

    MasterSaturday Phantasmal Quasar

    How do I add multiple items to the Tier1 list of items at a time? The test code I entered checks out with that JSON patch validator you provided, but the actual game crashes, and the log says there's an error with the code.

    Here's what I typed:
    Which the validator says there's no problem with, but the error log for Starbound gives this:

     
  18. The | Suit

    The | Suit Agent S. Forum Moderator

    There really is no way to batch add without overwriting the entire array. As far as I know
    Its easier just do write the code straight if its small

    Code:
    [
    {"op":"add","path":"/defaultBlueprints/tier1/-","value":{"item":"item1"}},
    {"op":"add","path":"/defaultBlueprints/tier1/-","value":{"item":"item2"}}
    ]
     
    AstralGhost likes this.
  19. Mara1681

    Mara1681 Phantasmal Quasar

    What if I want to change reviveCost?
    Code:
    [
        {
            "op": "replace",
            "value":
            {
                "reviveCost" :
                {
                    "absolute" : 0,
                    "percentile" : 0.0
                }
                "maxMoney" : 999999999
            }
        }
    ]
    I suppose that this is the wrong way to replace it... :D
     
  20. The | Suit

    The | Suit Agent S. Forum Moderator

    There is no way you read the tutorial if you wrote something like that.
    You can only make a change to one line at a time. So you would need 2 separate lines

    But I will give you an example of 1 of the lines.
    Code:
    [
    {"op":"replace","path":"/reviveCost/absolute","value":0}
    ]
    Remember to test your patches here
    http://json-schema-validator.herokuapp.com/jsonpatch.jsp
     
    Last edited: Apr 22, 2015

Share This Page