Issue Issue with playing the game after editing text in dialogue and packing in xnb node?

Jessicaksch

Greenhorn
So I edited the dialogue for harvey, nothing fancy, just re-wrote what he said, and when I start the game I keep getting this error in the mods window, and can't skip the intro of the game. If anyone can help please do!:

[SMAPI] An error occured in the base update loop: Microsoft.Xna.Framework.Content.ContentLoadException: Error loading "Characters\Maru". File contains System.Collections.Generic.Dictionary`2[System.String,System.String] but trying to load as Microsoft.Xna.Framework.Graphics.Texture2D.
at Microsoft.Xna.Framework.Content.ContentReader.InvokeReader[T](ContentTypeReader reader, Object existingInstance)
at Microsoft.Xna.Framework.Content.ContentReader.ReadObjectInternal[T](Object existingInstance)
at Microsoft.Xna.Framework.Content.ContentReader.ReadObject[T]()
at Microsoft.Xna.Framework.Content.ContentReader.ReadAsset[T]()
at Microsoft.Xna.Framework.Content.ContentManager.ReadAsset[T](String assetName, Action`1 recordDisposableObject)
at Microsoft.Xna.Framework.Content.ContentManager.Load[T](String assetName)
at StardewValley.LocalizedContentManager.Load[T](String assetName)
at StardewModdingAPI.Framework.ContentCore.<>c__DisplayClass43_0`1.<LoadImpl>b__1() in C:\source\_Stardew\SMAPI\src\SMAPI\Framework\ContentCore.cs:line 600
at StardewModdingAPI.Framework.Utilities.ContextHash`1.Track[TResult](T key, Func`1 action) in C:\source\_Stardew\SMAPI\src\SMAPI\Framework\Utilities\ContextHash.cs:line 53
at StardewModdingAPI.Framework.ContentCore.<>c__DisplayClass43_0`1.<LoadImpl>b__0() in C:\source\_Stardew\SMAPI\src\SMAPI\Framework\ContentCore.cs:line 591
at StardewModdingAPI.Framework.ContentCore.WithWriteLock[T](Func`1 action) in C:\source\_Stardew\SMAPI\src\SMAPI\Framework\ContentCore.cs:line 874
at StardewModdingAPI.Framework.ContentCore.LoadImpl[T](String assetName, ContentManager instance) in C:\source\_Stardew\SMAPI\src\SMAPI\Framework\ContentCore.cs:line 561
at StardewModdingAPI.Framework.ContentCore.Load[T](String assetName, ContentManager instance) in C:\source\_Stardew\SMAPI\src\SMAPI\Framework\ContentCore.cs:line 227
at StardewModdingAPI.Framework.ContentManagerShim.Load[T](String assetName) in C:\source\_Stardew\SMAPI\src\SMAPI\Framework\ContentManagerShim.cs:line 49
at StardewValley.Game1.loadForNewGame(Boolean loadedGame)
at StardewValley.Menus.TitleMenu.createdNewCharacter(Boolean skipIntro)
at StardewValley.Menus.CharacterCustomization.optionButtonClick(String name)
at StardewValley.Menus.CharacterCustomization.receiveLeftClick(Int32 x, Int32 y, Boolean playSound)
at StardewValley.Menus.TitleMenu.receiveLeftClick(Int32 x, Int32 y, Boolean playSound)
at StardewValley.Game1.updateActiveMenu(GameTime gameTime)
at StardewValley.Game1.Update(GameTime gameTime)
at StardewModdingAPI.Framework.SGame.Update(GameTime gameTime) in C:\source\_Stardew\SMAPI\src\SMAPI\Framework\SGame.cs:line 594
 

Wingheart

Sodbuster
XNB replacement modding is like that, sorry - this is a major reason why modding has switched to SMAPI-loaded mods. Validate your game files via Steam to fix it (your saves and SMAPI mods will be fine) and then use Content Patcher to replace the dialogue instead. (You can find the documentation on PathosChild's github.)
 

Wingheart

Sodbuster
If you're replacing the entire dialogue it's simple. for Maru:
You use

"Changes": [
{
"Action": "Load",
"Target": "Characters/Dialogue/Maru",
"FromFile": "[whatever you named your dialogue json].json",
"Entries": null
},
]

(Plus a Content Patcher format thing at the top. Just...copy one from an existing content patcher pack.)
If there are any mistakes in your dialogue.json SMAPI will try to recover the game and tell you where the formatting error is.

If you're just changing a little bit you can use an EditData action instead. Those are a bit more complicated but more precise and increase mod compatibilty - only one mod can Load a file but an unlimited number of mods can Edit it.

You can ask for help in the Stardew Valley discord server, in the Making-Mods channel.
 

Jessicaksch

Greenhorn
So I created a manifest.json and content.json according to https://stardewvalleywiki.com/Modding:Content_Patcher and used your script, but seem to get this error:



[Content Patcher] Mod crashed when loading asset 'Characters\Dialogue\Harvey'. SMAPI will use the default asset instead. Error details:
StardewModdingAPI.Framework.Exceptions.SContentLoadException: The content manager failed loading content asset 'Harvey1.json' from SMAPI\jessicaksch.harveydialogue. ---> Newtonsoft.Json.JsonReaderException: Can't parse JSON file at C:\Program Files (x86)\Steam\steamapps\common\Stardew Valley\Mods\Harvey Dialogue\Harvey1.json. This doesn't seem to be valid JSON.
Technical details: Unexpected character encountered while parsing value: x. Path '', line 0, position 0.
at StardewModdingAPI.Toolkit.Serialization.JsonHelper.ReadJsonFileIfExists[TModel](String fullPath, TModel& result) in C:\source\_Stardew\SMAPI\src\SMAPI.Toolkit\Serialization\JsonHelper.cs:line 74
at StardewModdingAPI.Framework.ContentManagers.ModContentManager.Load[T](String assetName, LanguageCode language, Boolean useCache) in C:\source\_Stardew\SMAPI\src\SMAPI\Framework\ContentManagers\ModContentManager.cs:line 139
--- End of inner exception stack trace ---
at StardewModdingAPI.Framework.ContentManagers.ModContentManager.Load[T](String assetName, LanguageCode language, Boolean useCache) in C:\source\_Stardew\SMAPI\src\SMAPI\Framework\ContentManagers\ModContentManager.cs:line 185
at StardewModdingAPI.Framework.ModHelpers.ContentHelper.Load[T](String key, ContentSource source) in C:\source\_Stardew\SMAPI\src\SMAPI\Framework\ModHelpers\ContentHelper.cs:line 92
at StardewModdingAPI.Framework.ContentPack.LoadAsset[T](String key) in C:\source\_Stardew\SMAPI\src\SMAPI\Framework\ContentPack.cs:line 99
at ContentPatcher.Framework.ManagedContentPack.Load[T](String key) in C:\source\_Stardew\Mods.Pathoschild\ContentPatcher\Framework\ManagedContentPack.cs:line 51
at ContentPatcher.Framework.Patches.LoadPatch.Load[T](IAssetInfo asset) in C:\source\_Stardew\Mods.Pathoschild\ContentPatcher\Framework\Patches\LoadPatch.cs:line 40
at ContentPatcher.Framework.PatchManager.Load[T](IAssetInfo asset) in C:\source\_Stardew\Mods.Pathoschild\ContentPatcher\Framework\PatchManager.cs:line 143
at StardewModdingAPI.Framework.ContentManagers.GameContentManager.ApplyLoader[T](IAssetInfo info) in C:\source\_Stardew\SMAPI\src\SMAPI\Framework\ContentManagers\GameContentManager.cs:line 315



This is the Harvey1.json I added with my folder:

xnbData:
target: "w"
compressed: true
hiDef: true
readerData:
-
type: "Microsoft.Xna.Framework.Content.DictionaryReader`2[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"
version: 0

-
type: "Microsoft.Xna.Framework.Content.StringReader"
version: 0


numSharedResources: 0

content: #!Dictionary<String,String>
Introduction: "It's a pleasure to meet you. I'm Albert, the local doctor.#$e#I perform regular check-ups and medical procedures for all the residents of Pelican Town. It's rewarding work.#$e#I hope you'll find your own work equally rewarding, in time.$h" #!String
danceRejection: "Oh! I'm sorry... I, er... have plans to ask someone else.$s" #!String
divorced: "I... I can't look at you. Please spare me any more pain.$s" #!String
Mon: "We sell a few over-the-counter medicines at the clinic... feel free to stop by if you're feeling exhausted.#$b#I know that being a farmer is pretty tiring work... don't overdo it!" #!String
Mon2: "I was found as a *fallen* just like you... I understand the pain of not knowing the past.#$e#Just you start appreciating the kind people around you." #!String
Mon6: "Although I wanted to be a pilot for the company, I found I was a great doctor. Pelican Town welcomed me and I feel at home.#$e#It feels good to know that you're useful." #!String
Mon10: "Oh! Hello, @.$l#$e#Do you... have any medical questions?$l" #!String
Tue: "Feel free to stop by my office if you're ever feeling ill.#$e#I'll do my best to help.$h" #!String
Tue8: "Don't overwork yourself, @. Doctor's orders!#$e#Your health is important to me.$l" #!String
Wed4: "I'd like to get to know you better, @. Would you like to have dinner some time?" #!String
Wed6: "It's nice to have a friend in town.$h" #!String
Wed8: "You have a really healthy glow. That's good.$h" #!String
Wed: "Sometimes I wish I knew my past.How I became so intelligent...?#$e#But then I get distracted by other things." #!String
Thu8: "It's a lot of work, being a doctor. I don't eat as well as I should.$s#$e#If I didn't live alone I think it would be easier.$l" #!String
Thu: "I really love everything about watching planes,building models ... In one way I'm glad I left it as a hobby!#$e#I don't think medical surgery would have been a good alternative hobby." #!String
Fri: "It's a beautiful day, isn't it?#$e#I wish I had less work to do.$s" #!String
Fri4: "If you would like to spend time in my appartment, that's fine with me. I live above the clinic." #!String
Fri10: "Stop by my place if you ever need a confidential check-up.$l" #!String
Sat: "Can I do anything for you?#$e#Take care." #!String
Sat4: "Do you think you were a farmer in your past life? When I came to Utopia I wanted to fly planes, but then I realized how much I hated flying and heights.#$e#I've really grown to love being a doctor, though.$h" #!String
Sat8: "*Sigh*... I sometimes regret not pursuing becoming a pilot...#$e#But I feel more comfortable in a clinic-setting. It makes me sad really.$s#$e#But...you have been a great distraction.$l" #!String
Sun: "Maybe I should stop being a doctor and get on a plane and explore the world.#$e#But then, the heights..." #!String
Sun6: "Imagine having a patient's life completely in your hands, and failing to keep them alive... that's something that will haunt you forever.$s" #!String
event_george1: "Thanks, @.$h#$b#You see, George, I'm just trying to help you." #!String
event_george2: "*Sigh*$s#$b#Look, George. If you want to behave like this I'm going to have to tell your wife. I don't think she'll be happy." #!String
event_aerobics1: "Thank you, @. I appreciate that.$h" #!String
event_aerobics2: "*Sigh*... rude.$s" #!String
event_heart1: "Oh! Hospitals make you nervous, ey?#$b#Just try and relax. I'm here to help.$h" #!String
event_heart2: "Okay. That makes sense." #!String
event_heart3: "Um. Okay... If you say so.$s" #!String
event_grave1: "...You're right.#$b#...Thank you." #!String
event_grave2: "*sigh*$s" #!String
summer_Mon: "It's okay to get a moderate amount of sunlight. Just don't get burnt.#$e#Okay. Take care! Stay healthy." #!String
summer_Thu: "Exercise is important, but don't get too exhausted, or you might end up at my clinic!#$e#Make sure and listen to your body." #!String
summer_Fri: "People don't get sick much during the summer. That's nice, but it also means less business for me." #!String
fall_Fri: "Have you been going into the mines, @?#$e#It's a dangerous place. I recommend against it." #!String
fall_Sat: "When you eat certain foods you'll perform better.#$e#Eating a 'Farmer's Brunch' will give you the nutrition you need to water and harvest crops better!" #!String
winter_Wed: "It's flu season, so you'd better be extra careful.#$e#Make sure to wash your hands often." #!String
winter_Sun: "I hate to say this, but I do make a lot more money during flu season.#$e#I guess if people stopped getting sick, I'd be out of business.#$e#Don't get the wrong idea! I want people to be healthy... really!" #!String
 

Wingheart

Sodbuster
Yeah, that's not valid content.json code; you left the XNB formatting in! Remove all instances of #!String and all of "
xnbData:
target: "w"
compressed: true
hiDef: true
readerData:
-
type: "Microsoft.Xna.Framework.Content.DictionaryReader`2[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]"
version: 0

-
type: "Microsoft.Xna.Framework.Content.StringReader"
version: 0


numSharedResources: 0 " and "#!Dictionary<String,String> " since all of that is XNB formatting.
 
Top