Makes map tiles dynamic - change tile, tile sheet, and properties on-the-fly; tiles can be pushed and blown up; heal or hurt; give items and money; play sounds and change music; show custom events; trigger buffs, debuffs, emotes, and teleports; speed up,
This example sets the property DMT/slippery to 0.25 on all tiles that fit the parameters above (in Forest, on Back layer, with indexes 226 and 227 on tilesheet "fest" with path containing "Festivals", with x and y coordinates within the given rectangle). Any parameter can be omitted if not used.
Key Triggering
Trigger Once
Any of the property keys below can be suffixed with Once to have the property be removed once it has been triggered once.
Conditional Triggers
Both ordinary keys and those with the Once suffix can then take one of the following suffixes to determine how they are triggered:
Explode - triggered when the tile is destroyed by an explosion (tiles that have the DMT/explode key)
Push - triggered when the tile is pushed
Pushed - triggered once a tile has finished being pushed
On - triggered when the farmer steps on the tile (Back tiles only)
Off - triggered when the farmer steps off the tile (Back tiles only)
Some keys are triggered in other ways and do not require a suffix.
Tool Triggers
Most keys can be triggered when using a tool on a tile, by adding the class name of a tool (not the language specific display name) as a suffix. E.g.:
"DMT/soundOnceWateringCan": "steam"
will trigger when one waters the tile with a watering can.
Tool class names in the vanilla code are:
MagnifyingGlass
Shears
MilkPail
Axe
Wand
Hoe
FishingRod
MeleeWeapon
Pan
Pickaxe
WateringCan
Slingshot
GenericTool
Object Triggers
Most keys can be triggered when acting on a tile while holding a specific object by adding "Object" plus either the held object's index number or its name (not display name). E.g.:
"DMT/soundObjectPrismatic Shard": "yoba"
To have the object be removed on trigger, combine this with the DMT/take key. E.g.:
"DMT/takeObjectPrismatic Shard": "" - this will take the player's active object if the tile is acted on while holding a Prismatic Shard.
Action Triggers
Most keys can be triggered simply by acting on the tile by adding "Action" to the end of the key. E.g.:
"DMT/soundAction": "yoba"
SMAPI C# Triggers
To trigger any tile's keys from another C# mod, you can use SMAPI's mod API interface. The API interface for this mod is:
public interface IDynamicMapTilesApi
<br /> {
<br /> public bool TriggerActions(List layers, Farmer farmer, Point tilePos, List suffixes);
<br /> }
suffixes should be a list of all the kinds of trigger outlined above that you want to trigger.
Key List
All possible keys are explained in detail below, organized as follows:
Buffs
Cache Invalidation
Emotes
Events
Explosions
Health and Stamina
Items & Chests
Mail
Messages
Music
Pushing
Sound
Speed & Movement
Temporary Sprite Animations
Teleportation
Tile Indexes
Tile Properties
Buffs
DMT/buff
The above key can be used to add a buff/debuff to the player. The value should be the integer index of the buff/debuff. Buff indexes are as follows:
6 Full
7 Quenched
12 Burnt
13 Slimed
14 Jinxed
17 Tipsy
18 Spooked
19 Frozen
20 Warrior Energy
21 Yoba's Blessing
22 Adrenaline Rush
23 Oil of Garlic
24 Monster Musk
25 Nauseous
26 Darkness
27 Weakness
28 Squid Ink Ravioli
E.g.:
"DMT/buffOn": "13" - triggers the slimed buff when stepping on the tile.
Cache Invalidation
DMT/invalidate
You can trigger the invalidation of cached game assets using DMT/invalidate. The value should be a list of asset paths separated by the pipe symbol "|".
Emotes
DMT/emote
This key causes a farmer to emote. The value should be the integer index of the specific emote. Emote indexes are:
4 empty can
8 question mark
12 angry
16 exclamation
20 heart
24 sleep
28 sad
32 happy
36 x
40 pause
44 not used
48 not used
52 videogame
56 music note
60 blush
Events
DMT/event
Use the above key to trigger a custom event. See Modding:Event data on the wiki. E.g.:
"DMT/eventOn": "playful/20 57/Harvey 25 57 3/skippable/pause 200/speak Harvey \"Hey, why are you stepping there, @?\"/pause 500/end"
Explosions
DMT/explode DMT/explosion
Tiles can be marked as explodable by adding the property DMT/explode to the tile. The tile will be removed when affected by a bomb. Tiles on different layers will be checked individually.
The value of the key should be left blank "" unless you want the mod to set a mail flag for the player - then set the value to the mail id to be sent. This can be useful for making the explosion persistent, as Content Patcher can then check for the flag and remove the tile on next load.
You can trigger other properties on explode by adding "Explode" to the end of the property key; tiles with properties ending with Explode will be triggered when DMT/explode is triggered on that tile. E.g.:
Tiles can trigger an explosion somewhere in the map when stepped on by adding the property DMT/explosion. The value of the property should be the following:
These keys can be used to affect the player health and stamina all at once or when standing on a tile over time (the PerSecond keys should be used on the "Back" layer only and will be triggered while standing on the tile; they should not take a suffix).
The property value should be a positive or negative integer.
Items & Chests
DMT/give [b]DMT/chest DMT/take
Give
[/b]To give the player an item, use the key DMT/give. The item will be held up by the farmer and placed in their inventory (or on the ground if full).
For ordinary objects, the value should be either the index in ObjectInformation or the name of the object in ObjectInformation.
To give other types of items, use /. The following types are supported:
Hat
Clothing
Craftable
Furniture
Weapon
Money
E.g.:
"DMT/giveOn": "Clothing/Skull Shirt"
Chest
To spawn a chest somewhere in the map, use DMT/chest. The syntax is:
= ...
Item syntax is the same as for DMT/give except you can specify an amount using , E.g.:
"DMT/chestOn": "8 26=Money/1000 [b]Clothing/Skull Shirt 378,10"[/b] - this spawns a chest with 1000 coins, a skull shirt, and 10 copper ore.
Take
To take one of the player's held item use DMT/take. If the value is empty, the item will be taken no matter what it is. If the value is either a specific object index or name, it will only take if the held item index or name matches. This is useful for combining with Object suffixed triggers so that the item is consumed and something else happens as a result.
Mail
DMT/mail DMT/mailbox
Use the above keys to send mail. The value is the id for the mail to be sent.
The first key will simply set a mail flag as having been received. The second key will actually put the mail with that id into the mailbox. The first is useful for setting flags to tell Content Patcher mods that the tile has been stepped on before.
Messages
DMT/message
Use the above key to show a HUD message.
Music
DMT/music
Use the above key to change the currently playing music track. The value should be the id of a music track in the game.
Pushing
DMT/push [b]DMT/pushAlso DMT/pushOthers DMT/pushable [/b] Only tiles on the Buildings layer can use the property DMT/push, which lets you push them by walking into them. The value of the property should be a comma-separated list of all tiles (X Y) that the tile is pushable to. E.g.:
"DMT/push": "1 1,1 2,2 1,2 2" - this tile can be pushed to any of the four tiles in the list.
You can trigger pushing other tiles when a tile is pushed using DMT/pushAlso. The format for DMT/pushAlso value is:
, ...
E.g.:
"DMT/[b]pushAlso": "Buildings -1 0,Front -1 -1,Front 0 -1"[/b] - pushes three other tiles when this tile is pushed, with x y tile positions relative to this tile.
Tiles that are included in another tile's pushAlso list should have the property "DMT/pushable" added to them if there is a concern with different sets of pushable tiles colliding and erasing each other. Tiles without this property will be overridden by tiles pushed into their position.
You can trigger other properties on push by adding "Push" to the end of the property key; exploded tiles with properties ending with Push will be triggered when DMT/push is triggered on that tile. E.g.:
[b]"DMT/soundPush": "furnace"[/b]
You can trigger other properties when a tile is finished being pushed by adding "Pushed" to the end of the property key; exploded tiles with properties ending with Pushed will be triggered when a tile being push reaches its destination tile. E.g.:
[b]"DMT/soundPushed": "yoba"[/b]
Push and Pushed suffixes can also be added to tiles on other layers, so that when you push a tile onto or off of another tile it triggers the properties on that tile. E.g.:
"DMT/explosionOncePushed": "17 26 8 false -1" - this can be added to a tile on the Back layer so that when a tile on the Buildings layer is pushed onto it, it triggers an explosion once. Push suffix will be triggered on tiles when a tile is pushed off of them instead.
To trigger the pushing of tiles other than the triggering tile use DMT/pushOthers. This key takes a list of Layer X Y values separated by commas like pushAlso. Note that each tile pushed this way will trigger its own pushAlso key, so there is no need to push all joined tiles with this trigger.
Sound
DMT/sound
To play a sound, use one of the above keys. The value should be a valid vanilla sound key (see Modding:Audio on the wiki).
Playing a sound once means the property will be removed once the sound has been played. This is not persistent (the sound will be able to play again if the map is reloaded). Use mail flags and Content Patcher for persistence.
Speed & Movement
DMT/speed DMT/move [b]DMT/slippery
[/b]The speed key can be used to affect the player's movement speed while moving over a tile. The value should be the decimal multiplier (1 is no change, 0.5 is half speed, etc.).
The move key can be used to apply directional velocity while on a tile. The value should be decimal x and y values separated by a space. E.g.:
"DMT/move": "2.5 0" - applies 2.5x velocity towards the right while on the tile with this property.
The slippery key can be used to make tiles slippery. The value should be a decimal, which seems to be equivalent to a fraction of the player's ordinary move speed. E.g.:
"DMT/slippery": "0.25" - this simulates ordinary ice tiles
Temporary Sprite Animations
DMT/animation
Animations are complex things - they are not difficult to code, just have many possible parameters. I've added two options for triggering animations, one with 16 parameters and one with 29 (!) parameters. Parameters should be separated by commas. For multiple animations, separate them using the pipe symbol "|".
Indexed Animations
Indexed animations use the game's built in animations data sheet. If you want to trigger any of those, look at the TileSheets/animations file. The parameters should be:
This creates five different animations using Content Patcher randomization for position.
Teleportation
DMT/teleport DMT/teleportTile
To instantly teleport anywhere on the current map when stepping on a tile, use the above key. For the first key, the value should be the exact x y coordinates to teleport to. For the second key, use the tile x y coordinates instead. E.g.:
"DMT/teleportTileOn": "10 10" and "DMT/teleportOn": "640 640" - both teleport the player to the tile 10,10 when stepping on the tile with this property. With the second key you can of course use non-multiples of 64 for precise teleportation (Heisenberg compensator sold seperately).
Tile Indexes
DMT/changeIndex DMT/changeMultipleIndex
[b]DMT/changeIndex[/b]
To change the tile index to another index on the same tile sheet, the value should be the new integer index. e.g:
"[b]DMT/changeIndexOn": "69"[/b]
To change to a different tile sheet, use the following syntax:
tileSheetName/index
e.g.:
"DMT/changeIndexOn": "Landscape/69" - will change the tile to use index 69 on the Landscape tile sheet when the farmer steps on it.
For animated tiles, use the following syntaxes instead:
[b]"[b]DMT/changeIndexOn": "[/b]Landscape/67 Landscape/68 [/b]Landscape/69,100" - will change the tile to an animated tile using three static tile indexes from the Landscape tile sheet, 100ms per tile
To remove a tile, leave the entire value blank "".
DMT/changeMultipleIndex
The syntax is similar to that above. Info for each tile being changed is separated by the pipe symbol "|":
|
Each tile info is separated into two parts by an equals sign:
=
The part before the equals sign is separated by spaces, containing the layer name, x coordinate, and y coordinate. The part after the equals sign is the same as the section on changing single tiles above (either idx or idx1 idx2 idx3,duration). E.g.:
"DMT/changeMultipleIndexOn": "Back 5 10=150|Buildings 6 9=Landscape/67 Landscape/68 Landscape/69,100" - changes one back tile (5,10) to a static tile and one building tile (6,9) to an animated tile using the data given, when the farmer steps on the tile with this property.
To remove a tile, just don't put anything after the equals sign.
Tile Properties
DMT/changeProperties DMT/changeMultipleProperties
Similar to the previous section, use these keys for changing the current tile properties, or changing multiple tiles' properties.
For the current tile's properties:
Properties are split by the pipe symbol "|". Each property has a key and value:
To remove a property, omit the equal sign and the value:
"DMT/changePropertiesOn": "Action|Passable" - removes both these properties from the stepped on tile.
For multiple tile properties, separate tile info using the pipe sign as before, "|". The info for each tile is almost the same as above, except it contains the tile info as well, separated using commas (because idk if the key might have spaces in it):
"DMT/changeMultiplePropertiesOff": "Buildings,6,9,[b]Action=Crib|[b]Back,9,6,Passable=T[/b]"[/b] - sets two different properties on two different tiles on two different layers.
To remove a property, just don't put anything after the equals sign.
Adds two fully-functional doors as craftable, buyable furniture. Lets modders create similar doors, as well as lockable door furniture with keys and key rings.
Adds two fully-functional doors as craftable, buyable furniture. Lets modders create similar doors, as well as lockable door furniture with keys and key rings.