Changes

→‎Schedule points: Document special behavior of "bed" schedule location point.
Line 4: Line 4:     
==Raw data==
 
==Raw data==
Schedule data is stored in <tt>Content/Characters/schedules/*.xnb</tt> files (one per character), which can be [[Modding:Editing XNB files#Getting started|unpacked for editing]]. Here's the raw data for Abigail as of {{version|1.4.5}} for reference:
+
Schedule data is stored in <samp>Content/Characters/schedules/*.xnb</samp> files (one per character), which can be [[Modding:Editing XNB files#unpacking|unpacked for editing]]. Here's the raw data for Abigail as of {{version|1.5.1}} for reference:
   −
{{collapse|Data|content=<source lang="json">
+
{{collapse|Data|content=<syntaxhighlight lang="json">
 
{
 
{
 
   "rain": "900 SeedShop 9 5 0/1100 SeedShop 13 20 0/1300 SeedShop 39 5 0/1500 SeedShop 7 9 2/1900 SeedShop 6 4 0/2200 SeedShop 1 9 3 abigail_sleep",
 
   "rain": "900 SeedShop 9 5 0/1100 SeedShop 13 20 0/1300 SeedShop 39 5 0/1500 SeedShop 7 9 2/1900 SeedShop 6 4 0/2200 SeedShop 1 9 3 abigail_sleep",
Line 29: Line 29:  
   "spring": "900 SeedShop 39 5 0/1030 SeedShop 2 20 3/1300 Town 73 54 2/1630 SeedShop 3 6 0 abigail_videogames/1930 SeedShop 1 9 3 abigail_sleep"
 
   "spring": "900 SeedShop 39 5 0/1030 SeedShop 2 20 3/1300 Town 73 54 2/1630 SeedShop 3 6 0 abigail_videogames/1930 SeedShop 1 9 3 abigail_sleep"
 
}
 
}
</source>}}
+
</syntaxhighlight>}}
    
==Schedule key==
 
==Schedule key==
Line 35: Line 35:     
Notes:
 
Notes:
* Most text is case-sensitive (e.g. <tt>Mon</tt> is not the same as <tt>mon</tt>).
+
* Most text is case-sensitive (''e.g.,'' <samp>Mon</samp> is not the same as <samp>mon</samp>).
* The game's logic for schedule keys is in <tt>NPC::getSchedule</tt>.
+
* The game's logic for schedule keys is in <samp>NPC::getSchedule</samp>.
    
===Marriage schedules===
 
===Marriage schedules===
Line 46: Line 46:  
! summary
 
! summary
 
|-
 
|-
| <tt>marriageJob</tt>
+
| <samp>marriage_{{t|season}}_{{t|day of month}}</samp>
 +
| Applies on the given date.<br /><small>Example: <samp>marriage_spring_26</samp></small>
 +
|-
 +
| <samp>marriageJob</samp>
 
| Used by Harvey on Tuesday/Thursday, Maru on Tuesday/Thursday, Penny on Tuesday/Wednesday/Friday.
 
| Used by Harvey on Tuesday/Thursday, Maru on Tuesday/Thursday, Penny on Tuesday/Wednesday/Friday.
 
|-
 
|-
| <tt>marriage_{{t|day of week}}</tt>
+
| <samp>marriage_{{t|day of week}}</samp>
| Applies on the given day of week when not raining.<br /><small>Example: <tt>marriage_Mon</tt></small>
+
| Applies on the given day of week when not raining.<br /><small>Example: <samp>marriage_Mon</samp></small>
 
|}
 
|}
   Line 61: Line 64:  
! summary
 
! summary
 
|-
 
|-
| <tt>{{t|season}}_{{t|day of month}}</tt>
+
| <samp>{{t|season}}_{{t|day of month}}</samp>
| Applies on the given date.<br /><small>Example: <tt>spring_15</tt></small>
+
| Applies on the given date.<br /><small>Example: <samp>spring_15</samp></small>
 
|-
 
|-
| <tt>{{t|day of month}}_{{t|hearts}}</tt>
+
| <samp>{{t|day of month}}_{{t|hearts}}</samp>
| Applies on the given day of month if ''any'' player has at least that many [[friendship|hearts]] with the NPC. If multiple schedules apply, the one with the highest heart number is used.<br /><small>Example: <tt>11_6</tt></small>
+
| Applies on the given day of month if ''any'' player has at least that many [[friendship|hearts]] with the NPC. If multiple schedules apply, the one with the highest heart number is used.<br /><small>Example: <samp>11_6</samp></small>
 
|-
 
|-
| <tt>{{t|day of month}}</tt>
+
| <samp>{{t|day of month}}</samp>
| Applies on the given day of month.<br /><small>Example: <tt>16</tt></small>
+
| Applies on the given day of month.<br /><small>Example: <samp>16</samp></small>
 
|-
 
|-
| <tt>bus</tt>
+
| <samp>bus</samp>
 
| For [[Pam]] only, applies if the bus is repaired.
 
| For [[Pam]] only, applies if the bus is repaired.
 
|-
 
|-
| <tt>rain2</tt>
+
| <samp>rain2</samp>
 
| 50% chance of applying on rainy days.
 
| 50% chance of applying on rainy days.
 
|-
 
|-
| <tt>rain</tt>
+
| <samp>rain</samp>
 
| Applies on rainy days.
 
| Applies on rainy days.
 
|-
 
|-
| <tt>{{t|season}}_{{t|day of week}}_{{t|hearts}}</tt>
+
| <samp>{{t|season}}_{{t|day of week}}_{{t|hearts}}</samp>
| Applies in the given season and day of week, if ''any'' player has at least that many [[friendship|hearts]] with the NPC. If multiple schedules apply, the one with the highest heart number is used.<br /><small>Example: <tt>spring_Mon_6</tt></small>
+
| Applies in the given season and day of week, if ''any'' player has at least that many [[friendship|hearts]] with the NPC. If multiple schedules apply, the one with the highest heart number is used.<br /><small>Example: <samp>spring_Mon_6</samp></small>
 
|-
 
|-
| <tt>{{t|season}}_{{t|day of week}}</tt>
+
| <samp>{{t|season}}_{{t|day of week}}</samp>
| Applies in the given season and day of week.<br /><small>Example: <tt>spring_Mon</tt></small>
+
| Applies in the given season and day of week.<br /><small>Example: <samp>spring_Mon</samp></small>
 
|-
 
|-
| <tt>{{t|day of week}}</tt>
+
| <samp>{{t|day of week}}</samp>
| Applies in the given day of week.<br /><small>Example: <tt>Mon</tt></small>
+
| Applies in the given day of week.<br /><small>Example: <samp>Mon</samp></small>
 
|-
 
|-
| <tt>{{t|season}}</tt>
+
| <samp>{{t|season}}</samp>
| Applies in the given season.<br /><small>Example: <tt>spring</tt></small>
+
| Applies in the given season.<br /><small>Example: <samp>spring</samp></small>
 
|-
 
|-
| <tt>spring_{{t|day of week}}</tt>
+
| <samp>spring_{{t|day of week}}</samp>
| Applies (in any season) on the given day of week.<br /><small>Example: <tt>spring_Mon</tt></small>
+
| Applies (in any season) on the given day of week.<br /><small>Example: <samp>spring_Mon</samp></small>
 
|-
 
|-
| <tt>{{t|season}}_spring_{{t|hearts}}</tt>
+
| <samp>spring</samp>
| Applies in the given season, if ''any'' player has at least that many [[friendship|hearts]] with the NPC. If multiple schedules apply, the one with the highest heart number is used.<br /><small>Example: <tt>spring_Mon_6</tt></small>
+
| Always applies. This schedule is also used as a default in some cases. DO NOT REMOVE THIS ENTRY. THAT WILL BREAK THE GAME.
 
|-
 
|-
| <tt>spring</tt>
+
| <samp>default</samp>
| Always applies.
+
| Also used as a default sometimes. It's okay for this one to not exist, spring will be used instead.
 
|}
 
|}
   Line 105: Line 108:     
===Initial commands===
 
===Initial commands===
A script may have one initial command as the first field in the script, before the first <tt>/</tt> character. The <tt>GOTO</tt> command can also appear in the next two fields after <tt>MAIL</tt>, or the next field after <tt>NOT</tt>.
+
A script may have one initial command as the first field in the script, before the first <samp>/</samp> character. The <samp>GOTO</samp> command can also appear in the next two fields after <samp>MAIL</samp>, or the next field after <samp>NOT</samp>.
    
{| class="wikitable"
 
{| class="wikitable"
Line 112: Line 115:  
! description
 
! description
 
|-
 
|-
| <tt>GOTO {{t|key}}</tt>
+
| <samp>GOTO {{t|key}}</samp>
| (Note: this line only applies if <tt>GOTO</tt> is the first command. If it's not, see <tt>GOTO</tt> below.)<br />End the current script and load the schedule with the given key instead. If the key is "season", the current season name is used instead. If the schedule doesn't exist or can't be parsed, the <tt>spring</tt> schedule will be used instead.<br /><small>Example: <tt>GOTO spring</tt></small>
+
| (Note: this line only applies if <samp>GOTO</samp> is the first command. If it's not, see <samp>GOTO</samp> below.)<br />End the current script and load the schedule with the given key instead. The key does not need to be one of the standard keys and can be any arbitrary string. If the key is "season", the current season name is used instead. If the schedule doesn't exist or can't be parsed, the <samp>spring</samp> schedule will be used instead.<br /><small>Example: <samp>GOTO spring</samp></small>
 
|-
 
|-
| <tt>NOT friendship {{t|npc name}} {{t|hearts}}</tt>
+
| <samp>NOT friendship {{t|npc name}} {{t|hearts}}</samp>
| End the current script if ''any'' player ''does'' have at least that many [[friendship|hearts]] with any of the named NPCs (can list multiple). If the script is ended, the <tt>spring</tt> schedule is used instead.<br /><small>Example: <tt>NOT friendship Sebastian 6 Abigail 3</tt> (script ends if any player has 6+ hearts with Sebastian and/or 3+ hearts with Abigail).</small>
+
| End the current script if ''any'' player ''does'' have at least that many [[friendship|hearts]] with any of the named NPCs (can list multiple). If the script is ended, the <samp>spring</samp> schedule is used instead.<br /><small>Example: <samp>NOT friendship Sebastian 6 Abigail 3</samp> (script ends if any player has 6+ hearts with Sebastian and/or 3+ hearts with Abigail).</small>
 
|-
 
|-
| <tt>NOT</tt>
+
| <samp>NOT</samp>
| Does nothing if the next word is not <tt>friendship</tt>.
+
| Command ignored if the next word is not <samp>friendship</samp>.
 
|-
 
|-
| <tt>MAIL {{t|letter ID}}</tt>
+
| <samp>MAIL {{t|letter ID}}</samp>
| Runs the next command if the player did ''not'' receive the given letter ID or world state ID (see <tt>HasFlag</tt> in the [https://github.com/Pathoschild/StardewMods/tree/develop/ContentPatcher Content Patcher documentation]). May<br /><small>Example: <tt>MAIL ccVault/GOTO spring/GOTO summer</tt> (runs <tt>GOTO spring</tt> if the bus is repaired, or <tt>GOTO summer</tt> if it isn't; not limited to <tt>GOTO</tt> commands).</small>
+
| Runs the next command if the player did ''not'' receive the given letter ID or world state ID (see <samp>HasFlag</samp> in the [https://github.com/Pathoschild/StardewMods/tree/develop/ContentPatcher Content Patcher documentation]); else continues from the command after that.<br /><small>Example: <samp>MAIL ccVault/GOTO spring/GOTO summer</samp> (runs <samp>GOTO summer</samp> if the bus is repaired, or <samp>GOTO spring</samp> if it isn't; not limited to <samp>GOTO</samp> commands).</small>
 
|-
 
|-
| <tt>GOTO {{t|key}}</tt>
+
| <samp>GOTO {{t|key}}</samp>
| (Note: this line only applies if <tt>GOTO</tt> is after <tt>NOT</tt> or <tt>MAIL</tt>. If it's not, see <tt>GOTO</tt> above.)<br />End the current script and load the schedule with the given key instead. If the key is "season", the current season name is used instead. If the key is "NO_SCHEDULE", the NPC has no schedule for the day. If the schedule doesn't exist or can't be parsed, the game crashes (or shows an error if playing with SMAPI).<br /><small>Example: <tt>GOTO NO_SCHEDULE</tt></small>
+
| (Note: this line only applies if <samp>GOTO</samp> is after <samp>NOT</samp> or <samp>MAIL</samp>. If it's not, see <samp>GOTO</samp> above.)<br />End the current script and load the schedule with the given key instead. If the key is "season", the current season name is used instead. If the key is "NO_SCHEDULE", the NPC has no schedule for the day. If the schedule doesn't exist or can't be parsed, the game crashes (or shows an error if playing with SMAPI).<br /><small>Example: <samp>GOTO NO_SCHEDULE</samp></small>
 
|}
 
|}
    
===Schedule points===
 
===Schedule points===
 
The rest of the schedule script consists of slash-delimited entries, each containing space-separated fields which specify a start time, destination, and what to do when the NPC reaches it:
 
The rest of the schedule script consists of slash-delimited entries, each containing space-separated fields which specify a start time, destination, and what to do when the NPC reaches it:
: <tt>{{t|time}} {{o|location}} {{t|tileX}} {{t|tileY}} {{o|facingDirection}} {{o|animation}} {{o|dialogue}}</tt>
+
: <samp>{{t|time}} {{o|location}} {{t|tileX}} {{t|tileY}} {{o|facingDirection}} {{o|animation}} {{o|dialogue}}</samp>
   −
If the <tt>location</tt> field is omitted, the rest of the fields are parsed as normal. The other optional fields must be in sequential order (e.g. you can skip <tt>dialogue</tt>, but you can't skip <tt>animation</tt> and then specify <tt>dialogue</tt>).
+
If the <samp>location</samp> field is omitted, the rest of the fields are parsed as normal. The other optional fields must be in sequential order (''e.g.,'' you can skip <samp>animation</samp> and <samp>dialogue</samp>, but you can't skip <samp>facingDirection</samp> and then specify <samp>animation</samp> and <samp>dialogue</samp>). The exception is <samp>dialogue</samp>. The <samp>dialogue</samp> can be specified without the <samp>animation</samp>.
    
{| class="wikitable"
 
{| class="wikitable"
Line 139: Line 142:  
! description
 
! description
 
|-
 
|-
| <tt>time</tt>
+
| <samp>time</samp>
| The time at which the schedule event begins, in military time (24 hour format, no colon).
+
| The time at which the schedule event begins, in military time (24 hour format, no colon). The time may be preceded with the single character '<samp>a</samp>' to indicate that the event should end (that is, the NPC should arrive at the destination) at the given time. In this case, the game will calculate when the event needs to begin. However, the event will never begin before the time specified for the previous event.
 +
 
 +
In the unmodified game, this is only used to synchronise Emily's and Sandy's schedules on Fall 15.
 
|-
 
|-
| <tt>location</tt>
+
| <samp>location</samp>
| <p>''(optional)'' The location name the NPC should walk towards. If omitted, defaults to the [[Bus Stop|bus stop]] (if married to a player) or their default location.</p><p>'''Note:''' the game has special logic for unlockable locations. If this is JojaMart/Railroad and it's not available yet, the game gets the replacement destination from the first entry in the <tt>{{t|location}}_Replacement</tt> schedule if available; otherwise it switches to the <tt>default</tt> schedule if available, else <tt>spring</tt>. If this is CommunityCenter and it's not available yet, the game switches to the <tt>default</tt> schedule if available, else <tt>spring</tt>.</p>
+
| <p>''(optional)'' The location name the NPC should walk towards. If omitted, defaults to the previous map, or if it's the first, it defaults to the [[Bus Stop|bus stop]] (if married to a player) or their default location.</p><p>'''Note:''' the game has special logic for unlockable locations. If this is JojaMart/Railroad and it's not available yet, the game gets the replacement destination from the first entry in the <samp>{{t|location}}_Replacement</samp> schedule if available; otherwise it switches to the <samp>default</samp> schedule if available, else <samp>spring</samp>. If this is CommunityCenter and it's not available yet, the game switches to the <samp>default</samp> schedule if available, else <samp>spring</samp>.</p><p>'''Note also:''' if the location is <code>bed</code>, the game will ignore the remaining parameters from this schedule point and attempt to load a "home" destination (map and coordinates): the warp out of <code>BusStop</code> back to the <code>Farm</code> for married NPCs, or for unmarried ones, the last schedule entry from the <code>default</code> or <code>spring</code> schedule (or the NPC's default location, if neither schedule can be loaded or parsed correctly). The NPC's [[Modding:NPC_data#Sleep_animation|sleeping animation]] (<code>&lt;lowercase name&gt;_sleep</code>) from <code>Data/animationDescriptions</code> will be set to play on arrival if it is defined.</p>
 
|-
 
|-
| <tt>tileX</tt><br /><tt>tileY</tt>
+
| <samp>tileX</samp><br /><samp>tileY</samp>
 
| The X and Y [[Modding:Modder Guide/Game Fundamentals#Tiles|tile coordinates]] the NPC should walk towards.
 
| The X and Y [[Modding:Modder Guide/Game Fundamentals#Tiles|tile coordinates]] the NPC should walk towards.
 
|-
 
|-
| <tt>facingDirection</tt>
+
| <samp>facingDirection</samp>
 
| ''(optional)'' The direction to face after reaching the destination. The possible values are 0 (up), 1 (right), 2 (down), and 3 (left). Defaults to down.
 
| ''(optional)'' The direction to face after reaching the destination. The possible values are 0 (up), 1 (right), 2 (down), and 3 (left). Defaults to down.
 
|-
 
|-
| <tt>animation</tt>
+
| <samp>animation</samp>
| ''(optional)'' The animation to play when the NPC reaches the destination.
+
| ''(optional)'' The animation to play when the NPC reaches the destination. This must be a key that appears in the <samp>Content/Data/animationDescriptions.xnb</samp> file. Each key entry has three required parts: entry frames/repeat frames/leaving frames. The numbers on them refer to the [[Modding:NPC data#Overworld sprites|overworld sprite frame]]. The entry frames will play after arriving at the schedule point. Then the repeat frames will loop until the end of schedule time. Finally, the leaving frames will play before moving on to the next schedule point. Note that each frame is around 120ms so duplicates of frame is used to get desired looking animation. <br /><br /> The full format is <samp>entry frames/repeat frames/leaving frames/message key/offset X Y/laying_down</samp>. If a message key is given, the NPC will repeat that message if you talk to them while they are performing the animation. (TODO: this is likely a "busy chat", which has fewer heart points, crosscheck.) <samp>offset X Y</samp> lets you offset their sprite (in pixels). <samp>laying_down</samp> will hide the shadow. If you want to use offset or laying_down without a message, leave that spot empty. Example: offset/laying down without message: <samp>"haley_beach_towel": "20 20 21 21 21 21 21/22/21 21 20//laying_down/offset 0 16"</samp><br /><br />Additionally, there are a few special animations. <samp>sleep</samp> anywhere in an animation name causes the NPC to go to sleep (which, among other things, prevents players from gifting or talking to the NPC while the animation is active.) The specific animation <samp>NPCName_sleep</samp> (with the NPCName fully lowercased) automatically used by spouses when they turn in for the night, and by NPCs coming home from Ginger Island. <samp>square_X_Y_facing</samp> causes NPCs to make random movements in a rectangle of at most X by Y (it can be less), centered at the schedule point. They will occasionally pause and face the <samp>facing</samp> direction. <samp>change_beach</samp> and <samp>change_normal</samp> cause NPCs to change into and out of their beach outfits, and is used by Ginger Island resort schedules.
 
|-
 
|-
| <tt>dialogue</tt>
+
| <samp>dialogue</samp>
| <p>''(optional)'' The dialogue the NPC should use when they reach their destination. This must be an [[Modding:Modder Guide/APIs/Content|asset name]] and entry key in this exact format (including quotes): <tt>"assetName:key"</tt>. Any slashes in the asset name should be double backslashes (<tt>\\</tt>).</p><p>For example, <tt>\"Strings\\schedules\\Abigail:Sun.000\"</tt> means "open the file at <tt>Strings\schedules\Abigail.xnb</tt> and get the text of the <tt>Sun.000</tt> key".
+
| <p>''(optional)'' The dialogue the NPC should use when they reach their destination. This must be an [[Modding:Modder Guide/APIs/Content|asset name]] and entry key in this exact format (including quotes): <samp>"assetName:key"</samp>. Any slashes in the asset name should be double backslashes (<samp>\\</samp>). The format of the entry key doesn't matter, it just needs to match one in the file.</p><p>For example, <samp>"Strings\\schedules\\Abigail:Sun.000"</samp> means "open the file at <samp>Strings\schedules\Abigail.xnb</samp> and get the text of the <samp>Sun.000</samp> key".</p><p><small>Tip: If you want schedule dialogue in marriage schedules, include the exact string <samp>marriage</samp> somewhere in the key, that will only show it to the npc's spouse.</small>
 
|}
 
|}
   Line 167: Line 172:     
[[Category:Modding]]
 
[[Category:Modding]]
 +
 +
[[es:Modding:Datos de horarios]]
 +
[[ru:Модификации:Расписание]]
16

edits