RELEASED Content Patcher *

Loads content packs that change the game's images and data without replacing XNB files.

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

    Pathoschild Tiy's Beard

    Does this still happen with the latest version of SMAPI (currently beta 17)? There were some content fixes, and I can't reproduce this anymore.
     
    • MouseyPounds

      MouseyPounds Cosmic Narwhal

      I have SMAPI 2.6-beta.16 and didn't see any links to a newer version. I do still have at least 1 content pack that loads an xnb, but I have not seen any of those errors recently.
       
      • Pathoschild

        Pathoschild Tiy's Beard

        Sorry, beta 16 is latest. Thanks for retesting!
         
        • Pathoschild

          Pathoschild Tiy's Beard

          I added a DayEvent condition in the upcoming Content Patcher 1.4-beta.5 which can be used for festival and wedding days. Thanks for the suggestion!
           
          • Pathoschild

            Pathoschild Tiy's Beard

            The upcoming Content Patcher 1.4-beta.5 adds a HasFlag condition which lets you check that (and many other things). The readme will have a list of useful flags. :)
             
            • Cookie Coder

              Cookie Coder Orbital Explorer

              Is it possible for anyone to make a tutorial for how to make content packs for Content Patcher? I'm a bit of a noob but really wanna be able to code content packs myself.
               
              • Pathoschild

                Pathoschild Tiy's Beard

                Hi @Cookie Coder. There's a few options you can look at:
                If something is unclear, feel free to ask questions here!
                 
                • Pathoschild

                  Pathoschild Tiy's Beard

                  Content Patcher 1.4-beta.5 is now available! (For Stardew Valley 1.3 beta only.)

                  This adds five new conditions for modders:
                  • DayEvent: check if there's a festival or wedding today.
                  • HasFlag: check if the player received a letter or has a flag set (e.g. whether they have a Joja membership or which arcade games they've beaten).
                  • HasMod: check if another mod is installed (e.g. for automatic compatibility patches).
                  • HasSeenEvent: check if the player has seen a given event ID.
                  • Spouse: check if the current player is married to a given NPC or farmer.
                  See the readme for more info.
                   
                    hatmouse and tenthousandcats like this.
                  • andiluxe

                    andiluxe Phantasmal Quasar

                    I don't see anyone mentioning this so far, but Content Patcher is now rejecting some of my config values in the "When" field. Example:

                    [ContentPatcher] Ignored Slime Hutch Winery for ContentPatcher > entry #9 (Load Maps/SlimeHutch): the When field is invalid: 'Interior Layout' isn't a valid condition; must be one of Day, DayOfWeek, Language, Season, Weather, DayEvent, HasFlag, HasMod, HasSeenEvent, Spouse.


                    This definitely used to work, but is it that the config value has a space?
                     
                    • Pathoschild

                      Pathoschild Tiy's Beard

                      Hi @andiluxe. Can you send me a zip of that mod's folder? I'll take a look. I'm releasing some mod updates tonight, so I can fix that right away if it's a bug.
                       
                      • andiluxe

                        andiluxe Phantasmal Quasar

                        @Pathoschild
                        Sorry, disregard. It was me. Somehow I must have misclicked and deleted "Interior Layout" from ConfigSchema. So I had all the changes that... didn't have anything connected to them. But thank you for the swift reply!
                         
                          Pathoschild likes this.
                        • Pathoschild

                          Pathoschild Tiy's Beard

                        • Cvne

                          Cvne Master Chief

                          Hi @Pathoschild, thanks for the content patcher, it's really good to work with.

                          I've been messing around with some dialogue scripts for fun. I'm getting into the swing of things now, but I have a couple of questions that I'm hoping you can answer.

                          ---

                          I'm making a mod which adds a lot of post-heart-events dialogue to the game. I'm currently using "When": {"HasSeenEvent: "901756"} to determine if the player has completed the heart story of a character, but that doesn't account for several variables. I'm looking for a way to make my dialogue appear only when a) you've seen the 10-heart event, b) you are at 9 hearts or above with the character, c) you are not married, and d) you have not divorced the character you are talking to.

                          For checking the heart level, I know you can make dialogue trigger only when at x hearts by using something like "summer_Tue10" (which will trigger the event on any summer Tuesday so long as you have 10 hearts), but this is fairly limiting. For one, I have not found a workable syntax for making an event happen only once a year (say, on Tue 2 of summer) and only when you have 10 hearts. Triggering something on the 2nd day of Summer is "summer_2", but that doesn't account for hearts. "summer_Tue10" triggers any Tuesday of summer, not just on the 2nd of the month, and it's of a lower priority than "summer_2".

                          According to the wiki there should be ways to do this, but I found that the syntax proposed there doesn't function. Here is what they say will work:

                          Code:
                          "<preface>[heart level]_[date]_[year][suffix]": "String"
                          Where <preface> is stuff like weather or season, and [suffix] is whether you're married. I found none of those work. "summer10_2" seems like it should trigger in the summer, with 10 hearts, on the 2nd of the month. I tried "summer10_30" in case date meant days passed, but that didn't work either.

                          I had a look through the existing characters.yaml dialogue files for help but there were no examples that did any of this stuff.

                          For checking divorced/marriage status with other characters, I have no idea how I could begin to do that.

                          Any ideas?

                          ---

                          Also, for anyone else who wants to do dialogue stuff, this template is a good example of the kind of stuff you can do:

                          Code:
                          {
                              "Format": "1.4",
                              "Changes": [
                                  {
                                  "Action": "EditData",
                                  "Target": "Characters/Dialogue/Abigail",
                                  "entries": {
                          
                                      "summer_2":
                          
                                          "This is the first line of the day.$h
                                          #$b#$c 0.5
                                              #I have a 50% chance of saying this first follow-up line.$h
                                              #I have a 50% chance of saying this second follow-up line.$h
                                          #$b#But no matter which line I picked, I always say this.$l
                          
                                          #$e#You had to click on me a second time to read this.
                                          #$b#This is the follow-up text in the second piece of dialogue.
                                          #$b#Now we're done with the second line!
                          
                                          #$e#Now you've had to click on me three times.$0
                                          #$b#I'm bored. Let's talk about our options.$h
                                          #$q 500005/500006 quiz_followup#What are you going to press?
                                              #$r 500005 20 quiz_first#The first option.
                                              #$r 500006 15 quiz_second#The second option.
                                          ",
                          
                                          "quiz_first":
                                              "Yep, you pressed the first option!$h
                                              #$b#Click on me again to talk more about the first option.$0
                          
                                              #$e#Man, that first option really worked, huh?$h
                                              #$b#I've got nothing else to say today though.$0
                                              ",
                          
                                          "quiz_second":
                                              "Yep, you pressed the second option!$h
                                              #$b#We can even have a second quiz here if we want to.$0
                                              #$q 500007/500008 secondquiz_followup#Wanna try?
                                                  #$r 500007 10 secondquiz_first#Sure! First option.
                                                  #$r 500008 20 secondquiz_second#Sure! Second again.
                                              ",
                                              "secondquiz_first":
                                                  "No problem! First option this time. Now click on me again.$h
                          
                                                  #$e#You really like pressing different options, huh?
                                                  ",
                                              "secondquiz_second":
                                                  "Sounds good! Second option again.$0
                                                  #$b#We could add even more branching choices here, but I think people get the message.$0
                                                  ",
                                              "secondquiz_followup":
                                                  "ERROR: secondquiz_followup sentence should not be visible.$8
                                                  ",
                          
                                          "quiz_followup":
                                              "$p 500005#Oh wait, you already pressed the first option.$h
                                              |Oh wait, you already pressed the second option.$0
                                              ",
                          
                                      },
                                      "When": {
                                          "HasSeenEvent": "901756"
                                      }
                                  },
                              ]
                          }
                          Content Patcher makes all of this pretty easy to do. Thanks for working on it.
                           
                          • Pathoschild

                            Pathoschild Tiy's Beard

                            @Cvne Glad to hear Content Patcher is useful! That part of the dialogue page is incomplete and not fully correct. I'm not very familiar with that part of the dialogue system so I can't help immediately myself, but I'll dig into the game code and write up better documentation on the wiki this weekend. :)
                             
                            • Cvne

                              Cvne Master Chief

                              @Pathoschild Thank you kindly! I would really appreciate that. I can only work with the tools I'm given, and I haven't gotten to the point yet where I can go looking for this stuff on my own. I wouldn't know where to start. =)

                              Edit: I've decided that at the top of my wishlist would be a GOTO this_dialogue_event option. That way it would be easier to move from one branching dialogue tree to another. If the game has one of those, let me know. <3
                               
                                Last edited: Jun 29, 2018
                              • Cvne

                                Cvne Master Chief

                                Bloody hell, I finally tracked down a problem I was having.

                                When editing schedules, "When": { "HasSeenEvent": "901756" } apparently breaks them for some reason.

                                Code:
                                        {
                                        "Action": "EditData",
                                        "Target": "Characters/schedules/Abigail",
                                        "entries": {
                                            "summer_2": "0900 SeedShop 2 6 0 abigail_videogames/2100 SeedShop 1 9 3",
                                            }
                                        },
                                ^ works just fine, but
                                Code:
                                        {
                                        "Action": "EditData",
                                        "Target": "Characters/schedules/Abigail",
                                        "When": { "HasSeenEvent": "901756" },
                                        "entries": {
                                            "summer_2": "0900 SeedShop 2 6 0 abigail_videogames/2100 SeedShop 1 9 3",
                                            }
                                        },
                                ^ or
                                Code:
                                        {
                                        "Action": "EditData",
                                        "Target": "Characters/schedules/Abigail",
                                        "entries": {
                                            "summer_2": "0900 SeedShop 2 6 0 abigail_videogames/2100 SeedShop 1 9 3",
                                            },
                                        "When": { "HasSeenEvent": "901756" }
                                        },
                                ^ doesn't, and Abigail reverts to her normal schedule. The HasSeenEvent condition above was copy-pasted from my dialogue changes where it worked perfectly, so this was hell to figure out.

                                Any ideas?
                                 
                                • Pathoschild

                                  Pathoschild Tiy's Beard

                                  Can you...
                                  1. run the game with the broken patch again;
                                  2. run this command in the SMAPI console:
                                    Code:
                                    patch summary
                                  3. upload your SMAPI log (see instructions on that page);
                                  4. and post a link here?
                                   
                                  • Cvne

                                    Cvne Master Chief

                                    I did, and had a look at the log myself, and it probably won't help you. Working and not working are the same.

                                    Working patch (schedule applies): https://log.smapi.io/apBG6L8d
                                    Not working patch (schedule fails): https://log.smapi.io/6DJETR7A

                                    All I did was start the game, load the save, walk out of bed, then type patch summary.

                                    I did notice that the checkmarks for conditions/applied change depending on where I am in the game world. Want me to try to enter the seed shop at 9am with both patches and repeat the process?

                                    Edit: I did, and as I noticed, the checkmarks did change when I was in the SeedShop... but once again both log files are identical.
                                     
                                      Last edited: Jul 1, 2018
                                    • Pathoschild

                                      Pathoschild Tiy's Beard

                                      @Cvne It looks like Content Patcher did apply your changes, so the schedule reset might be a different issue. If you come ask in #modding on the Stardew Valley Discord, we can look into it more deeply (e.g. I can run it through a custom game build to see what it's doing under the hood).
                                       
                                      • Cvne

                                        Cvne Master Chief

                                        Can do. For easy access, here are my current content.json test scripts (for testing in isolation).

                                        Schedule works: https://pastebin.com/raw/xARcvVMP
                                        Schedule doesn't work: https://pastebin.com/raw/HZKcRPm2

                                        Only difference being the conditional. Checking whether to modify the dialogue works just fine. Checking it to modify the schedule doesn't.

                                        That's all there is to it. Testing just requires changing "summer_2" to whatever day of the year it is.
                                         
                                        Thread Status:
                                        Not open for further replies.

                                        Share This Page