Lenora Rose
Farmer
So I'm trying to write a Content Patcher Patch to change NPCs' schedules. I'm using Pierre as my test case because his vanilla schedule is VERY bare bones. The base idea is that there's something he starts doing gradually in year one, which has become a regular habit in year 2. (Nothing bad, I promise, since I mean for several other NPCs to do similar things.).
This is the code I have, aside from the schedule itself - which is long and which isn't coming up with errors, and which I am confident I did right (partly thanks to Visual Studio flagging things for me that I did oops on in that part.) I THOUGHT this was how to indicate a schedule that changes over time, but apparently I was wrong.:
{
"Changes": [
{
"Action": "EditData",
"Target": "Characters/schedules/Pierre",
"Entries": {
"rain": "GOTO spring",
"Fri": "700 SeedShop 10 20 0/830 SeedShop 4 17 2/1700 Saloon 16 20 0/2250 SeedShop 24 4 1 pierre_sleep",
etc.
},
"When": {
"Year": "1"
},
{
"rain": "GOTO Mon",
"etc
},
"When": {
"Year": "2"
}
}
]
}
Error log, if it helps, though I suspect someone whose coding experience isn't watching some tutorial videos and doing some C&P from better modders' code will be able to ID the problem from my base code. I guarantee it's a newbie error that makes me look dumb, but I'd rather look a fool and know what I *should* do and not just flail alone with my dignity intact. :)
Error loading patch 'StraySchedulesPierre > Include assets/Pierre/Schedules.json': an error occurred. StardewModdingAPI.Framework.Exceptions.SContentLoadException: Failed loading asset 'assets/Pierre/Schedules.json' from SMAPI\lenorarose.strayschedulespierre: an unexpected error occurred. ---> Newtonsoft.Json.JsonReaderException: Can't parse JSON file at C:\Program Files (x86)\Steam\steamapps\common\Stardew Valley\Mods\[CP] Stray Schedules\assets\Pierre\Schedules.json. This doesn't seem to be valid JSON. Technical details: Invalid property identifier character: {. Path 'Changes[0].When', line 21, position 6. at StardewModdingAPI.Toolkit.Serialization.JsonHelper.ReadJsonFileIfExists[TModel](String fullPath, TModel& result) in E:\source\_Stardew\SMAPI\src\SMAPI.Toolkit\Serialization\JsonHelper.cs:line 80 at StardewModdingAPI.Framework.ContentManagers.ModContentManager.LoadDataFile[T](IAssetName assetName, FileInfo file) in E:\source\_Stardew\SMAPI\src\SMAPI\Framework\ContentManagers\ModContentManager.cs:line 193 at StardewModdingAPI.Framework.ContentManagers.ModContentManager.LoadExact[T](IAssetName assetName, Boolean useCache) in E:\source\_Stardew\SMAPI\src\SMAPI\Framework\ContentManagers\ModContentManager.cs:line 134 --- End of inner exception stack trace --- at StardewModdingAPI.Framework.ContentManagers.ModContentManager.LoadExact[T](IAssetName assetName, Boolean useCache) in E:\source\_Stardew\SMAPI\src\SMAPI\Framework\ContentManagers\ModContentManager.cs:line 146 at StardewModdingAPI.Framework.ModHelpers.ModContentHelper.Load[T](String relativePath) in E:\source\_Stardew\SMAPI\src\SMAPI\Framework\ModHelpers\ModContentHelper.cs:line 57 at ContentPatcher.Framework.Patches.IncludePatch.UpdateContext(IContext context) in E:\source\_Stardew\Mods.Pathoschild\ContentPatcher\Framework\Patches\IncludePatch.cs:line 105.
This is the code I have, aside from the schedule itself - which is long and which isn't coming up with errors, and which I am confident I did right (partly thanks to Visual Studio flagging things for me that I did oops on in that part.) I THOUGHT this was how to indicate a schedule that changes over time, but apparently I was wrong.:
{
"Changes": [
{
"Action": "EditData",
"Target": "Characters/schedules/Pierre",
"Entries": {
"rain": "GOTO spring",
"Fri": "700 SeedShop 10 20 0/830 SeedShop 4 17 2/1700 Saloon 16 20 0/2250 SeedShop 24 4 1 pierre_sleep",
etc.
},
"When": {
"Year": "1"
},
{
"rain": "GOTO Mon",
"etc
},
"When": {
"Year": "2"
}
}
]
}
Error log, if it helps, though I suspect someone whose coding experience isn't watching some tutorial videos and doing some C&P from better modders' code will be able to ID the problem from my base code. I guarantee it's a newbie error that makes me look dumb, but I'd rather look a fool and know what I *should* do and not just flail alone with my dignity intact. :)
Error loading patch 'StraySchedulesPierre > Include assets/Pierre/Schedules.json': an error occurred. StardewModdingAPI.Framework.Exceptions.SContentLoadException: Failed loading asset 'assets/Pierre/Schedules.json' from SMAPI\lenorarose.strayschedulespierre: an unexpected error occurred. ---> Newtonsoft.Json.JsonReaderException: Can't parse JSON file at C:\Program Files (x86)\Steam\steamapps\common\Stardew Valley\Mods\[CP] Stray Schedules\assets\Pierre\Schedules.json. This doesn't seem to be valid JSON. Technical details: Invalid property identifier character: {. Path 'Changes[0].When', line 21, position 6. at StardewModdingAPI.Toolkit.Serialization.JsonHelper.ReadJsonFileIfExists[TModel](String fullPath, TModel& result) in E:\source\_Stardew\SMAPI\src\SMAPI.Toolkit\Serialization\JsonHelper.cs:line 80 at StardewModdingAPI.Framework.ContentManagers.ModContentManager.LoadDataFile[T](IAssetName assetName, FileInfo file) in E:\source\_Stardew\SMAPI\src\SMAPI\Framework\ContentManagers\ModContentManager.cs:line 193 at StardewModdingAPI.Framework.ContentManagers.ModContentManager.LoadExact[T](IAssetName assetName, Boolean useCache) in E:\source\_Stardew\SMAPI\src\SMAPI\Framework\ContentManagers\ModContentManager.cs:line 134 --- End of inner exception stack trace --- at StardewModdingAPI.Framework.ContentManagers.ModContentManager.LoadExact[T](IAssetName assetName, Boolean useCache) in E:\source\_Stardew\SMAPI\src\SMAPI\Framework\ContentManagers\ModContentManager.cs:line 146 at StardewModdingAPI.Framework.ModHelpers.ModContentHelper.Load[T](String relativePath) in E:\source\_Stardew\SMAPI\src\SMAPI\Framework\ModHelpers\ModContentHelper.cs:line 57 at ContentPatcher.Framework.Patches.IncludePatch.UpdateContext(IContext context) in E:\source\_Stardew\Mods.Pathoschild\ContentPatcher\Framework\Patches\IncludePatch.cs:line 105.