Modding Help Create item that mutes bgm?

Discussion in 'Starbound Modding' started by Fruiteyes, Dec 2, 2016.

  1. Fruiteyes

    Fruiteyes Phantasmal Quasar

    Is it possible to create an item that would mute the currently playing background music? I know how to make an item play a song, such as the musicbox, but I want this item to also mute whatever music is currently playing in the background. Is this possible?
     
  2. Chofranc

    Chofranc Pangalactic Porcupine

    But why you want to do that? You can simply turn off the bgm in the options and is done.
     
  3. Fruiteyes

    Fruiteyes Phantasmal Quasar

    I only want to mute the bgm when the player enters a certain area. I'd like to create an invisible item in the background that will override the bgm and play something different instead, until the player leaves that area. It isn't so simple as just turning the bgm off. I want an effect similar to the Shoggoth mission in the Frackin' Universe mod, where certain sound effects are triggered when you reach certain areas; except it also mutes whatever music is already playing.

    Unfortunately I can't just look at his code to see how he did it and learn from it, as the mission file seems to be encrypted somehow.
     
  4. Chofranc

    Chofranc Pangalactic Porcupine

    By encrypted you mean that is a file .pak? You must unpack it, see this thread.
    I don't use that mod so i can't tell what it does.
     
  5. Fruiteyes

    Fruiteyes Phantasmal Quasar

    No, I have the .pak unpacked itself, but when I get to the json file that contains, it's encrypted with zlib, so I can't examine the actual information I want to see.


    I was just now thinking that perhaps he uses a stagehand to get the desired effect, but I can't seem to find any documentation on how stagehands work or how to implement them, so if anyone has information on that, I'd really appreciate it if you could share it.
     
  6. Chofranc

    Chofranc Pangalactic Porcupine

    Look the files /quest/story/protectorate.json and /quest/scripts/tutorial/protectorate.lua

    In the tutorial they change the music using this function:

    world.sendEntityMessage(entity.id(), "playAltMusic", config.getParameter("startingMusicTracks"))
     
    Fruiteyes likes this.
  7. Fruiteyes

    Fruiteyes Phantasmal Quasar

    Oh nice, thank you very much! I'll take a look at this and hopefully that'll solve my problem.
     

Share This Page