Coding Help Question about modding spouse schedules

Cloav

Greenhorn
I am interested in making some slight adjustments to some npc schedules including a few spouse schedules. Specifically, I want to send certain spouses home to the farmhouse before their bedtime such that they resume usual farmhouse wandering and are available for normal interactions before bedtime. Is this possible using only json and the vanilla game? I have not been able to find an answer to this online partly because there doesn't seem to be a place online that simply lists the available json keywords with definitions. One frustrating conversation with AI indicated that I might be able to use the location name "FarmHouse" to send the spouse back to specific farmhouse coordinates at a certain time, but I'm not confident in this answer. What I've seen so far in the unpacked Content folder from the vanilla game seems to just have a couple lines for each marriageable npc only on days when they leave the farmhouse and they only return to the farmhouse to go straight to bed (does Haley really go to bed at 3:40pm on Mondays??!!). Maybe I've misunderstood the "bed" keyword...? The modding wiki is helpful as an overview, but doesn't seem to provide enough detail for a case like this...or maybe I'm overlooking it. Would anyone be able to clarify this situation for me, please?
TIA!
 

Lenora Rose

Farmer
It's strongly discouraged to try and rewrite the base game code directly, and this would be much safer as a Content Patcher pack. You need SMAPI for any modding, regardless, but Content Patcher and other Frameworks are usually the best way to mod, partly because that way if they don't work, you haven't just destroyed actual game code. They instead tell the system to load a replacement for the base code.

In any case, altering schedules for the vanilla NPCs don't have their own tutorial, but once you have a general idea how to create a Content Patcher Pack in general, you can look at code in a mod that does and adjust it to your own purposes. For post-marriage schedules, this is one such: https://www.nexusmods.com/stardewvalley/mods/22538 (though it looks like it does the opposite of what you're looking for, in that it sends the spouses away from the farm more often).

Note that schedules don't start with where the NPC warps in at the start of the day; that's determined separately. Schedules start with the first time they move (other than "wandering" inside the farmhouse, or going to the spouse patio on Saturday, both of which are coded somewhere completely apart from schedules). So they only have schedules for the days they leave.

The times listed in the code aren't the time they arrive at the destination, they're the time that they leave their current position to head for that destination. So, in the example with Haley, at 3:40 PM, Haley leaves wherever she was standing (if this was the spouse schedule, that would probably be visiting Emily at her old house), and starts walking back to the farm, where she should arrive at 5 ish. Since she officially doesn't go to bed until 10 pm, I'm not sure what happens between 5 pm and 10. Presumably wandering.

One trick to be aware of in the code is that spouses don't walk home across the farm, they warp into the farmhouse (generally from the bus stop map.) This is because coding anything that accounts for all the possible changes the average farmer makes to their farm is really hard.

This has some of the keyword explanations you're looking for: https://stardewvalleywiki.com/Modding:Schedule_data
 
Top