Modding Help Making a Patch for an existing mod, need help.

Discussion in 'Starbound Modding' started by BelikrDscale, Oct 29, 2016.

Tags:
  1. BelikrDscale

    BelikrDscale Subatomic Cosmonaut

    I've been trying to make a mod to patch a couple race mods so that I can both switch the custom ships to default ships and have it remove the permanent backgrounds to the ships. but everything I've tried has lead to a crash. either the game boots up but won't let me load a character from the race I tried to make the mod for. or the game crashes at start up. I've tried searching for a tutorial in make mod dependencies but It is making my head hurt.
     
  2. lazarus78

    lazarus78 The Waste of Time

    Depending on the age of the race mod, it might be way more work than its worth trying to do a patch mod.

    Look in your starbound.log file for the error and why the game crashes. Address it, then try again. Rinse and repeat till it works.
     
  3. bk3k

    bk3k Oxygen Tank

    Just to be clear, the race mods include ships? Or you're wanting to use the background removed ships with a race that's otherwise using a vanilla ship?

    The use of the background remover wouldn't actually require universe_server.config.patch because you're only replacing an image.
     
  4. BelikrDscale

    BelikrDscale Subatomic Cosmonaut

    I want to know how to do both. o.=.o and the modding help post is so confusing because of the way the modding changed over the various updates. I'm looking to create my own mods but right now I'm starting small and making patches for certain things
     
  5. bk3k

    bk3k Oxygen Tank

    What you're dealing with here for the most part is paths. Well let me give you some examples. This is the universe_server.config.patch from my Shipyard Rebuilt mod

    Code:
    [
      [
      {
        "op" : "replace",
        "path" : "/speciesShips/apex",
        "value" : [
          "/ships/apex/sr_T0.structure",
          "/ships/apex/sr_T1.structure",
          "/ships/apex/sr_T2.structure",
          "/ships/apex/sr_T3.structure",
          "/ships/apex/sr_T4.structure",
          "/ships/apex/sr_T5.structure",
          "/ships/apex/sr_T6.structure",
          "/ships/apex/sr_T7.structure",
          "/ships/apex/sr_T8.structure",
          "/ships/apex/sr_T9.structure"
        ]
      },
      {
        "op" : "replace",
        "path" : "/speciesShips/avian",
        "value" : [
          "/ships/avian/sr_T0.structure",
          "/ships/avian/sr_T1.structure",
          "/ships/avian/sr_T2.structure",
          "/ships/avian/sr_T3.structure",
          "/ships/avian/sr_T4.structure",
          "/ships/avian/sr_T5.structure",
          "/ships/avian/sr_T6.structure",
          "/ships/avian/sr_T7.structure",
          "/ships/avian/sr_T8.structure",
          "/ships/avian/sr_T9.structure"
        ]
      },
      {
        "op" : "replace",
        "path" : "/speciesShips/floran",
        "value" : [
          "/ships/floran/sr_T0.structure",
          "/ships/floran/sr_T1.structure",
          "/ships/floran/sr_T2.structure",
          "/ships/floran/sr_T3.structure",
          "/ships/floran/sr_T4.structure",
          "/ships/floran/sr_T5.structure",
          "/ships/floran/sr_T6.structure",
          "/ships/floran/sr_T7.structure",
          "/ships/floran/sr_T8.structure",
          "/ships/floran/sr_T9.structure"
        ]
      },
      {
        "op" : "replace",
        "path" : "/speciesShips/glitch",
        "value" : [
          "/ships/glitch/sr_T0.structure",
          "/ships/glitch/sr_T1.structure",
          "/ships/glitch/sr_T2.structure",
          "/ships/glitch/sr_T3.structure",
          "/ships/glitch/sr_T4.structure",
          "/ships/glitch/sr_T5.structure",
          "/ships/glitch/sr_T6.structure",
          "/ships/glitch/sr_T7.structure",
          "/ships/glitch/sr_T8.structure",
          "/ships/glitch/sr_T9.structure"
        ]
      },
      {
        "op" : "replace",
        "path" : "/speciesShips/human",
        "value" : [
          "/ships/human/sr_T0.structure",
          "/ships/human/sr_T1.structure",
          "/ships/human/sr_T2.structure",
          "/ships/human/sr_T3.structure",
          "/ships/human/sr_T4.structure",
          "/ships/human/sr_T5.structure",
          "/ships/human/sr_T6.structure",
          "/ships/human/sr_T7.structure",
          "/ships/human/sr_T8.structure",
          "/ships/human/sr_T9.structure"
        ]
      },
      {
        "op" : "replace",
        "path" : "/speciesShips/hylotl",
        "value" : [
          "/ships/hylotl/sr_T0.structure",
          "/ships/hylotl/sr_T1.structure",
          "/ships/hylotl/sr_T2.structure",
          "/ships/hylotl/sr_T3.structure",
          "/ships/hylotl/sr_T4.structure",
          "/ships/hylotl/sr_T5.structure",
          "/ships/hylotl/sr_T6.structure",
          "/ships/hylotl/sr_T7.structure",
          "/ships/hylotl/sr_T8.structure",
          "/ships/hylotl/sr_T9.structure"
        ]
      },
      {
        "op" : "replace",
        "path" : "/speciesShips/novakid",
        "value" : [
          "/ships/novakid/sr_T0.structure",
          "/ships/novakid/sr_T1.structure",
          "/ships/novakid/sr_T2.structure",
          "/ships/novakid/sr_T3.structure",
          "/ships/novakid/sr_T4.structure",
          "/ships/novakid/sr_T5.structure",
          "/ships/novakid/sr_T6.structure",
          "/ships/novakid/sr_T7.structure",
          "/ships/novakid/sr_T8.structure",
          "/ships/novakid/sr_T9.structure"
        ]
      },
      {
        "op" : "replace",
        "path" : "/speciesShips/penguin",
        "value" : [
          "/ships/novakid/sr_T0.structure",
          "/ships/novakid/sr_T1.structure",
          "/ships/novakid/sr_T2.structure",
          "/ships/novakid/sr_T3.structure",
          "/ships/novakid/sr_T4.structure",
          "/ships/novakid/sr_T5.structure",
          "/ships/novakid/sr_T6.structure",
          "/ships/novakid/sr_T7.structure",
          "/ships/novakid/sr_T8.structure",
          "/ships/novakid/sr_T9.structure"
        ]
      }
      ]
    
    ]


    I think that is probably easier to handle than many similar files I've seen around.

    Now lets apply that to a race. Lets say neko. Lets assume you're making a patch you're sure will load AFTER the main neko mod.

    Code:
    [
      [
        {
          "op" : "replace",
          "path" : "/speciesShips/neko",
          "value" : [
            "/ships/novakid/sr_T0.structure",
            "/ships/novakid/sr_T1.structure",
            "/ships/novakid/sr_T2.structure",
            "/ships/novakid/sr_T3.structure",
            "/ships/novakid/sr_T4.structure",
            "/ships/novakid/sr_T5.structure",
            "/ships/novakid/sr_T6.structure",
            "/ships/novakid/sr_T7.structure",
            "/ships/novakid/sr_T8.structure",
            "/ships/novakid/sr_T9.structure"
          ]
        }
      ]
    }
    But you could just edit the mod itself. Delete the contents of universe_server.config.patch and replace with this.

    Code:
    [
      [
        {
          "op" : "add",
          "path" : "/speciesShips/neko",
          "value" : [
            "/ships/novakid/sr_T0.structure",
            "/ships/novakid/sr_T1.structure",
            "/ships/novakid/sr_T2.structure",
            "/ships/novakid/sr_T3.structure",
            "/ships/novakid/sr_T4.structure",
            "/ships/novakid/sr_T5.structure",
            "/ships/novakid/sr_T6.structure",
            "/ships/novakid/sr_T7.structure",
            "/ships/novakid/sr_T8.structure",
            "/ships/novakid/sr_T9.structure"
          ]
        }
      ]
    }

    The end result is putting the neko in the shipyard - specifically on the novakid's ship within it. You could change that to another race's ships by trading /ships/novakid/ for /ships/human/ etc

    Now I'll show you some next level patch magic - which isn't part of the official standard but fortunately Starbound supports.

    Code:
    [
      [
        {
                "op" : "test",
                "path" : "/speciesShips/neko",
                "inverse" : true
            },
            {
                "op" : "add",
                "path" : "/speciesShips/neko",
                "value" : []
            }
      ],
      [
        {
          "op" : "replace",
          "path" : "/speciesShips/neko",
          "value" : [
            "/ships/novakid/sr_T0.structure",
            "/ships/novakid/sr_T1.structure",
            "/ships/novakid/sr_T2.structure",
            "/ships/novakid/sr_T3.structure",
            "/ships/novakid/sr_T4.structure",
            "/ships/novakid/sr_T5.structure",
            "/ships/novakid/sr_T6.structure",
            "/ships/novakid/sr_T7.structure",
            "/ships/novakid/sr_T8.structure",
            "/ships/novakid/sr_T9.structure"
          ]
        }
      ]
    ]
    That's using patch batches. If the condition of the test fails, the rest of that batch aborts. I'm testing for the path "/speciesShips/neko" but with inverse... I'm actually checking for the LACK OF said path. The next item creates the path, but won't happen if the test failed.

    The next batch replaces what is that same path(obviously with the assumption that the path exists). And our first batch makes sure that one way or another... it does. The same concept applies to any patch.
     
    Last edited: Aug 1, 2017
  6. BelikrDscale

    BelikrDscale Subatomic Cosmonaut

    I'm still getting a error when i tried to load the patched race

    Unable to start local server
    (AssetException) Error loading asset
    /universe_server.config:commandProcessorScripts
     
  7. BelikrDscale

    BelikrDscale Subatomic Cosmonaut

    I found the issue I forgot to put the /speciesShips/Umbreon in quotation marks

    But it not removing the permanent pipe back ground from the ship like I want it to...
     
    Last edited: Nov 2, 2016
  8. bk3k

    bk3k Oxygen Tank

    Removing the background? You're really just replacing the image with a new image(and the new image deleted the internal portion of the ship). Make sure your replacement image is named the same and in the same spot. Like I say, you don't even need a universe_server.config.patch file to accomplish that. You only need at a minimum the _metadata or .modinfo file at the root location and the images in the right path. For example
    /ships/apex/apext1.png
    /ships/apex/apext1lit.png

    Again my mod actually includes edited images(all credit to eLe) so you might look at it for a good example. No... for this one look at the background remover mod because it does exactly that. Generally looking at what existing mods do and how they do it is the best reference for how-to-do some change. Well obviously you compare to vanilla.
     
  9. IHart

    IHart Scruffy Nerf-Herder

    if you are doing it as a local patch dont forget you need to add a metadata file with your include values as the mods you are patching, so that your patch loads after.
     
  10. bk3k

    bk3k Oxygen Tank

    Yes that's true. "includes" or "priority" being lower than the mod you are modifying.
     
  11. IHart

    IHart Scruffy Nerf-Herder

    i'd argue includes is best practice for situations when you can identify the precise mod you are trying to patch
     
  12. lightsourced

    lightsourced Scruffy Nerf-Herder


    Is there a way to make a local mod that can replace a Steam Workshop installed mod's ship? I tried doing the above, and I'm not having any luck =\ -- I'm trying to replace the Avali mod's ship with my own custom ship. I'm able to replace the images in the avali mod and have it work just fine... but I'd like to just create a local mod to replace in case they do an update or something, so that I don't have to keep unpacking/packing etc....
     
  13. Nexus Of Chaos

    Nexus Of Chaos Parsec Taste Tester

    note: repacking is not necessary.

    in my experience, as long as the assets from your mod to a mod are loaded after said mod (the user folder in assets loads last, btw), then it will always overwrite
     
  14. bk3k

    bk3k Oxygen Tank

    Unless this is changed, I don't think you can make a mod from /mods/ load after the workshop. Starbound seems to do this is phases rather than all at once. You could try "requires" but even if that works you have a serious downside - starbound will fail to load without any mods listed in "requires"

    You can copy their file from the workshop folder into /mods/ then unsub, or you could upload your file to the workshop (as a private mod) and subscribe to yourself to get it into the same "phase"

    The first option won't automatically incorporate changes to their mod. The second option would.
     
  15. lightsourced

    lightsourced Scruffy Nerf-Herder


    Ohh thanks! I'll try the private mod option! <3

    Edit: That worked wonderfully!!! Yay!
     
    Last edited: May 4, 2017
  16. lazarus78

    lazarus78 The Waste of Time

    Couldnt you set the mod's priority very low in the meta file? The game does this with loading the ABC songs. It has a priority of 9999999999.
     

Share This Page