Modding Help Replacing boss music

Discussion in 'Starbound Modding' started by eshadow123, Aug 6, 2017.

  1. eshadow123

    eshadow123 Void-Bound Voyager

    I know the first few things of replacing existing things in Starbound, patching and such, and I've learned more about replacing thanks to these forums, but the code for assigning the boss music is quite weird compared to the Outpost and such.
    confusion.PNG
    I have no idea how to write the patch for this, or if I'm in the right file to begin with. I can write a patch, I've done it before, but the way this file is I can't seem to get figure out how to write a working patch. The file path is [dungeons/missions/apexmissions/apexmission1.json], help on how to do this is much appreciated.
     
  2. Nerd of all trades

    Nerd of all trades Tentacle Wrangler

    I haven't tried setting boss music yet, but I'd like to know how as well, I'm currently making a giant dragon enemy for a boss to a dungeon I'm working on and would like to make the Skyrim dragon fight music play when the boss appears. If noone posts how before I'm done I'll try to figure it out and give instructions.
     
  3. Ultimate sandvich

    Ultimate sandvich Scruffy Nerf-Herder

    I'd have to take a look at the full file to figure it out, but the best way to find it out and learn more about patching is tutorials and trial and error, you'll remember it longer. This has been quite helpful for me, it explains patching really good.
    If you want to test whether the patch will have the right effect, so whether it will replace the right thing and won't break things, then I recommend using this online patcher, it'll show the result after patching and shows any errors you might've made while trying to do so. Although I think it has some issues with lines that are marked with "//", it doesn't ignore those like it should. To use it simply copy paste your patch in the top space, the complete code of the thing you want to patch in the bottom space and click "apply patch" at the bottom of the screen. If you can't get it right, I'll take a look at the file and try it myself. The hardest part will be the path, once you got that it should be fine.


    What you're going to do is different than what eshadow has problems with. Eshadow is trying to change existing music for an existing boss fight, while you're going to add a new bossfight to the game, and thus you are using new files. You don't have to worry about patching the new music inside an existing file, you'll just have to create your own (non-patch) file and use the same code as above, but change it to your own music file. This would be:

    Code:
    "properties": {
           "parameters": " {  \"music\" : [ \"\/YOURPATH\/YOURFILE.ogg\"],  \"uniqueId\" : \"bossmusic\" } ",
           "stagehand": "bossmusic"
    },
    
    You'll have to replace YOURPATH with the path leading to your file, although I recommend putting it in the music folder, or maybe in a folder you created inside the music folder. YOURFILE has to be the name of the music file. It has to be .ogg, if you need a useful converter from .mp3 or other extensions to .ogg, I recommend this site.
     
    Last edited: Aug 6, 2017
  4. eshadow123

    eshadow123 Void-Bound Voyager

    Been messing with it a bit and I can't seem to figure out what is wrong with my patch, I'll paste it here:
    [
    {
    "op": "replace",
    "path": "/layers/objects/properties/parameters/music/",
    "value": "/music/BossBattle4.ogg"
    }
    ]
    If that helps at all
     
  5. xaliber

    xaliber Scruffy Nerf-Herder

    The weird path you're seeing
    This one:
    Code:
    "parameters":"{ \"music\" : [\"\/music\/arctic-battle3-loop.ogg\"], \"uniqueId\" : \"bossmusic\" }"
    is because they have path with escape character. The code has to "escape" certain characters (in this case, the double quote and the slash / ) to make it readable by the program. It escapes using the backslash ( \ ).

    Your second problem is you're trying to patch an array. See the square brackets ( [] ) between the music path? That's an array. So you should have used this instead:
    Code:
    [
    {
    "op": "replace",
    "path": "/layers/objects/properties/parameters/music/0",
    "value": "\/music\/BossBattle4.ogg\"
    }
    ]


    /0 indicates that it's the first array (the first thing inside the square brackets). But, in this case, that still won't work. Because, if you check the higher paths, there are actually more arrays...

    It should be something like this:
    Code:
    [
    {
    "op": "replace",
    "path": "/layers/2/objects/???/parameters/music/0",
    "value": "\/music\/BossBattle4.ogg\"
    }
    ]
    I write that as "???" because there are just too many arrays there to count one by one. It's a difficult task to count them, unless you're quite dedicated.

    Since this file you're editing is a dungeon, however, that means the file can be edited by other means. Which is by Tiled Map Editor.

    You can download the program here:
    http://www.mapeditor.org/

    And follow the basic tutorial here:
    http://starbounder.org/Modding:Tiled
    or
    http://community.playstarbound.com/threads/starbound-and-tiled-getting-started-tiles.131443/

    ----

    Edit: in case you didn't know, you can check the validity of your patch using Kawa's JSON Tools: http://helmet.kafuka.org/sbmods/json/
     
    Nerd of all trades likes this.
  6. lazarus78

    lazarus78 The Waste of Time

    You patch it like you would literally any other json.

    This site helps: http://chbrown.github.io/rfc6902/

    The vast length of those files can be problematic, but you can strip them down quite a bit to be easier to work with.

    Example patch I had made for the avian mission:
    Code:
    [
        {
            "op": "replace",
            "path": "/layers/3/objects/0/properties/parameters",
            "value": "{ \"music\": [\"/music/Flaahgra.ogg\"], \"uniqueId\": \"bossmusic\"}"
        },
        {
            "op": "replace",
            "path": "/layers/3/objects/1/properties/parameters",
            "value": "{ \"messageType\" : \"playAltMusic\", \"messageArgs\" : [[\"/music/ChozoElderCathedral.ogg\"], 2.0] }"
        }
    ]
    
     
    xaliber likes this.
  7. eshadow123

    eshadow123 Void-Bound Voyager

    Gosh, once again Lazarus has helped me, and another 2 people have as well. Y'all are so nice, I couldn't thank you all more, thank you all so much for helping me out, means so much to me that there is people ready to help those with less experience.
     
  8. xaliber

    xaliber Scruffy Nerf-Herder

    That could save a lot of time doing all the counting. Thanks very much!
     
  9. eshadow123

    eshadow123 Void-Bound Voyager

    I've written the patch and set up the mod, however whenever I try to beam to the mission, It just beams me back to where I'm standing
     
  10. lazarus78

    lazarus78 The Waste of Time

    need your log file.
     
    xaliber likes this.
  11. eshadow123

    eshadow123 Void-Bound Voyager

     

    Attached Files:

  12. eshadow123

    eshadow123 Void-Bound Voyager

    Was that the right file?
     
  13. lazarus78

    lazarus78 The Waste of Time

    Yes it is the right file.

    You have many errors for various things. You really should sort those out.

    The most pertinent error has to do with, basically your patch is bad for the apex mission.
     
  14. eshadow123

    eshadow123 Void-Bound Voyager

    I see, then I'll work on a better patch, though those websites said it was good, I think
     
  15. eshadow123

    eshadow123 Void-Bound Voyager

    The only thing I can come up with is:

    [
    {
    "op": "replace",
    "path": "/layers/2/objects/0/properties/parameters",
    "value": "{ \"music\": [\"/music/BossBattle4.ogg\"], \"uniqueId\": \"bossmusic\"}"
    }
    ]

    And yet still I'm just teleported back.

    Bleh sorry if I'm pestering you, I just want to get one mod working then I can do the other areas on my own.
     
  16. lazarus78

    lazarus78 The Waste of Time

    Pack up your mod and post it. It will be easier to see whats going on.

    Otherwise, try this:
    Code:
    [
        {
            "op": "replace",
            "path": "/layers/3/objects/1/properties/parameters",
            "value": "{ \"music\" : [\"/music/asd.ogg\"], \"uniqueId\" : \"bossmusic\" }"
        }
    ]
    
    Replace "asd.ogg" with the music file name. MAKE SURE the music file is actually in that file location.
     
    Last edited: Aug 10, 2017
  17. eshadow123

    eshadow123 Void-Bound Voyager

    I uploaded the .pak to mediafire, heres the link:
    http://www.mediafire.com/file/ge4pueum1nwc8n3/musicReplacerTest.pak
     
  18. lazarus78

    lazarus78 The Waste of Time

    Here you go, I made a mistake on my end. I tested and this works for the apex mission.

    Code:
    [
        {
            "op": "replace",
            "path": "/layers/4/objects/697/properties/parameters",
            "value": "{ \"music\" : [\"/music/NewAsteriskBossBattle4.ogg\"], \"uniqueId\" : \"bossmusic\" }"
        }
    ]
     
  19. eshadow123

    eshadow123 Void-Bound Voyager

    It worked, but now I gotta find the value for those numbers in all the scripts, since I'm assuming they aren't same

    Any easier way to do that or am I gonna be counting for a while (And if there isn't an easier way how do I come up with those numbers)
     
  20. lazarus78

    lazarus78 The Waste of Time

Share This Page