Tool SMAPI: Stardew Modding API

Discussion in 'Mods' started by ClxS, Mar 6, 2016.

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

    Pathoschild Tiy's Beard

    fengfeng1992 and mystery406 like this.
  2. fengfeng1992

    fengfeng1992 Void-Bound Voyager

  3. pistony

    pistony Tentacle Wrangler

  4. SterlingLuster

    SterlingLuster Void-Bound Voyager

    Okay, so forgive me if this upsets anyone, but is this really worth it? Does it only use mods made for SMAPI or can I use some of my mods that were made pre-SMAPI? Because I've been perfectly happy manually replacing files, "XMB" is what I've been using I think. If I can't use them, or have to install a bunch of other programs to use them, I'd like to know.
     
      Last edited: Feb 21, 2017
    • Frodita1987

      Frodita1987 Big Damn Hero

      @Pathoschild Is this new version of SMAPI compatible with CJB Cheats Menu? Thx!!!
      Edit: Ok isn´t! xD
       
        Last edited: Feb 21, 2017
      • Pathoschild

        Pathoschild Tiy's Beard

        You can use XNB and SMAPI mods together. XNB mods replace the game's data & image files (which have an .xnb extension, thus the name), and SMAPI mods run code within the game.

        Here's a comparison:
        • XNB mods:
          • Easy to create — no programming experience needed.
          • ✘ Difficult to use — need to replace game files, keep track of which files were changed, and keep backups to uninstall them. When something goes wrong, it can be difficult to figure out which one is a problem. Using an XNB mod manager can mitigate this.
          • ✘ Limited — many mods (like Lookup Anything) aren't possible with just XNB edits.
          • ✘ Easily conflict — two XNB mods can't edit the same file.
          • ✘ Difficult to maintain — XNB mods need to be updated by the mod author every time the original file changes, so they're often outdated. Outdated XNB mods cause weird and subtle bugs.
        • SMAPI mods:
          • Easy to use — just drop it into your Mods folder to install, and remove it to uninstall.
          • ✓ Powerful — SMAPI mods can do much more than XNB mods.
          • ✓ Rarely conflict — because SMAPI uses an event-driven model, you can typically use mods without worrying about conflicts even if they change the same parts of the game.
          • ✓ Easy to maintain — SMAPI mods often don't need to be updated when the game changes, and SMAPI even rewrites mods automatically for compatibility in some cases. When they do need updates, the changes needed are often simple and clear.
          • Harder to create — you need some programming knowledge to create a SMAPI mod, and you sometimes need to work around the game to change things.
        Not yet; it'll be updated soon. :)
         
          fengfeng1992 likes this.
        • askylum

          askylum Scruffy Nerf-Herder

          Does anyone know where I can find a list of the item IDs? There was a thread that had them all in a Dropbox but it looks like the Dropbox content is missing now and I can't find them elsewhere.
           
          • Pathoschild

            Pathoschild Tiy's Beard

            @askylum When SMAPI is running, you can enter commands in the console window to search or list item IDs:
            upload_2017-2-21_15-41-7.png

            This always shows the latest game data. Lists you find online may not be updated for recent game changes (e.g. coffee beans added in Stardew Valley 1.1).
             
              Last edited: Feb 21, 2017
            • Kriogenic

              Kriogenic Intergalactic Tourist

              Hey there @Pathoschild , love the work done on this keep it up.

              I am writing a custom NPC mod and I keep getting an error when I try to test it out. It has something to do with the xmlserializer. I have tried a few things to get it working and was hoping you could give me a hand. The error I am getting is this
              So I tried this to the top of my main class which inherits Mod
              Code:
              [XmlInclude(typeof(CustomNPCInteract))]
                  [Serializable]
                  public class CustomNPC : Mod
              I then also added this to the top of my class which inherits NPC
              Code:
              [Serializable]
                public class CustomNPCInteract : NPC
              If I add the following to the Entry method it works fine, however this causes conflict with any other mod which uses the same method to solve the issue (its long so I put it in spoiler tags)

              Code:
                          SaveGame.serializer = new XmlSerializer(typeof(SaveGame), new Type[28]
                    {
                            typeof (Tool),
                            typeof (GameLocation),
                            typeof (Crow),
                            typeof (Duggy),
                            typeof (Bug),
                            typeof (BigSlime),
                            typeof (Fireball),
                            typeof (Ghost),
                            typeof (Child),
                            typeof (Pet),
                            typeof (Dog),
                            typeof (Cat),
                            typeof (Horse),
                            typeof (GreenSlime),
                            typeof (LavaCrab),
                            typeof (RockCrab),
                            typeof (ShadowGuy),
                            typeof (SkeletonMage),
                            typeof (SquidKid),
                            typeof (Grub),
                            typeof (Fly),
                            typeof (DustSpirit),
                            typeof (Quest),
                            typeof (MetalHead),
                            typeof (ShadowGirl),
                            typeof (Monster),
                            typeof (TerrainFeature),
                            typeof (CustomNPCInteract)
                    });
                          SaveGame.locationSerializer = new XmlSerializer(typeof(GameLocation), new Type[27]
                          {
                            typeof (Tool),
                            typeof (Crow),
                            typeof (Duggy),
                            typeof (Fireball),
                            typeof (Ghost),
                            typeof (GreenSlime),
                            typeof (LavaCrab),
                            typeof (RockCrab),
                            typeof (ShadowGuy),
                            typeof (SkeletonWarrior),
                            typeof (Child),
                            typeof (Pet),
                            typeof (Dog),
                            typeof (Cat),
                            typeof (Horse),
                            typeof (SquidKid),
                            typeof (Grub),
                            typeof (Fly),
                            typeof (DustSpirit),
                            typeof (Bug),
                            typeof (BigSlime),
                            typeof (BreakableContainer),
                            typeof (MetalHead),
                            typeof (ShadowGirl),
                            typeof (Monster),
                            typeof (TerrainFeature),
                            typeof (CustomNPCInteract)
                          });


              I would really appreciate any help you can give me, I am knowledgeable about C# but not so much data serialization and such

              Thanks,
              Kriogenic.
               
                Last edited: Feb 22, 2017
              • BLCheung

                BLCheung Yeah, You!

                upload_2017-2-22_20-37-7.png after update the game, it can't work now...
                 
                • KATIEINALLCAPS

                  KATIEINALLCAPS Orbital Explorer

                  So, I recently tried using Eemiestardew's Medieval Building's and they work in vanilla but not when trying to load mods. Is there something I'm missing or doing wrong? All the other texture replacements have worked, just not buildings it seems. Any insights? :)
                   
                  • Pathoschild

                    Pathoschild Tiy's Beard

                  • fourze

                    fourze Space Hobo

                  • Pathoschild

                    Pathoschild Tiy's Beard

                    Note: SMAPI is not compatible with the latest Stardew Valley 1.2.9 beta. I'll release an updated version later today.
                     
                      user1413, alexer91 and mystery406 like this.
                    • Pathoschild

                      Pathoschild Tiy's Beard

                      Hi @Kriogenic. You should avoid adding custom objects to the save file; besides the problems you mentioned, it also means the players' saves can no longer be loaded without your mod installed. A common solution is to remove your custom objects on SaveEvents.BeforeSave (possibly replacing them with placeholder objects if needed), then put them back on SaveEvents.AfterSave and SaveEvents.AfterLoad.
                       
                      • Pathoschild

                        Pathoschild Tiy's Beard

                        SMAPI 1.9-beta.8 is now available for Linux, Mac, and Windows!

                        This release mainly...
                        • fixes compatibility with the latest Stardew Valley 1.2.9 beta;
                        • fixes an error when submitting an empty command through the console.
                        Caveats:
                        • This is for Stardew Valley 1.2.9+ beta only; it won't work with earlier versions.
                        • Some mods will still need an update, though SMAPI will automatically fix many of them.
                        This is a release candidate. If you see errors (not counting "Skipped <mod name> because it isn't compatible with the latest version of the game" errors), post your error log! :)

                        [Edit: download removed; see the latest version instead.]
                         
                          Last edited: Feb 24, 2017
                          CN_BigMiaoGod and user1413 like this.
                        • sumisommer1993

                          sumisommer1993 Space Hobo

                        • Pathoschild

                          Pathoschild Tiy's Beard

                          @sumisommer1993: CJB Cheats Menu will be updated soon after Stardew Valley 1.2 is officially released; it's not compatible with the beta version of the game yet.
                           
                            user1413 likes this.
                          • fengfeng1992

                            fengfeng1992 Void-Bound Voyager

                          • pistony

                            pistony Tentacle Wrangler

                          Thread Status:
                          Not open for further replies.

                          Share This Page