Line 138: |
Line 138: |
| ! how to change IDs | | ! how to change IDs |
| {{!}}- | | {{!}}- |
− | {{!}} [[Modding:Event data|event IDs]] | + | {{!}} [[Modding:Event data|event IDs]]<br />[[Modding:Items|item IDs]]<br />[[Modding:Mail data|mail IDs]]<br />[[Modding:Recipe data|recipe IDs]]<br />[[#Custom jukebox tracks|song IDs for jukebox]] |
− | {{!}} Use a [[Modding:Trigger actions|trigger action]] to swap the event IDs. For example, using [[Modding:Content Patcher|Content Patcher]]: | + | {{!}} [[Modding:Content Patcher|Content Patcher]] adds a custom [[Modding:Trigger actions|trigger action]] which can migrate IDs everywhere in the save data. |
| + | |
| + | For example, this migrates two crafting recipe IDs: |
| <syntaxhighlight lang="js"> | | <syntaxhighlight lang="js"> |
− | // replace OLD_EVENT_ID and NEW_EVENT_ID appropriately
| |
| { | | { |
| "Action": "EditData", | | "Action": "EditData", |
| "Target": "Data/TriggerActions", | | "Target": "Data/TriggerActions", |
| "Entries": { | | "Entries": { |
− | "{{ModId}}_SwapEventId": { | + | "{{ModId}}_MigrateToUniqueIds": { |
− | "Id": "{{ModId}}_SwapEventId", | + | "Id": "{{ModId}}_MigrateToUniqueIds", |
| "Trigger": "DayStarted", | | "Trigger": "DayStarted", |
− | "Condition": "PLAYER_HAS_SEEN_EVENT Current OLD_EVENT_ID",
| |
| "Actions": [ | | "Actions": [ |
− | "MarkEventSeen Current OLD_EVENT_ID false", | + | // Note: use double-quotes around an argument if it contains spaces. This example has single-quotes for |
− | "MarkEventSeen Current NEW_EVENT_ID true" | + | // the action itself, so we don't need to escape the double-quotes inside it. |
− | ] | + | 'Pathoschild.ContentPatcher_MigrateIds CraftingRecipes "Puffer Plush" {{ModId}}_PufferPlush "Puffer Sofa" {{ModId}}_PufferSofa' |
| + | ], |
| + | "HostOnly": true |
| } | | } |
| } | | } |
| } | | } |
| </syntaxhighlight> | | </syntaxhighlight> |
− | {{!}}-
| |
− | {{!}} [[Modding:Items|item IDs]]
| |
− | {{!}} {{upcoming|1.6 alpha build 24069}}
| |
| | | |
− | Use a [[Modding:Trigger actions|trigger action]] to swap the item IDs. For example, using [[Modding:Content Patcher|Content Patcher]]:
| + | See the [https://github.com/Pathoschild/StardewMods/blob/develop/ContentPatcher/docs/author-guide/trigger-actions.md Content Patcher docs] for more info about using the trigger action, including restrictions and valid ID types. |
− | <syntaxhighlight lang="js">
| |
− | // replace OLD_ITEM_ID (qualified item ID) and NEW_ITEM_ID (unqualified item ID) appropriately
| |
− | {
| |
− | "Action": "EditData",
| |
− | "Target": "Data/TriggerActions",
| |
− | "Entries": {
| |
− | "{{ModId}}_SwapItemId": {
| |
− | "Id": "{{ModId}}_SwapItemId",
| |
− | "Trigger": "DayStarted",
| |
− | "Actions": [
| |
− | "SwapItemId OLD_ITEM_ID NEW_ITEM_ID"
| |
− | ]
| |
− | }
| |
− | }
| |
− | }
| |
− | </syntaxhighlight>
| |
| {{!}}- | | {{!}}- |
| {{!}} [[Modding:Location data|location IDs]] | | {{!}} [[Modding:Location data|location IDs]] |
| {{!}} Add the old name to the location's <samp>FormerLocationNames</samp> field in <samp>Data/Locations</samp>. | | {{!}} Add the old name to the location's <samp>FormerLocationNames</samp> field in <samp>Data/Locations</samp>. |
− | {{!}}-
| |
− | {{!}} [[Modding:Mail data|mail IDs]]
| |
− | {{!}} Use a [[Modding:Trigger actions|trigger action]] to swap the mail IDs. For example, using [[Modding:Content Patcher|Content Patcher]]:
| |
− | <syntaxhighlight lang="js">
| |
− | // replace OLD_MAIL_ID and NEW_MAIL_ID appropriately
| |
− | {
| |
− | "Action": "EditData",
| |
− | "Target": "Data/TriggerActions",
| |
− | "Entries": {
| |
− | "{{ModId}}_SwapMailId_Mailbox": {
| |
− | "Id": "{{ModId}}_SwapMailId_Mailbox",
| |
− | "Trigger": "DayStarted",
| |
− | "Condition": "PLAYER_HAS_Mail Current OLD_MAIL_ID Mailbox",
| |
− | "Actions": [
| |
− | "RemoveMail Current OLD_MAIL_ID Mailbox",
| |
− | "AddMail Current NEW_MAIL_ID Mailbox"
| |
− | ]
| |
− | },
| |
− | "{{ModId}}_SwapMailId_Received": {
| |
− | "Id": "{{ModId}}_SwapMailId_Received",
| |
− | "Trigger": "DayStarted",
| |
− | "Condition": "PLAYER_HAS_Mail Current OLD_MAIL_ID Received",
| |
− | "Actions": [
| |
− | "RemoveMail Current OLD_MAIL_ID Received",
| |
− | "AddMail Current NEW_MAIL_ID Received"
| |
− | ]
| |
− | }
| |
− | }
| |
− | }
| |
− | </syntaxhighlight>
| |
| {{!}}- | | {{!}}- |
| {{!}} [[Modding:NPC data|NPC internal names]] | | {{!}} [[Modding:NPC data|NPC internal names]] |
Line 218: |
Line 171: |
| {{!}} [[Modding:Quest data|quest]] and [[Modding:Special orders|special order]] IDs | | {{!}} [[Modding:Quest data|quest]] and [[Modding:Special orders|special order]] IDs |
| {{!}} Currently there's no safe way to migrate quest and special order IDs, since removing and readding them will reset any progress the player has made on them. | | {{!}} Currently there's no safe way to migrate quest and special order IDs, since removing and readding them will reset any progress the player has made on them. |
− | {{!}}-
| |
− | {{!}} [[Modding:Recipe data|recipe IDs]]
| |
− | {{!}} {{upcoming|1.6 alpha build 24069}}
| |
− |
| |
− | Use a [[Modding:Trigger actions|trigger action]] to swap the recipe IDs.
| |
− |
| |
− | For example, to migrate a cooking recipe using [[Modding:Content Patcher|Content Patcher]]:
| |
− | <syntaxhighlight lang="js">
| |
− | // replace OLD_RECIPE_NAME and NEW_RECIPE_NAME appropriately
| |
− | {
| |
− | "Action": "EditData",
| |
− | "Target": "Data/TriggerActions",
| |
− | "Entries": {
| |
− | "{{ModId}}_SwapRecipeId": {
| |
− | "Id": "{{ModId}}_SwapReciped",
| |
− | "Trigger": "DayStarted",
| |
− | "Condition": 'PLAYER_HAS_COOKING_RECIPE Current "OLD_RECIPE_NAME"',
| |
− | "Actions": [
| |
− | 'MarkCookingRecipeKnown Current "OLD_RECIPE_NAME" false',
| |
− | 'MarkCookingRecipeKnown Current "NEW_RECIPE_NAME"'
| |
− | ]
| |
− | }
| |
− | }
| |
− | }
| |
− | </syntaxhighlight>
| |
− |
| |
− | To migrate a crafting recipe, change <samp>PLAYER_HAS_COOKING_RECIPE</samp> to <samp>PLAYER_HAS_CRAFTING_RECIPE</samp> and <samp>MarkCookingRecipeKnown</samp> to <samp>MarkCraftingRecipeKnown</samp>.
| |
− | {{!}}-
| |
− | {{!}} [[#Custom jukebox tracks|song IDs for jukebox]]
| |
− | {{!}} You can add the old name to the track's <samp>AlternativeTrackIds</samp> in <samp>Data/JukeboxTracks</samp>. This will keep the old song ID in the player data, but the jukebox will alias it to the new ID.
| |
− |
| |
− | Alternatively you can use a [[Modding:Trigger actions|trigger action]] to swap the song IDs. For example, using [[Modding:Content Patcher|Content Patcher]]:
| |
− | <syntaxhighlight lang="js">
| |
− | // replace OLD_SONG_ID and NEW_SONG_ID appropriately
| |
− | {
| |
− | "Action": "EditData",
| |
− | "Target": "Data/TriggerActions",
| |
− | "Entries": {
| |
− | "{{ModId}}_SwapSongId": {
| |
− | "Id": "{{ModId}}_SwapSongId",
| |
− | "Trigger": "DayStarted",
| |
− | "Condition": "PLAYER_HAS_HEARD_SONG Current OLD_SONG_ID",
| |
− | "Actions": [
| |
− | "MarkSongHeard Current OLD_SONG_ID false",
| |
− | "MarkSongHeard Current NEW_SONG_ID"
| |
− | ]
| |
− | }
| |
− | }
| |
− | }
| |
− | </syntaxhighlight>
| |
| {{!}}} | | {{!}}} |
| }} | | }} |