Modding Discussion Migrating XNB mods to Content Patcher packs

Discussion in 'Mods' started by Pathoschild, Mar 5, 2018.

Thread Status:
Not open for further replies.
  1. andiluxe

    andiluxe Phantasmal Quasar

    I'm having a bit of a hard time understanding how EditData works. I am using this fairly new Dinosaur to Ostrich replacement, but I'm trying to make a Content Patcher version instead. (@Pathoschild, I think you had helped @CHlPPER once before according to the credits.)

    I think I've sorted out how to edit the Dinosaur Egg name and description, but I'm not sure how to edit Data/FarmAnimals.xnb. How do you get the content number for something like livestock? And is the format the same with regards to the rest of the fields?
     
    • Pathoschild

      Pathoschild Tiy's Beard

      Hi @andiluxe. What do you mean by content number? Can you give an example of what you want to do?
       
      • andiluxe

        andiluxe Phantasmal Quasar

        My bad! I wasn't too sure what to call it either, so I just went by what was listed here. I'm referring to the number that identifies what it is you're trying to change. For objects, that's easy to find since everything is indexed from the sprite sheet. But if I'm editing an animal itself, I'm not too sure how to refer to it.

        It's untested so far, but this is what I have:

        Code:
            // Data
        
            {
              "LogName": "Dinosaur Egg Data",
              "Action": "EditData",
              "Target": "Data/ObjectInformation",
              "Fields": {     
                     "107": {
                 0: "Ostrich Egg",
                 5: "That tiny bird laid this?!"
                     }
                }
            },
            {
              "LogName": "Ostrich Data",
              "Action": "EditData",
              "Target": "Data/FarmAnimals",
              "Fields": {
                 "7": {
                    26: "Ostrich"
                         }
                     }
            },
        I'm 99% sure that barring some forgotten comma (which is ALWAYS my problem), the Dinosaur Egg Data will work. It's the Ostrich Data I am less sure of. This is what is in FarmAnimals.xnb:

        Code:
                "Dinosaur": "7/0/107/-1/none/8/32/48/32/8/32/48/32/0/false/Coop/16/16/16/16/1/8/null/644/1000/Dinosaur/Coop",
        From that I assume that the number I want to identify the Dinosaur is "7", and if the forward slashes separate each field, then the name field is "26"?

        Wish me luck, I'm about to try to load this. Okay, the Dinosaur Egg description worked but the name did not. The Ostrich Data didn't throw any errors, but I'm not exactly where where to verify that it worked.
         
          Last edited: Jun 29, 2018
        • Pathoschild

          Pathoschild Tiy's Beard

          That's called the key (it's the part before the colon when looking at the XNB data), and the field numbers start at zero. Something like this should work:
          Code:
              {
                "LogName": "Dinosaur Egg Data",
                "Action": "EditData",
                "Target": "Data/ObjectInformation",
                "Fields": {      
                  "107": {
                    0: "Ostrich Egg",
                    5: "That tiny bird laid this?!"
                  }
                }
              },
              {
                "LogName": "Ostrich Data",
                "Action": "EditData",
                "Target": "Data/FarmAnimals",
                "Fields": {
                  "Dinosaur": {
                    25: "Ostrich"
                  }
                }
              },
          
           
          • andiluxe

            andiluxe Phantasmal Quasar

            @Pathoschild Thanks! I even had "Dinosaur" instead of "7" as the key earlier and doubted myself. Thank you for the reminder about the zero.

            The Dinosaur Egg isn't quite working though. The description has changed but not the name.
            dinosaurostrichegg.png
             
            • Pathoschild

              Pathoschild Tiy's Beard

              @andiluxe You probably need to change the display name field too. Try this:
              Code:
                  {
                    "LogName": "Dinosaur Egg Data",
                    "Action": "EditData",
                    "Target": "Data/ObjectInformation",
                    "Fields": {     
                      "107": {
                        0: "Ostrich Egg",
                        4: "Ostrich Egg",
                        5: "That tiny bird laid this?!"
                      }
                    }
                  },
              
               
                PandaNikita likes this.
              • andiluxe

                andiluxe Phantasmal Quasar

                @Pathoschild I’ll try it! What does field 0 edit then? Or rather, where does it matter?
                 
                • Pathoschild

                  Pathoschild Tiy's Beard

                  • Field 0 is the internal name often used by the game to identify items.
                  • Field 4 is the display name visible to players.
                  Try leaving field 0 unedited; if it doesn't change any visible text, that's a safer change since any logic for dinosaur eggs will still work.
                   
                    andiluxe likes this.
                  • brightstardew

                    brightstardew Void-Bound Voyager

                    hiiiii! is it possible for anyone to make a CP version of this mod? i'd appreciate it greatly, thank you :nuruflirt:
                     
                    • ramzaheiral

                      ramzaheiral Void-Bound Voyager

                    • Mukamii

                      Mukamii Seal Broken

                      Attached Files:

                      aijvelle and ramzaheiral like this.
                    • andiluxe

                      andiluxe Phantasmal Quasar

                      I might join the Discord server tomorrow so I don’t continue to hijack this thread but I’m having some interesting issues editing data to say the least.

                      Neither Field 0 nor Field 4 would change the display name of the dinosaur egg.

                      I moved on to trying to edit the names and descriptions of some hats (using Data/hats and fields 0,1. It looks like there are only four fields on their format), and I managed to succeed with the first half of the hats. The second half— in the exact same format— didn’t change at all.

                      SMAPI doesn’t give any error logs so I’m at a loss of what I’ve done wrong.
                       
                        Last edited: Jun 30, 2018
                      • Pathoschild

                        Pathoschild Tiy's Beard

                        @andiluxe Are you testing with existing dinosaur eggs? Once an item is created, it stores most of the fields used to create it; so the display name might only change for new dinosaur eggs.
                         
                          andiluxe and Mukamii like this.
                        • Mukamii

                          Mukamii Seal Broken

                          @brightstardew Give this a try.
                           

                            Attached Files:

                          • andiluxe

                            andiluxe Phantasmal Quasar

                            :O I'm not sure, actually. I think it's a new one? I have my game saved so that the day that loads is a day my dinosaur laid an egg... I think. Maybe it was from the day before, and I forgot to check.

                            However, that doesn't explain why only half the hats in the game changed. I went to the hat shack (where i assume the hats are created?), and it was the same scenario.
                             
                            • Pathoschild

                              Pathoschild Tiy's Beard

                              @andiluxe I think the egg is spawned the night before. You can use CJB Item Spawner to create a new item to be sure.

                              For the hats, try this:
                              1. open the hat shop menu in-game;
                              2. enter this command in the SMAPI console:
                                Code:
                                patch summary
                              3. upload your SMAPI log and post a link here.
                               
                                andiluxe likes this.
                              • Olivki

                                Olivki Scruffy Nerf-Herder

                                Last edited: Nov 27, 2018
                              • crans4me

                                crans4me Void-Bound Voyager

                                Thanks Mukamii for the info, I'll try again see if I can load up to 160pcs ^^
                                 
                                • Mukamii

                                  Mukamii Seal Broken

                                  Let me know if you have any luck with it.
                                   
                                  • Billy0815

                                    Billy0815 Scruffy Nerf-Herder

                                    @hatmouse and @D.Grey
                                    I just stumbled across your unofficial updates of my mods. Since I'm currently working on a content pack for Content Patcher I wanted to ask you if I can use your unoffical updates as foundation?
                                    I'm tweaking some textures and add some new features (finally we can have snow on fences in winter!). When I'm ready for a release you both would get proper credit of course.
                                     
                                    Thread Status:
                                    Not open for further replies.

                                    Share This Page