Modding Help My quest for a re-growing flower (Lavender)

Discussion in 'Mods' started by guitardude_324, Feb 16, 2017.

  1. guitardude_324

    guitardude_324 Big Damn Hero

    As far as modding experience goes, I’ve successfully changed the appearance of the cat using XNB_Node and edited the cat’s PNG file. So please bear with my lack of experience. My fiancé loves the game and she loves Lavender. We have several growing in our garden and she likes to harvest them to make oils and soaps. I’d love to be able to add lavender to the game, I have an idea of how I would like it to be implemented into the game, but I understand it may be too difficult for an amateur like me. So I’ve come up with 2 solutions.

    Ideal Outcome
    I'd love to add Lavender to the game, but for it to be perfect, it would need to be like a crop that can produce multiple harvests. Growth and harvest cycle would be just like ancient fruit: 28 Days from seed, harvest every week, and survives from spring to fall. However, I would also like to it function like a flower that influences the bee boxes.

    I'd like to be able to get the following products from a lavender plant:
    -Lavender (harvested straight from crop)
    -Lavender Oil (throw the harvested lavender in the oil maker)
    -Lavender Honey
    -[Bonus] Craft Lavender wreath to hang on the wall.

    Compromise
    I’d be willing to accept the solution of just re-skinning the “Summer Spangle” (I don't like that flower) to look like Lavender. And then changing its name to “Lavender”. I do not know where I need to go to change the name.


    If the ideal solution is possible, I’d love to learn how to do it, but I’d also be willing to accept the compromise of re-skinning (and re-naming) the Summer Spangle. Does anybody have any resources, tips, or advice that they can offer?

    Thank you.
     
      Corraidhín, Karmylla and xangria like this.
    • RTGOAT

      RTGOAT Cosmic Narwhal

      Difficult idea as a lot of item functionality is based on its type, and an item can only be of 1 type.

      I'm not one to say it is impossible though; I don't know everything so I can only make assumptions.


      If at the least, you could create a lavender flower to act just like other flowers.
      This would satisfy 1.5 of your conditions.
       
      • guitardude_324

        guitardude_324 Big Damn Hero

        hmm, could it be possible to have two plants occupy one space?

        If that was possible, you could create an invisible flower type and a visible crop type? So you create the illusion that it's one plant doing both things.

        I also have a concern if the honey would work. Somebody on Reddit told me:
        rabidcow
        "Localization. Gluing strings together like this is always tricky to localize, but for honey the game has a hard-codes list of honey types now. (Taking the noun "lavender" and using it as an adjective to modify "honey" isn't necessarily going to work the same in other languages.) I think the consequences are that you'd only get the base honey name and value.

        Incidentally, this also means that you probably shouldn't give it varied colors like the other honey flowers."

        So that may be another roadblock I need to overcome.
         
        • MysticTempest

          MysticTempest Spaceman Spiff

          Assuming you're just doing a replacement of Summer Spangle.
          The localization part won't be an issue if you're updating all the files. For instance; you can overwrite Summer Spangle in the English files, and make Lavender. That will give you Lavender Honey from the Bee Houses.
          If you overwrite the Summer Spangle entry in other languages, it should be fine. But, if you don't change it; then they'll just be using the Summer Spangle in their own language.

          As for the oil; that's a bit trickier. I believe artisan machines are hardcoded. As, I tried replacing Coffee with Tea a while back; and while I could use the Keg. The Keg would still produce 'Coffee' despite my XNB-only changes.

          Someone more knowledgeable with SMAPI could chime in about the possibility of editing those values to bypass the hardcoded stuff.


          However, one alternative is to do like I did with my Tea mod.
          I ended up just remaking Tea as a brand new crop; instead of replacing Coffee. I still wanted some artisan items so I went ahead and used the "Cooking" mechanic in the game, and acquired recipes from the villagers.
          I could grow and harvest my Tea. Then after acquiring the needed recipes; I could move on to "cooking" different Tea drinks, or Tea boxes to sell for more money.

          Stardew already has 'Oil of Garlic', crafted out of Garlic and Oil. You could make your Lavender Oil in the same way, and focus on just modifying the Spangle flower. Then use other recipes for the soaps, and wreath.

          Though, if you went the other way. With adding a separate, new crop, the honey might have to be crafted from a recipe as well. I know you can overwrite the flower name for new honey, but it might be hardcoded to the specific ObjectIDs. I'm not too sure as I haven't tested adding flowers before, but I do remember editing existing ones a while back.
           
            Last edited: Feb 17, 2017
          • rabidcow

            rabidcow Scruffy Nerf-Herder

            I don't think you need two types of crop, just flowers with a regrow time. The only difficulty with multiple harvests would be that the crop won't grow the next harvest until the current produce is removed, which limits the window in which bees can create appropriate honey. But I'd drop the honey anyway and then there's no problem.

            I was thinking lavender oil would be a recipe when I read your post on reddit; otherwise, yeah, changing what the press produces would be tricky. Is real lavender oil usually lavender-infused oil or actually pressed from lavender?

            With SMAPI, you could completely replace the bee box and oil press, which I think would let you do everything. But then the mod would have to handle all of their existing functionality as well.
             
            • Voltaic123

              Voltaic123 Pangalactic Porcupine

              Another way to get around not being able to have them in one could be to make a plant version of lavender, and a flower version of lavender that looks exactly the same. Then you could have them be harvestable and produce honey, right?
               
              • guitardude_324

                guitardude_324 Big Damn Hero

                Wow, thank you so much for the help everyone. This is a great amount of information.

                I'm thinking I may start small, and work my way up. Do it the easiest way first, and then try pushing myself to make more complicated changes.

                -To start I'll try and complete re-skin of the Spangle as MysticTempest suggested. If that works and the Honey's description successfully changes, then that's great!!!
                I didn't even think of using crafting or cooking recipes, to make the soap, or oil. "Lavender+Oil" Equals Lavender Oil. It wouldn't be perfect (because the oil machine makes more sense), but that's only the start.
                -Adding a whole new crop will be the next step, and I'll already have the image file ready to add to the crop list PNG file.
                -The final step would be to research and get experience with SMAPI. I never thought you'd have to replace the oil maker, BUT knowing that you can make your own machine is exciting.

                In response to RabidCow's post. I was thinking of the harvesting and honey window. Knowing myself, I'd have multiple harvests staggered, so there should always be some fully grown lavender in bloom to influence the honey. It requires more micro managing, but I'm so late in the game, I could use something to keep me a little bit busier each day. Based on the farms I've been too/

                And the lavender oil extraction is pretty neat, I was at a farm and they would take their harvested lavender and throw it in a boiler. it created a water vapor and using a tube system they were able to extract both a watery lavender substance, and oil. Some really Breaking Bad stuff. It took several hours but was pretty cool to see.

                Maybe the final solution would be to make a boiler.
                 
                • rabidcow

                  rabidcow Scruffy Nerf-Herder

                  Interesting! So it's actually oil from the lavender.

                  Looking at it some more, I think the internationalization stuff is only a problem for honey if you're actually playing with a language other than English. And the only problem would be that it'd show up as the equivalent of "Wild Honey" in that language. (value will work fine) I suspect replacing Summer Spangle will have the same issue because it actually checks the name string.

                  So as long as you don't care about other languages, you're probably looking at code very similar to Casks Anywhere. The default Bee House behavior is about as good as you can hope for and the Oil Maker just needs to intercept trying to put stuff in, duplicate the existing functionality for that, plus lavender.
                   
                  • guitardude_324

                    guitardude_324 Big Damn Hero

                    Yeah it's very interesting, I didn't know about it either until I saw the process in action.

                    Here's a link to a few pictures that shows the end result, the oil and the water are put into the same jar, but obviously they http://blog.jerseylavender.co.uk/?p=327 This isn't the place I went to, I just googled this and this looks like a similar setup.

                    That's good news to hear about the possibility of honey working. I'm playing in English, so it's promising.

                    I'm just parsing through the crop.yaml right now and getting a feel for the the code. I've identified which line is the Spangle
                    455: "1 2 3 2/summer/29/593/-1/0/false/false/true 0 208 255 99 255 210 255 212 0 255 144 122 255 0 238 206 91 255" #!String

                    I'm going to fool around and play around with the values to make it regrow, harvest with scythe, in the meantime, I'm going to start drawing up the lavender plant to replace the spangle.
                     
                    • Amburr

                      Amburr Phantasmal Quasar

                      This is awesome!! I have been dreaming up adding herbs to the game for the past month! I would love to create various herbs for an herb garden, create some new recipes and add onto some existing ones, add in a copper distillation alembic to create various essential oils from said herbs, and possibly create some candles!! I can't wait to see what you come up with!!
                       
                      • guitardude_324

                        guitardude_324 Big Damn Hero

                        Just an update for now, I jumped into the the yaml file and fooled around with the values of the spangle. I was able to change the name of the spangle. So when I harvested the flower at full maturity, I had a "Lavender" in my hands. However, the seeds "Spangle Seeds" didn't successfully change to "Lavender Seeds" BUT in retrospect, I never bought the seeds, I just happened to have old spangle seeds in my chest (because it's an old save file) it may have been successfully changed, but I have to buy NEW seeds to see the effect take place.

                        As for the honey, It came up as "Wild Honey" unfortunately, so I will likely need to get into some SMAPI work to find a solution for that. I recall somebody telling me that this would happen after v1.2. More research is needed.

                        AS for values of the spangle, I was able to fool around with some of the figures and I had the crop fully grown, but the flower was invisible (because I altered the true/false value for whether or not the crop had random colors. I adjusted the flower to be harvested with a scythe. And it worked, but the flower became invisible after that. Something was still there though, because I couldn't plant anything in that spot again until I hit it with a pickaxe. This could either be a side effect of harvesting something with a scythe that wasn't intended to be harvested by a scythe.... OR..... I may have set the "Regrow" figure incorrectly cause the flower to appear invisible.


                        The PNGs are another story, I modified the seed packet to show a crude drawing of lavender, and I altered the color of the pack. I also overwrote the appearance of the spangle in the objectinformation.png. But the file kept failing to repack into an xnb file. Can't figure out why the png to xnb transfer won't work.
                         
                          HopeWasHere likes this.
                        • MysticTempest

                          MysticTempest Spaceman Spiff

                          Yea, if you buy new seeds they'll be fine. The game uses the data files when writing to your save. So, if you don't change those til afterwards; the savefile will still have the old data.


                          Did you harvest all the 'Lavender' before getting the honey from the hives? Bee houses will revert back to 'Wild Honey' if you harvest the flowers, before getting the Honey. The honey flavor is dependent on whether or not there's a flower in radius. For instance you could set your beehouses up first, have them make honey; which would be Wild Honey. But, if you let them sit, and plant a flower; when the flower is grown it'll automatically switch all the Honey in the bee houses nearby to the flower's honey.

                          I did a quick test the other day when you asked about it(both in the Beta v1.2 & v1.1 of the current non-beta), and the Lavender Honey worked fine for me(see Preview below). Double check what I mentioned above.


                          And, you're talking about the springobjects.png from the 'Maps' folder I mentioned in the other post. Make sure you're packing it with the springobjects.yaml that comes with it when you originally unpacked it.

                          Lavender Honey:

                          LavenderHoney.png
                           
                          • rabidcow

                            rabidcow Scruffy Nerf-Herder

                            This needs to be true to get themed honey. If you don't want random colors, give it only one option in the list.
                            Maybe it needs another frame in the art?
                             
                              MysticTempest likes this.
                            • guitardude_324

                              guitardude_324 Big Damn Hero

                              You guys are the best. Thank you for your help, I didn't have time to experiment the last few days, but you guys just saved me a bunch of that busy work. Good to know about the seeds, I should have bought some when I was trying it out.

                              As for the Honey, I did have the boxes one space away from the flowers and they were at full maturity for 2 days before the honey was produced.

                              The RANDOM COLOR value being set to false, is very interesting! I wouldn't have known that'd have an effect.

                              And the PNG issue with the YAML, is exactly what I missed. I've moved these files around so much between two computers and dropbox, I had completely forgotten that there was a YAML accompanying both PNG files (Crop.png and springobjects.png)

                              That information gave me a great boost in confidence.

                              Thank you.
                               
                                Amburr likes this.
                              • guitardude_324

                                guitardude_324 Big Damn Hero

                                Update:
                                Thanks to everyone's help, I've managed to get the objectinformation.yaml, springobjects.png, and crops.yaml changed and I have it working where I:
                                -Can buy seeds that are labelled: Lavender.
                                -The crop grows and looks the same as a spangle [I haven't drawn a new crop yet]
                                -When I harvest the spangle, my lavender is re-used the amaranth texture and recoloured. It looks great, but it feels like cheating cause I just ripped off the amaranth. I think the final look will look similar to harvested wheat.

                                Next Steps:
                                -Remove the Spangle texture that appears over-top of my harvested lavender. I'm hoping it will be as easy as deleting the blank placeholder for random colours on the springobjects.png.
                                -Experiment with the crop.yaml parameters to until I get the growth period just the way I like.


                                -I hit a snag when turning on - Regrow. When I harvest the flower, the whole thing goes invisible. But when I come back 2 days later (the growth time I dictated, a flower is there, BUT it's just the random spangle colour tile with the body appearing invisible.

                                I need to figure out why it's doing that. Maybe by taking a look at Ancient Fruit, Blueberries, or Strawberries, Maybe they all have something that the Spangle doesn't, but needs. See the bottom half of the picture I attached to see what it looks like when it's regrown. (I tried changing the growth seasons to spring summer fall. AND I removed the colour variations until there were three values RBG.
                                "2 3 3 1/spring summer fall/29/593/3/0/false/false/true 206 291 90" #!String
                                When I tried planting the seed, the game kept crashing. I restored the crops.yaml file back to the original, and the crashing stopped, so I must have when wrong somewhere editing the crop values.

                                -Draw a new crop texture to replace the Spangle body and growth stages.
                                 

                                  Attached Files:

                                  Last edited: Mar 3, 2017
                                  Acerbicon and MysticTempest like this.
                                • Voltaic123

                                  Voltaic123 Pangalactic Porcupine

                                  You could maybe ask Eemie, the author of this mod, If you could use her lavender sprite!
                                   
                                  • guitardude_324

                                    guitardude_324 Big Damn Hero

                                    Update on the crop tile. Upon looking at the crop tiles for the re-harvest(able) crops: Strawberry, Blueberry, etc. I can see that there is a tile that shows the crop post-harvest. So as an experiment I've added filled in the tile, and we'll see how it goes!


                                    I saw that mod and thought it all looked great! She did some really good work. I like that lavender, but the kind I'm used to seeing is a little more like below. Something a little more rounded. That's the kind my fiance and I have growing in our garden (smaller of course)
                                    [​IMG]
                                     
                                      Androxilogin and Amburr like this.

                                    Share This Page