Modding Help (SOLVED) Expanding Dialog -- "replace" operation cancels "add"

Discussion in 'Starbound Modding' started by Ziz, Mar 17, 2016.

  1. Ziz

    Ziz Void-Bound Voyager

    Hey, guys. Ran into this snag:

    I'm working on a modded race and I'm trying to expand the dialog of the cabin tenant to respond to the race of whoever talks to them. The thing is, the separate "add" and "replace" operations I wrote for the .patch file work just fine on their own. Put those together in the same patch, the "replace" operation cancels "add" out. So far the NPC responds to race under "add" when I tested my human character and talked to him. Not sure about "replace" yet.

    Here is the coding in question:
    Original tenant file, cabin.npctype:
    Code:
    {
      "type" : "cabin",
      "baseType" : "villager",
    
    
      "scriptConfig" : {
        "questGenerator" : {
          "pools" : ["normal"]
        },
    
        "dialog" : {
          "tenant" : {
            "grumbles" : {
              "tagCriteria" : "/dialog/grumble.config:tagCriteria",
              "enclosedArea" : "/dialog/grumble.config:enclosedArea",
              "otherDeed" : "/dialog/grumble.config:otherDeed",
              "severe" : "/dialog/grumble.config:severe",
              "final" : "/dialog/grumble.config:final"
            },
            "arrivedHome" : {
              "beacon" : "/dialog/arrivedhome.config:beacon",
              "rent" : "/dialog/arrivedhome.config:rent"
            }
          },
          "flee" : {
            "helpme" : "/dialog/flee.config:helpme",
            "helpthem" : "/dialog/flee.config:helpthem",
            "encourage" : "/dialog/flee.config:encourage",
            "safe" : "/dialog/flee.config:safe"
          },
          "converse" : {
            "default" : {
              "default" : [
                "The ol' cabin life is the life for me!",
                "I prefer to live without the complications of technology.",
                "Does technology make you happier? Me, I feel as free as a bird without it!",
                "To curl up in front of a fire with a book to read... Now that's living.",
                "As long as some big ol' animal isn't trying to eat me, I can live happily.",
                "There's a lot of folk like me, who prefer to live the simpler life.",
                "Newfangled technology is overrated - I prefer to live the simple life.",
                "I've always wanted to have my own place like this! Perfect for me.",
                "Humans have had homes like this for a long time. I'm carrying on the tradition.",
                "That fresh wood furniture smell... There's nothing better!"
              ]
            }
          }
        }
      },
    
      "items" : {
        "override" : [
          [0, [
              {
                "head" : [
                  { "name" : "caphead", "parameters" : { "colorIndex" : 0 } }, { "name" : "caphead", "parameters" : { "colorIndex" : 8 } }, { "name" : "swamphat", "parameters" : { "colorIndex" : 0 } }
                ],
                "chest" : [
                  { "name" : "hikerchest", "parameters" : { "colorIndex" : 8 } }, { "name" : "hikerchest", "parameters" : { "colorIndex" : 11 } }, { "name" : "pilotchest", "parameters" : { "colorIndex" : 2 } }, { "name" : "workoutchest", "parameters" : { "colorIndex" : 3 } }
                ],
                "legs" : [
                  { "name" : "workoutlegs", "parameters" : { "colorIndex" : 0 } }, { "name" : "humantier1pants", "parameters" : { "colorIndex" : 0 } }, { "name" : "hunterlegs", "parameters" : { "colorIndex" : 0 } }
                ]
              }
            ] ]
        ]
      }
    }
    
    What I'm trying to do, cabin.npctype.patch:
    Code:
    [
      {
        "op":"add",
        "path":"/scriptConfig/dialog/converse/default/simurgh",
        "value":[
          "You may be an owlbear, but they're apart of the wilderness like any other beastie. Not that I'm saying you're a beastie, er... Sorry.",
          "Ain't nothing wilder than the wide, open spaces and having an owlbear as a landlord, haha!",
          "Knew what I was gettin' into with havin' an owlbear as a landlord, but I gotta respect one with taste!",
          "As long as some big, ol' animal ain't trying ta' eat me, I'm happy. Unless that big, ol' animal is you! Haw!",
          "You owlbears are good at huntin', right? How about you and me sometime?",
          "Water under the bridge, owlbear. Water under the bridge and wide, open spaces.",
          "Gotta admit I'm jealous of those wings of yours. Always wanted to fly like a bird.",
          "Can ya' fly with those? I'd rather have wings than technology, ya' know.",
          "I know we humans don't like you owlbears much, but I always found you guys closer to nature. The natural life is for me!",
          "I'll let them say what they will. I'd take an owlbear's ferocity protectin' my place over anything else.",
          "I'll admit jealous of you owlbears. Wish I could go huntin' with my teeth and claws, but we puny humans aren't known for that. Haw!",
          "I don't care if you're an owlbear, you're an owlbear with some fine taste.",
          "Ahhh, the smell of fresh cut wood! I can deal with a little owlbear odor, don't you worry.",
          "Ahhh... I can't wait to go huntin'! Wish I could have a nose as nice as yours, haha!",
          "Owlbear odors don't bother me. That's what that fresh cut wood smell is for, haw!"
        ]
      },
      {
        "op":"replace",
        "path":"/scriptConfig/dialog/tenant/arrivedHome/1/rent",
        "value":[ {
                "default" : {
                    "default" : [ "Here's a gift for all your help!" ],
                "simurgh" : [
                    "Hey, you aren't so bad for an owlbear. Here, have this!",
                    "Maybe owlbears aren't so bad after all. Here, take this.",
                    "You're definitely one of the better owlbears out there. Got a thing for you. You like?",
                    "Nice to know there are some good owlbears out there. How about a little token of my appreciation?",
                    "Hey there, toothy. I have something for you. You like it?",
                    "Here, I have something for you. Next time I might scratch you behind the ears.",
                    "Hey, birdy! Got a gift for you. You like it?",
                    "Nice doggie. How about a treat?",
                    "Thanks for being a gem, doggie. Here, have this!"
                             ]
                          }
                    }
    
                ]
      }
    ]
    Some small things I've been trying to do include expanding the dialog for the Alpaca NPCS (o_O of them to remark on my lack of hair) and adding race-to-race specific death dialogs, but despite the rest of the "add" coding, I can't add anything to those. Trying to add specific death dialog causes the NPC to explode, and the Alpacas either explode when the coding is wrong, or nothing at all if the coding is correct (at least syntax-error free). Not sure if it ties into the same issue as the above, or is a hidden limit of Starbound that I'm unaware of. I couldn't get gender-specific headgear of the same item working, for example.

    Apologies if this is covered elsewhere. I'm fairly new to this and probably didn't use the right search terms. D :
     
  2. Mackinz

    Mackinz The Waste of Time

    Why not reorder it so the add follows the replace in the patch file?
     
  3. Ziz

    Ziz Void-Bound Voyager

    Tried that. Replace text still worked but add still didn't. :(
     
  4. Mackinz

    Mackinz The Waste of Time

  5. Ziz

    Ziz Void-Bound Voyager

    I've been trying to use that myself... It gives me errors but the patch "works."

    Thanks for your help. :)
     
  6. C0bra5

    C0bra5 Oxygen Tank

    it would help if you patched the actual dialog file, your replace is ignored because it hits a separate file. and because /scriptConfig/dialog/tenant/arrivedHome/1/rent as a path points to a null pointer a.k.a. nothing

    for the rent replace you should patch the /dialog/arrivedhome.config file
     
  7. Ziz

    Ziz Void-Bound Voyager

    A-ha. Just caught that in my log file. :)

    I was going to do that, but the issue is that the cabin guy seems to be flagged under "default" rather than "human." Is there anyway I can reroute this guy's dialog? "Owlbear" is a human nickname only and might muck with other modded races.
     
  8. C0bra5

    C0bra5 Oxygen Tank

    option 1: don't care about it
    option 2: create a separate file containing both the game's dialog and custom dialog that you are creating and patch the path in the cabin.npctype file for the rent
     
  9. Ziz

    Ziz Void-Bound Voyager

    Figured it out. Turned out the guy had the right flags all along and was throwing me off due to the unique dialog in the original .npcfile. Throwing out the replace operator and patching the dialog file did the trick. It works now, huzzah! Thanks for the help, all. :)

    This can be marked "solved," not sure how to do it myself, if I can.
     
  10. C0bra5

    C0bra5 Oxygen Tank

    you can simply mark something as best answer, edit the tile of the thing to add solved to it or ask a moderator to close the discussion
     
    Ziz likes this.

Share This Page