Modding Help How to make pianos only make sound when interacted with by the player?

Discussion in 'Starbound Modding' started by flogenos, Mar 19, 2017.

  1. flogenos

    flogenos Void-Bound Voyager

    I have a saloon on my ship, and it's really neat because all of my crew likes to hang out there. What isn't neat is that they all like taking turns playing the same piano riff over and over again forever. It was cute the first 2-3 times, but now that it's been more like 50, it's getting close to me wanting to just replace the honky_riff1.ogg with a blank audio file, but I still want to hear it when I want to play it. There's the tag "interactOnNpcPlayStart", but I'm unsure as to what that does. Does anyone know how I would go around patching it? Here's the .object.
    Code:
    {
      "objectName" : "saloonpiano",
      "colonyTags" : ["saloon","musical"],
      "printable" : false,
      "rarity" : "Common",
      "category" : "decorative",
      "description" : "It's a piano fit for a saloon!",
      "shortdescription" : "Saloon Piano",
      "race" : "novakid",
      "price" : 160,
    
      "apexDescription" : "All Apex must learn to play. However, only sanctioned music may be performed. There's a microphone hidden in every piano.",
      "avianDescription" : "The buttons produce pleasant sounds.",
      "floranDescription" : "Floran make musssic from ssskin and bone, master of drum. Not sssilly sssound machine.",
      "glitchDescription" : "Smug. The mathematical principles behind this machine are trivially simple.",
      "humanDescription" : "A piano... I can play Chopsticks!",
      "hylotlDescription" : "Ah, music... It has the power to light up even our darkest hours.",
      "novakidDescription":  "A piano fit for the ol' honky-tonk.",
    
      "inventoryIcon" : "saloonpianoicon.png",
      "orientations" : [
        {
          "image" : "saloonpiano.png:<color>",
          "imagePosition" : [-20, 0],
          "direction" : "left",
          "flipImages" : true,
    
          "spaceScan" : 0.1,
          "anchors" : [ "bottom" ],
          "collision" : "platform",
          "collisionSpaces" : [ [-1, 3], [0, 3], [1, 3] ]
        },
        {
          "image" : "saloonpiano.png:<color>",
          "imagePosition" : [-16, 0],
          "direction" : "right",
    
          "spaceScan" : 0.1,
          "anchors" : [ "bottom" ],
          "collision" : "platform",
          "collisionSpaces" : [ [-1, 3], [0, 3], [1, 3] ]
        }
      ],
    
      "animation" : "/objects/noisy/noisy.animation",
    
      "scripts" : [
        "/objects/noisy/noisy.lua",
        "/scripts/npcToyObject.lua"
      ],
    
      "sounds" : [ "/sfx/objects/honky_riff1.ogg" ],
    
      "objectType" : "loungeable",
      "sitFlipDirection" : true,
      "sitPosition" : [-16, 22],
    
      "npcToy" : {
        "influence" : [
          "piano"
        ],
        "defaultReactions" : {
          "piano" : [
            [1.0, "pianoparty"]
          ]
        },
        "interactOnNpcPlayStart": false,
        "randomStandXRange" : [-8, 8]
      }
    }
    
     
  2. IHart

    IHart Scruffy Nerf-Herder

    hazarding a guess, removing the entire npcToy section should accomplish this
    Code:
    [
      {
        "op" : "remove",
        "path" : "/npcToy"
      }
    ]
    
     
  3. flogenos

    flogenos Void-Bound Voyager

    So I tried this out, and it just makes them immediately leave the piano after they start playing it. Usually, they'll sit on it for a while like it's a chair, but now they just get booted off while the infernal sound continues. Hilariously enough, because it's no longer in use by another npc, that means they can activate it again and again, causing the retched sound to form a canon.
     
    IHart likes this.
  4. Dekadrachm

    Dekadrachm Giant Laser Beams

    I'll give you a diff patch, the NPC TOY option is basically what allows NPC interactions with objects.
    Code:
    [
      {
        "op": "remove",
        "path": "/npcToy"
      },
      {
        "op": "remove",
        "path": "/scripts/1"
      }
    ]
    Try this one, it removes all reference of NPC interaction, if they continue to play then it either means I missed something here or for whatever reason it correlates to the objects name (Not likely at all). If this doesn't work and gives you an error post you starbound.log.
     
    IHart likes this.

Share This Page