Modding Help Hit a Game Breaking Error Using My Mod

Discussion in 'Mods' started by DomTSVG, Apr 29, 2017.

  1. DomTSVG

    DomTSVG Void-Bound Voyager

    So, I'm gonna keep this short and sweet.

    Basically, I'm trying to add in crops to the game, so I'm just trying to get them in one at a time. I only have one crop in so far, but it seems that when I input the .xnb files to add in the crop, something about it breaks, and you can't open the mailbox letters, view the top mission in the journal, and the game locks up when trying to save. I can't for the life of me figure out what's wrong with the files, or find out why they're crashing the game.

    If someone could take a look at them, that would be great. Any help that y'all can offer is highly appreciated.

    Here are the files.

    Thanks for your time!
     
    • Voltaic123

      Voltaic123 Pangalactic Porcupine

      Well Idk if its why your game is crashing, but your 'crops.png' and 'crops.yaml' are misnamed as 'CropsTILES' for some reason.
       
      • DomTSVG

        DomTSVG Void-Bound Voyager

        I rename them back to the proper names when I repack them, so it shouldn't be an issue, at least, I'd assume.
         
        • MysticTempest

          MysticTempest Spaceman Spiff

          Those errors aren't ones I'd expect to be related to your crop mod. Are you using some other outdated mods along with your crop mod?

          I know with v1.2 some of the quests are glitchy. The game has to convert v1.1 quests to v1.2 and can break. And if you have a mod for mail lacking the right data; or one conflicting with another; you could get letters you can't open.

          I can check your savefile to see which data is erroring out if you want:
          Save file locations:
          Windows: %AppData%\StardewValley\Saves\
          OSX: /Users/yourusername/.config/StardewValley/Saves
          Linux: ~/.config/StardewValley/Saves/


          As for your mod files they look good. One suggestion though. Put the files in directories; specifically, a directory layout like the game has. Then you can modify, and pack them quicker. Plus they're already setup in the proper directories for people to merge into their own Content folder. No need for renaming, and XNBnode is just fine with un/packing files in directories.

          Content
          |-Data
          | |--Crops.yaml
          | |--ObjectInformation.yaml
          |-Maps
          | |--springobjects.png
          | |--springobjects.yaml
          |-TileSheets
          |--crops.png
          |--crops.yaml
           
            DomTSVG likes this.
          • DomTSVG

            DomTSVG Void-Bound Voyager

            I'm not using any mods that change anything but graphics, my SMAPI folder is empty and it's a fresh contents folder, besides the graphical mods. Everything in there works without the modifed .xnbs. I'll definitely put the files into directories.

            Unfortunately, the game works absolutely fine if I don't replace the .xnb files I'm using for the crops mod, so I don't quite see how the save file would be the issue. Each time I put the contents back fresh without the file, the game will be fine with no errors at all.

            I can still give you the saves, if absolutely necessary. Here you go!
             
            • MysticTempest

              MysticTempest Spaceman Spiff

              Thanks for the save. The issue with not being able to view the top mission, "Initiation" and the game locking up when trying to save are the same issue.

              Quest from Save data:

              Code:
               <Quest xsi:type="SlayMonsterQuest">
                <currentObjective>9/10 Green Slimes defeated</currentObjective>
                <questDescription>If you can slay 10 slimes, you'll have earned your place in the Adventurer's Guild.</questDescription>
                <questTitle>Initiation</questTitle>
                <rewardDescription>-1</rewardDescription>
                <accepted>false</accepted>
                <completed>false</completed>
                <dailyQuest>false</dailyQuest>
                <showNew>false</showNew>
                <canBeCancelled>false</canBeCancelled>
                <destroy>false</destroy>
                <id>15</id>
                <moneyReward>0</moneyReward>
                <questType>4</questType>
                <daysLeft>0</daysLeft>
                <nextQuests>
                <int>16</int>
                </nextQuests>
                <targetMessage>Ah, @! So you helped us with our slime problem? Thank you!$h#$b#I hope you didn't go through too much trouble...Those slimes can be pretty dangerous in groups.#$b#It should be a little easier to go spelunking now, thanks to your efforts. Enjoy your reward!</targetMessage>
                <monsterName>Green Slime</monsterName>
                <target>null</target>
                <numberToKill>10</numberToKill>
                <reward>360</reward>
                <numberKilled>9</numberKilled>
                </Quest>
              


              Error Log when trying to save while the quest is present:

              Code:
              [23:59:36 ERROR SMAPI] An error occured in the base update loop: System.InvalidOperationException: There was an error generating the XML document. ---> System.NullReferenceException: Object reference not set to an instance of an object
                at StardewValley.Quests.DescriptionElement.loadDescriptionElement () <0x41dc40d0 + 0x000ac> in <filename unknown>:0
                at StardewValley.Quests.SlayMonsterQuest.reloadObjective () <0x41dc3de0 + 0x0012b> in <filename unknown>:0
                at StardewValley.Quests.Quest.get_currentObjective () <0x41dc3230 + 0x0011f> in <filename unknown>:0
                at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterSaveGame.Write116_SlayMonsterQuest (System.String n, System.String ns, StardewValley.Quests.SlayMonsterQuest o, Boolean isNullable, Boolean needType) <0x41dc3400 + 0x0043f> in <filename unknown>:0 
              


              As for the mail issue. I'm not too sure why you can't read it. It's one of the default letters from Evelyn. It's a bit strange you get no errors when you're not modding the files.
              I'd verify your game files, just to be safe.

              Also, here's a test save. I removed the Initiation quest, and you can save now. It's a known issue, and the devs are working on a fix. So you might want to keep your current save backed up til then.
               

                Attached Files:

                DomTSVG likes this.
              • DomTSVG

                DomTSVG Void-Bound Voyager

                Game files have all been verified, and as far as I can tell, the save issue, even when replacing the files and loading other saves than the one I sent, doesn't happen. I'm not at all sure what the issue is, but I hope it doesn't crop up again.

                As a secondary question, in the Crops.xnb file and the ObjectInformation.xnb file, could you outline exactly what the lines of code mean in full? I have a very basic understanding, but I want to make sure absolutely everything is correct.

                As well as that, I'd like to try and find a way to get the seeds for the crops into the hands of players without cheating, either via a quest, crafting recipe, or a shop. Is there a way to do this via .xnb modding that I haven't come across? I've done some digging, and it seems like it's not possible.
                 
                  Voltaic123 likes this.
                • MysticTempest

                  MysticTempest Spaceman Spiff

                  Hehe, nice pun. Glad to hear the save issue isn't happening now.


                  For your secondary question. I'd really recommend checking out Alpha_Omegasis' - "Stardew Valley Modding Guide": http://community.playstarbound.com/threads/modding-guide-feed-back-help-thread.107390/
                  It goes into way more detail on these topics; explaining things better. And it also covers a lot of other topics.

                  But, I'll give a rundown based on my own mod.


                  ObjectInformation.yaml
                  Code:
                  797: "Tea Leaf Cuttings/20/-300/Seeds -74/Tea Leaf Cuttings/Plant in spring or summer to grow a Tea plant." #!String
                  
                  797: This number at the start of each line is the ObjectID of the item. This number is based on its location in the 'Maps/springobjects.png' file.

                  "Tea Leaf Cuttings/: This first category is the base name for the item.

                  20/: This 2nd category is the sell price of the item.

                  -300/: How much health/energy is restored upon eating. -300 seems to be one of the variables for inediblity. See example 2 for some further info on this category.

                  Seeds -74/: Is a set of subcategories for different items. It's best to keep similar items together.

                  Tea Leaf Cuttings/: This is a new category added in v1.2 It's the 'Display Name', and is the name that
                  changes when you switch languages. The one that can be safely translated.

                  Plant in spring.../: Is the description for the item. And, there's sometimes another category after that; see example 2 again.



                  Example 2:
                  Code:
                  798: "White Tea/75/60/Cooking -7/White Tea/A lite brew of young tea leaves; has a fresh flavor./drink/0 0 0 0 0 0 0 0 0 0 0/0" #!String
                  
                  60: 60 is how much Health is restored, and 150 Energy is derived from the health variable.
                  The equation is: "H * 2.5 = E"
                  Example: 60Health * 2.5 = 150 Energy restored along with 60 Health defined.


                  /drink/: This tells the game what animation to use when consuming the item. 'drink' or 'food' are the only 2 options.
                  0 0 0 0 0 0 0 0 0 0 0/: These zeros define the buffs you receive.
                  There are 12 0's. Not sure about all of them, but it's what I found while working on my mod.


                  1: Farming
                  2: Fishing
                  3: Mining
                  4:
                  5: Luck
                  6: Foraging
                  7:
                  8: Max Energy
                  9: Magnetism
                  10: Speed
                  11: Defense
                  12: Attack? But, 12 is glitchy?


                  /0": This last trailing zero defines the buff duration.
                  Quick example using the Maple Bar:
                  Maple Bar/.../1440" #!String

                  The 1440 comes out to roughly 17mins.
                  Buff time calculated as follows:
                  .7 * 1440 = 1008
                  1008/60 = 16.8 minutes



                  Crops.yaml

                  Code:
                  797: "1 2 2 3 2/spring summer/41/797/2/0/true 4 6 10 .02/false/false" #!String
                  
                  797: This is a reference to the ObjectID #.
                  "1 2 2 3 2/: This is the growth cycle. 5 stages, with each number representing the days for each cycle.
                  spring summer/: Is when you can plant them.
                  41/: This is the location on the sprite in "TileSheets/crops.png"
                  797/: This one is which item your crop produces. It's referencing the ObjectID #
                  2/: Is the variable that determines how many days after you harvest a crop it'll take to be ready for a new harvest.

                  The variables after that I don't remember too well, but the guide I believe covers that.



                  As for your 3rd question; on getting the seeds to the players. The way I did it was both cooking recipes, and sending mail in-game. But, you could also theoretically do game events, or dialogue based ones as well.


                  CookingRecipe Example
                  Code:
                  Sweet Tea: "797 4 245 1/1 5/805/f Leah 2" #!String
                  Tea Leaf Cuttings: "495 1 496 1 347 1/1 5/797/f Demetrius 2" #!String
                  
                  These are pretty straightforward.

                  Sweet Tea: Name

                  "797 4 245 1/: These numbers are the ingredients; 4 Tea Leaf Cuttings, and 1 Sugar equals a Sweet Tea.

                  1 5/: Not quite sure about these.

                  805/: 805 is the ObjectID # of the Sweet Tea.

                  f Leah 2": Means at 2 hearts of friendship with Leah, send a letter for the cooking recipe.



                  Mail Examples:
                  Code:
                  LeahCooking: "Dear @,^^Here is a recipe for one of my favorite teas. A perfect pick me up on any day. Enjoy!  ^  -Leah%item cookingRecipe %%" #!String
                  winter_23: "Dear @,^ I ordered some tea sprouts, but they sent me too many. So, I figured I'd share my birthday present with the town farmer. Hehe, enjoy! ^  -Leah%item object 797 75 %%" #!String
                  
                  CookingRecipes are sent with this bit of code at the end. Generic, and determined by the CookingRecipe file.:
                  %item cookingRecipe %%

                  And, you can send items directly with this at the end. Where the Object ID# of what you're sending is first, and how many you're sending is 2nd.:
                  %item object 797 75 %%



                  Hope that helps some!
                   
                    Amburr and DomTSVG like this.
                  • DomTSVG

                    DomTSVG Void-Bound Voyager

                    You've been more helpful than I could have hoped for, and for that, I thank you!
                     

                    Share This Page