Trigger Actions

BETAS adds 47 new Trigger Action Actions (which I will call "tractions") to the game for you to use. Not all of them will be useful without using the new Triggers or new Game State Queries added by BETAS, but just like other tractions, you can use them in dialogue, letters, etc. as you see fit. These tractions, unless otherwise stated, support tokenizable strings (including those added by BETAS). All of these tractions are also automatically registered as Map Actions.

If a parameter is wrapped in < > then it is a required parameter. If the parameter is wrapped in [] then it is an optional parameter. If the parameter has a + after it, that means you can provide multiple of that parameter separated by spaces. If a parameter starts with # then it expects a number. If it ends with ? then it expects true/false. If neither, it expects a string.

All of the tractions listed here must be prefixed with Spiderbuttons.BETAS_! This prefix was removed in these docs for brevity but they will not work without it! For example, PlaySound MUST be written as Spiderbuttons.BETAS_PlaySound in your actual mod!
ACTION EFFECT
ActionList <Action String>+ Run every given Action String in order. Each Action String that contains spaces must be wrapped in quotes.
AddExperience [#Amount] [Skill] Add #Amount experience (default 1) to the current player. Skill can be any one of Farming, Fishing, Foraging, Mining, Combat, Luck, or a SpaceCore skill ID. If no Skill is provided, the player will gain Amount experience in all skills.
AddFestivalScore [#Amount] Add the given #Amount (default 1) of festival score (fish caught, eggs found, star tokens, etc.) to the current player.
AddHealth <#Value> [Override?] Add the given #Value to the current player's health. If Override? (default false) is set to true, the player's health will be allowed to go beyond their maximum health. A negative #Value will damage the player.
AddQiCoins [#Amount] Add the given #Amount (default 1) of Qi Coins to the current player.
AddStamina <#Value> [Override?] Add the given #Value to the current player's stamina. If Override? (default false) is set to true, the player's stamina will be allowed to go beyond their maximum stamina. A negative #Value will remove stamina from the player.
ChangeMusicTrack <Track> Change the currently playing music to the music with the given Track name.
ChangeRelationship <NPC> [Relationship] [Roommates?] [#Wedding Delay] Change the current farmer's relationship with the given NPC to the Relationship provided (default Friendly). Possible relationships are Friendly, Dating, Engaged, Married, and Divorced. Roommates? (default false) only applies to Engaged and Married and will set the NPC as the farmer's roommate if it is set to true. #Wedding Delay (default 3) only applies to Engaged and sets how many days will pass before the wedding happens.
ClearObjects [Location] [Type] [#TopLeftX] [#TopLeftY] [#BottomRightX] [#BottomRightY] Clear objects (weeds, chests, etc.) from the given Location (default Here). If a Type (default All) is specified and matches a C# class type (e.g. Chest or Furniture), then only objects that match that type will be cleared. You can prefix the type with a ! to negate it. For example, writing !Fence for the type will clear every object that is not a fence. If #TopLeftX and #TopLeftY are specified without #BottomRightX and #BottomRightY, then the object at that specific tile will be cleared. If #BottomRightX and #BottomRightY are both specified, then every object within that rectangle will be cleared.
ClearTerrainFeatures [Location] [Type] [#TopLeftX] [#TopLeftY] [#BottomRightX] [#BottomRightY] Clear terrain features (bushes, trees, etc.) from the given Location (default Here). If a Type (default All) is specified and matches a C# class type (e.g. ResourceClump or Bush), then only terrain features that match that type will be cleared. You can prefix the type with a ! to negate it. For example, writing !Bush for the type will clear every terrain feature that is not a bush. If #TopLeftX and #TopLeftY are specified without #BottomRightX and #BottomRightY, then the terrain feature at that specific tile will be cleared. If BottomRightX and BottomRightY are both specified, then every terrain feature within that rectangle will be cleared.
DelayedAction <Action String> <#Delay> Execute the given Action String only after #Delay milliseconds have passed.
DialogueBox <NPC> <Message> [Portrait] [DisplayName] [Typing?] Display a dialogue box on the screen with the given Message in it, as if the player was talking to the given NPC. The Message can either be the quoted string message itself, a translation key like Characters/Dialogue/Haley:Resort_Leaving, or a LocalizedText tokenizable string. The given NPC does not actually need to exist for the dialogue box to appear, however if they do not exist there will be no portrait displayed without specifying an asset name (e.g. Portraits/Haley but any asset will work) for the Portrait (default Null) parameter. You may also use the Portrait parameter to force a different portrait even if the given NPC does exist (i.e. you can open a Haley dialogue box but with Abigail's portrait), or write None if you want to omit the portrait entirely. If you write Null for the portrait, it will default to the portraits of the given NPC if they exist. Portrait dialogue commands in the Message will change the portrait if they are able to. If you specify a DisplayName, then that name will be used for the dialogue box regardless of the actual name of the NPC. If Typing? (default true) is set to false, the text of the dialogue box will appear instantly instead of being typed letter by letter. These dialogue boxes do not count for actually talking to the NPC, and question-and-response dialogue will not work.
EatObject <ItemId> [From Inventory?] Make the player eat (or drink) an object with the given ItemId, which can be qualified or unqualified. This will only work for objects whose edibility is not -300. If From Inventory (default true) is set to false, then the player will not need to have the object in their inventory to actually eat it. Otherwise, the action will do nothing if they don't have at least one of the object to eat.
EmoteFarmer <#EmoteId> Cause an emote bubble for the given EmoteId to appear above the current player's head.
EmoteNpc <NPC> <#EmoteId> Cause an emote bubble for the given EmoteId to appear above the head of the given NPC.
Explode [#X] [#Y] [#Radius] [Damaging?] [#Damage] [Destroy?] Cause an explosion to happen at the given #X and #Y coordinates on the current map. #X and #Y default to the player's coordinates but can be set individually. #Radius (default 3) controls the size of the explosion. If Damaging? (default false) is set to true, then nearby farmers will take #Damage (default -1) amount of damage to their health. Setting #Damage to -1 will make the damage be calculated based on the #Radius. If Destroy? (default false) is set to true, then the explosion will also potentially destroy objects like a normal bomb.
FadeToBlack <#Duration> Fade the player's screen to black, keep it black for #Duration milliseconds, and then fade to clear again.
HoldUpItem <ItemId> [#Count] Give the current player #Count (default 1) amount of the given ItemId. After receiving it, they will hold it up and a message will display on their screen telling them they got it.
Jump [Character] [#Velocity] [#Vertical Movement] [#Horizontal Movement] Make the given Character jump upwards with the given #Velocity (default 4). Character can be All to make every NPC in the current map jump, Farmer to make the current player jump, or any NPC name to make a specific NPC jump. #Vertical Movement (default 0) and #Horizontal Movement (default 0) only apply when Character is set to Farmer and control whether or not the player will actually move in the map when they jump and land somewhere else.
Lightning [#X] [#Y] Cause a lightning strike to happen at the given #X and #Y coordinates on the current map. This lightning is purely cosmetic and will not actually damage anything. If no coordinates are specified, the lightning will strike at the player's position.
Log <UniqueId> <Message> [LogLevel] [Once?] Log a Message to the SMAPI console using your mod name when given the UniqueId for your mod. LogLevel (default Info) must be one of Trace, Debug, Info, Warning, Error, or Alert. If Once? (default false) is set to true, then this message will only be logged one time for this game session, no matter how many times this action is called. If your Message has spaces in it, it must be wrapped in quotes.

This action requires you to enable certain Advanced Permissions.

MakeMachineReady <MachineId> <OutputId> <Location> <#Count> Cause one or more machines in one or more locations to instantly finish producing their output. MachineId should be the item ID of the machine you want to target if you only want to target specific ones (e.g. only furnaces)—set it to Any for any machine. OutputId should be the qualified item ID of the output item if you only want to finish specific items (e.g. only mayonaisse)—set it to Any for any output item. Location should be the name of the location you want to look for machines in—set it to All if you want to search everywhere. #Count should be the number of machines you want to instantly finish—set it to -1 for unlimited.
Message <Text> [Typing?] Display a simple dialogue box with the given Text on the screen, similar to using the Message map action. The Text can either be a raw string or a translation key (e.g. Characters/Dialogue/Haley:Resort_Leaving). If Typing? (default false) is set to true, the text of the dialogue box will appear letter by letter instead of showing up instantly.
OpenShop <ShopId> [Owner] Open a shop menu for the shop with the given ShopId, regardless of whether or not the shop is open or an owner is present. If no Owner is specified, then no portraits or dialogue will be shown on the side of the shop menu. If you do specify an Owner, they must be listed as an owner in that shop's owner data.
PatchUpdate Force Content Patcher to immediately refresh all of its tokens and reload all patches as necessary. Use this sparingly as it will cause lag if the user has a lot of Content Patcher mods installed. This action requires Content Patcher to be installed to function.
PlaySound <Cue Name> [Everyone?] Play the sound/music with the given Cue Name. If Everyone? (default false) is set to true, the sound will be played for every player. Otherwise, it will only play for the current player. See Audio for cue names.
RandomAction <Action String>+ When given a list of quoted Action Strings, this will randomly choose one of the actions to execute.
RegeneratePathsLayer [Location] [#X] [#Y] [#Width] [#Height] Regenerate terrain features according to the Paths tilesheet layer of the given Location (default Here) inside the area defined by the given rectangle measured in tiles. #X and #Y both default to 0. #Width and #Height default to the width of the given location minus #X and the height of the given location minus #Y respectively. Terrain features outside of this rectangle will not be regenerated. If any terrain features already exist in this area, they will be duplicated, so remember to use ClearTerrainFeatures as necessary first.
RegionalFriendship <HomeRegion> <#Amount> [Set?] For the current player, add the given #Amount of friendship points to every NPC who lives in the given HomeRegion. If Set? (default false) is set to true, then the friendship level of those NPCs will be set to the exact #Amount specified, rather than adding or subtracting it.
ReloadItemField <ItemId> <Field>+ Update the given Field of every item with a matching ItemId in the world to match the value that a newly spawned item would have.
RemoveFarmModData <Key> [Value] Remove the mod data dictionary entry with the given Key from the farm. If no Value is provided, it will remove any mod data that exists for that Key. If a Value is provided, it will only remove the mod data if the already existing value in the dictionary matches the given Value.
RemoveGlobalModData <Key> [Value] Remove the mod data dictionary entry with the given Key from your mod's global mod data. If no Value is provided, it will remove any mod data that exists for that Key. If a Value is provided, it will only remove the mod data if the already existing value in the dictionary matches the given Value.

This action requires you to enable certain Advanced Permissions.

RemovePlayerModData <Key> [Value] Remove the mod data dictionary entry with the given Key from the current player. If no Value is provided, it will remove any mod data that exists for that Key. If a Value is provided, it will only remove the mod data if the already existing value in the dictionary matches the given Value.
ResetGifts <NPC> [#Amount] [Today?] Reset the weekly gift limit for the current player for the given NPC. If #Amount (default 0) is set, the limit will be changed to the number provided. If Today? (default false) is set to true, then the daily limit will be reset instead of the weekly limit.
SetFriendshipPoints <NPC> <#Points> Set the current number of friendship points that a player has with a given NPC to the number of #Points provided.
SetHealth <#Value> [Override?] Set the current health of the current player to the given #Value. If Override? (default false) is set to true, the player's health will be allowed to go beyond their maximum health.
SetStamina <#Value> [Override?] Set the current stamina of the current player to the given #Value. If Override? (default false) is set to true, the player's stamina will be allowed to go beyond their maximum stamina.
SetNewDialogue <NPC> <Dialogue> [Add?] Add a new line of dialogue to the given NPC. The Dialogue can be a literal string of dialogue text (dialogue commands and formatting are supported), a LocalizedText tokenizable string, or a translation key (e.g. Characters/Dialogue/Haley:Resort_Leaving). Remember to wrap the dialogue in escaped quotes as necessary. The Add? (default false) parameter is a boolean value that determines whether the currently existing dialogue for the given NPC will be overwritten (false) or if the new Dialogue will be added in front of the existing dialogue (true). Note that regardless of what you do, Conversation Topic dialogue and Scheduled Location dialogue will have priority over your added dialogue.
ShakeNpc [NPC] [#Duration] Make the given NPC (default All) shake for #Duration milliseconds (default 1000). If no NPC is specified or you write All instead of a name, every NPC in the current location will shake.
ShowMail <Mail Id> [Flag?] Show the current player a letter corresponding to the mail with the given Mail Id. If Flag? (default false) is set to true, then this mail will be added to the current player's received mailbox (i.e. they'll get the mail flag), otherwise the game will not consider them to have seen or received this mail.
StartDivorce Set the current player to be divorced overnight. If you want them to be divorced immediately, see ChangeRelationship.
TextAboveHead <NPC> <Dialogue> [#Duration] [#Delay] [Jitter?] [Colour] Cause a speech bubble to appear above the given NPC that contains the Dialogue. The Dialogue can be a literal string (dialogue commands and formatting are not supported) or a LocalizedText tokenizable string. Remember to wrap the dialogue in escaped quotes as necessary. The speech bubble will last for #Duration milliseconds (default 3000) and wait #Delay milliseconds (default 0) before appearing. If Jitter? (default false) is set to true, the speech bubble will shake. The Colour parameter (default #56160C) controls the colour of the text.
TriggerAction <Id> [Trigger] Manually trigger the Data/TriggerActions entry with the given Id and Trigger type (default Manual)
UpdateAppearance <NPC> [Id] Force the NPC to choose their appearance again from their list of Appearances in their Data/Characters data. If you provide the Id of a specific appearance in the list, the NPC will change to that appearance regardless of the conditions that appearance normally requires and regardless of any other appearances with higher precedence or weight. For FarmHands, this will only work if they are in the same location as theNPC.
WarpFarmer <Location> <#X> <#Y> <#FacingDirection> Warp the current player to the #X and #Y tile coordinates in the given Location. The #FacingDirection (default 2) determines where the player will be facing after the warp. Warps leading inside the FarmHouse may not always work correctly.
WarpNpc <NPC> <Location> <#X> <#Y> <#FacingDirection> Warp the given NPC to the #X and #Y tile coordinates in the given Location. The #FacingDirection (default 2) determines where the NPC will be facing after the warp. Warps leading inside the FarmHouse may not always work correctly.
WeatherForTomorrow <ContextID> <Weather> Force the specified location ContextID to have the given Weather on the following day. Weather can be one of GreenRain, Rain, Snow, Storm, Sun, Wind, or a custom weather ID. This action will not override days with hardcoded weather (festivals, weddings, etc).
WriteFarmModData <Key> <Value> Write the given Value to the mod data dictionary of the farm and assign it the given Key.
WriteGlobalModData <Key> <Value> Write the given Value to the global mod data dictionary for your mod and assign it the given Key.

This action requires you to enable certain Advanced Permissions.

WritePlayerModData <Key> <Value> Write the given Value to the mod data dictionary of the current player and assign it the given Key.