Modding Guide Feed Back/Help Thread

Discussion in 'Mods' started by zipy199522, Mar 1, 2016.

  1. zipy199522

    zipy199522 Pangalactic Porcupine

    Hey everyone, Alpha_Omegasis here just to start a thread all about the modding guide that I've been piecing together over the last few days to help you all understand how to edit some of the files for Stardew Valley. In case you haven't been following our progress so far, our fellow members have made AMAZING progress so far on helping to mod the game and create all sorts of useful tools for future modding support.
    You can check out all of their work here!

    We are still in the super early stages of development so any sort of feedback is greatly appreciated.

    If any of you have any sort of comments/suggestions/questions regarding modding .xnb files feel free to ask them here, but also make sure you check out the guide that I've been working on. Any sort of help catching grammatical errors or feedback is super appreciated.
    Link to my guide here:
    Stardew Valley Modding Guide

    I'll update the guide as time goes by, but hopefully you all can find this to be of some use.

    Some of the goals I want to tackle include
    -being able to understand all of the content in StardewValley/Contents/Data and seeing how the core files of the game work and see different things occur from it. I'll also post any of my work here that I make in case you all want to work with what I have.
    -Digging into Zoryn's Staredew Valley API and learning how that works so I can cover how to make mods using that. (For more general modding purposes, since .xnb modding isn't quite effective at the moment)
    -Working on finishing the guide to help you all make mods much more simply.
    -Helping develop the Stardew Valley Modding community.
    • Draivin

      Draivin Scruffy Nerf-Herder

      It would be interesting to have the meaning of each text symbol.
      • zipy199522

        zipy199522 Pangalactic Porcupine

        Opps, looks like I forgot to add them all in. I'll add that to the TODO list.
        • Shiunin

          Shiunin Void-Bound Voyager

          Hello! I have a question for you. I've been able to extract some of the xnb files, but others just refuse to convert. Am I doing something wrong? This is all that happens:
          Wrong file type maybe?

            Last edited: Mar 2, 2016
          • zipy199522

            zipy199522 Pangalactic Porcupine

            Ahh that's right, I forgot to update the guide under the pictures section, thanks for the catch!
            Using xnb_node version 0.1.0 actually has support for .png files. I'll update the guide right away.

            If you have xnb_node version 0.1.0 you can actually run the command
            xnb_node.cmd extract springobjects.xnb springobjects.png and it should extract the picture for you.
            • SgtPineapple1st

              SgtPineapple1st Subatomic Cosmonaut

              There's a correction in your guide for the crops section. You say that the third line references row number in the crop sprite sheet, but going through and counting, it actually references the crop in a series from 0-39. The first seed counts as 0 and then it counts the crop to the right as 1. The final crop is 39 on the sprite sheet. CropTile ID-Tile Reference Data.png

              (there's a break after corn as the IDs start increasing by 1 until Tulips. Also there was no ID for the crops at location 24 and 25 above tulips and jazz)
              • zipy199522

                zipy199522 Pangalactic Porcupine

                Thanks a ton for that catch! I'll update the guide right away!

                Done, and edited. Thanks again! I'll work on a way to add new crops into the game once I dig through some of the other requests such as updating the dialogue section!
                • SgtPineapple1st

                  SgtPineapple1st Subatomic Cosmonaut

                  I just added a crop to the game! It works and everything. I will provide screenshots and other stuff later when I get home.
                    cankersaur likes this.
                  • zipy199522

                    zipy199522 Pangalactic Porcupine

                    That's amazing! I'm looking forward to how this can be done!
                    • zipy199522

                      zipy199522 Pangalactic Porcupine

                      Just updated the guide with descriptions for all of the symbols for NPC dialogue. I posted all the symbols that I tested. If I didn't mention a symbol there, just let me know!
                      • SgtPineapple1st

                        SgtPineapple1st Subatomic Cosmonaut

                        Ok... are you ready? Here we go...

                        Adding Crops

                        A quick note that the Rice crop I added simply outputs the rice that's already in the game. I will be working today on adding a custom rice for harvest, and eventually there will be a machine to process this into the cooking rice. I will add images of my code later today as well. I'm pretty bad at explaining steps and stuff in text...

                        1. There are 4 xnb files that you will need to extract. Under content\data extract both crops.xnb and objectinformation.xnb. Now go to content\tilesheets and extract springobjects.xnb and crops.xnb, but be sure to output it as something other than crops.yaml so that you don't get it confused with the crop data. I saved mine as cropTile.yaml.
                        2. On the Crops sprite sheet you will need to add your new crop. Each crop gets exactly 128px wide and 32px high. This area is divided into 8 spaces for each crop phase. The number of slots you use depends on how many phases your crop grows through. When you open the sprite sheet add 32px to the bottom. The crops are counted left to right. You can begin adding your crop sprites.
                        3. On the sptingobjects sprite sheet each object gets a 16x16 area. Add 16px to the height. If your seed packet corresponds to ID 792, you will want to make this sprite in left most column. Your harvest crop will be right next to it with an ID of 793. Rice_SpriteSheet.PNG
                        4. Now you'll need to open up your ObjectInformation.yaml. Scroll yourself all the way to the bottom. Note how the IDs end at 790. Add a new line ID'ed 792 (Edit: 791 corresponds to the black missingtexture sprite so avoid it). I'd suggest copying the text from another crop seed (for mine I copied blackberry), and then edit it from there. (I will edit this post later to add the code layout) Make sure that this item is not named after your crop. This item will be your Crop's Seed. DO NOT FORGET TO ADD #!String. IF YOU DO NOT, IT WILL NOT REPACK objectinformation.xnb. Below is the code for my rice. To add your crop's harvested output, repeat these steps under a new ID (preferably the very next ID number) The Info layout is as follows:
                          ID#: "Item Name/Sell Price/Item Type (each item type has a corresponding number. I noticed seeds are usually -74. If you use a different number, you will be unable to plant the seeds)/Item Description" #!String <and I once again stress, IF YOU DO NOT ADD THIS, IT WILL NOT REPACK INTO AN XNB!!!
                        5. Now let's move to the crop.yaml for the crop data. Scroll to the bottom and add your crop. The ID will be the same as the one you added in ObjectInformation.yaml. The index number, if you did your sprite sheet correctly, will be 40 (if you add another crop, it's index will be 41). You will also need to add the ID of the output crop for example my rice crop output ID is the ID for Rice. Here is my (terribly made placeholder) rice crop phases on the sprite sheet with the corresponding crops.yaml (not the cropTile.yaml) code on the right: Rice_CropsXNB_Sprites.PNG
                        6. You will not need to touch the cropTile.yaml. Now repack all the yaml files and replace the content files. I'd highly suggest making backup copies of the vanilla xnb files.
                        If you get any errors, let me know. I encountered a few that resulted from coding mistakes (like not adding #!String).

                        I DID IT REDDIT! I... DID... IT! AND THIS IS WHAT YOU'LL SEE IN GAME! HOLY MOTHER I AM SO EXCITED I DID THIS! (I've never modded a game before in my life)
                        Rice_InGame.PNG RicePlanted.PNG RiceSold.PNG

                        Edit: If I get the chance to stream later today, I will stream my modding endeavors in Stardew Valley. If not today, then tomorrow. I will be streaming my modding endeavors in a few hours on twitch if anyone has questions, comments, or suggestions. SgtPineapple1st on twitch
                          Last edited: Mar 3, 2016
                          Acerbicon and lunaelto like this.
                        • Skipper Scootaloo

                          Skipper Scootaloo Scruffy Nerf-Herder

                          You should make the first big mod. :p expanded crops and cooking. :p
                            Jaata and SgtPineapple1st like this.
                          • SgtPineapple1st

                            SgtPineapple1st Subatomic Cosmonaut

                            I'm actually looking into crafting and cooking right now. Trying to make a machine that will process the rice grains into the Rice(cooking resource), but I do plan to add plenty of stuff. My only concern for adding crops is the IDs and compatibility with other mods. I'll worry about that later though.
                            • zipy199522

                              zipy199522 Pangalactic Porcupine

                              Ohh my word, that's freaking awesome! I'll update the guide right away with this new information. Thanks a ton SgtPineapple1st!
                              • SgtPineapple1st

                                SgtPineapple1st Subatomic Cosmonaut

                                You're welcome, do note that the only way to get custom crops is to spawn them with the API. I'm working on adding them to the shop today.

                                I have the mod up on the forum for download, but there is an issue that I have to fix... The fix is in the post, but I can't fix it atm.
                                  Last edited: Mar 4, 2016
                                • Pazoki

                                  Pazoki Space Hobo

                                  Hi, I just have a question about text editing. I love the characters and the story but I just want a bit more out of the dialogue interactions. Especially when it comes to gaining affection from the 'singles'. I haven't unpacked the game yet but I have read everything in the guide about it. Going to unpack when I get home.

                                  Basically what I want to know is from what has been seen so far, does it look like adding a more robust dialogue system seem possible? What I am considering is adding more options for responses from the player to the npcs and then have those responses have more influences on how npcs feel about the player. Change gaining hearts from a mostly stuff-the-npc-with-items-they-like to something more interactive. This would require chat responses to have an affect(or the illusion of it) on other interaction you have with the NPC. I want to remove the feeling of silent protagonist.
                                  • hitachihex

                                    hitachihex Void-Bound Voyager

                                    Shop stock is -mostly- hardcoded. Some of the methods returning stock, like Willy for example have static returns, but Pierre's is a public non-virtual method, so non-overrideable without replacing the JIT'd method (which is where SMAPI will have to head eventually if they want to increase functionality, sans requesting CA to support modding more effectively.)

                                    Edit: It's possibly with SMAPI right now to create a custom shop.. though, not really sure how that'd suit your fancy ;)

                                    CJB basically did what you would have to do if you wanted to implement rudimentary purchasing of them without editing IL like StardewInjector does.
                                      Last edited: Mar 5, 2016
                                    • zipy199522

                                      zipy199522 Pangalactic Porcupine

                                      Hmm, I did see some extra values associated with dialogue when I was digging though branching questions, where you would have multiple choices. This might be related to NPC affection level. If you look at the dialogue section of the guide where I explain the $q and $r commands in the dialogue documentation, there should be some numerical values such as 50 and 10 in there. I believe that is an affection bonus that the NPC will get if you pick that choice. For example taken directly from the guide:

                                      Examples how $q and $r work


                                      *sigh*... My mother definitely has a problem with going to the saloon too much.$s#$q 7/8 Mon_old#But it's best not to dwell on bad things, right?#$r 7 50 Mon_7#Right. It's best to be positive!#$r 8 10 Mon_8#I think it's good to be realistic." #!String

                                      *sigh*... My mother definitely has a problem with going to the saloon too much.$s#$q //This is the dialogue that comes before the question branch.

                                      7/8 Mon_old#But it's best not to dwell on bad things, right?#$r //this is the part that is the question string and initiates dialogue options.

                                      7 50 Mon_7#Right. It's best to be positive!#$r //option 1. Calls the dialogue associated with Mon_7

                                      8 10 Mon_8#I think it's good to be realistic." #!String //option 2. Calls the dialogue associated with Mon_8

                                      Mon_7: "That's how I feel. I'm just going to focus on making the future better." #!String //associated dialogue for answer 1

                                      Mon_8: "Maybe you're right. It's better to cope with reality.$u" #!String

                                      //associated dialogue for answer 1

                                      I know for a fact that Penny reacts much more positively associated with that first choice, than with the second choice, and that numerical value is higher too. I'm 99% certain that is what you are looking for. I can't test it too much myself right now since I have a couple of things irl I need to take care of, but hopefully this helps you a bit. Let me know if this works for you!
                                      • Pazoki

                                        Pazoki Space Hobo

                                        I was looking round the files last night. I could make sense of most of the dialogue files. I will test out a few things when I can and keep you updated. I'm also curious about NPC pathing, so I will let you know what I find out about that. But progress will be slowish cause I'm still enjoying playing the game as well as having work.
                                        • ninjatulio

                                          ninjatulio Space Spelunker

                                          I didn't find the springobjects image like yours. Mine is different (attached). Where do I insert the new stuff?
                                          Also, does this image contains all items in the game? How do I know what will be the ID of the object I insert based on its location?


                                            Attached Files:

                                          Share This Page