Tutorial: Adding a DGA attachment to a Letter (Mail Framework Mod)

From Stardew Modding Wiki
Jump to navigation Jump to search

PLEASE NOTE: DGA is being obsoleted for 1.6 and Content Patcher is the preferred way to add mail, so this tutorial is obsolete.

You want to send a mail in-game and add an item from Dynamic Game Assets as an attachment to it using the very useful Mail Framework Mod? It's easy!

Note: This tutorial assumes you are already familiar with Mail Framework Mod. If you are not, check out this tutorial Tutorial: Sending a Letter (Mail Framework Mod). This tutorial also assumes you already know how to create a DGA Content Pack. If you don't, check out this tutorial on how to create custom furniture with Dynamic Game Assets.

The present tutorial will use the same examples as this tutorial.

So, you made a new item (crop, furniture or even a recipe) using Dynamic Game Assets and you want to add it to a letter using Mail Framework Mod. This is easy!

Adding a DGA pack as a dependency

In order for your MFM Content Pack to know where to look for the attachment, you need to add your DGA Content Pack as a dependency. This should look like this:

{
  "Name": "Your Project Name",
  "Author": "your name",
  "Version": "1.0.0",
  "Description": "One or two sentences about the mod.",
  "UniqueID": "YourName.YourProjectName",
  "UpdateKeys": [],
  "Dependencies": [
		{
			"UniqueID": "YourDGAmodID"
		}
	],
  "ContentPackFor": {
    "UniqueID": "DIGUS.MailFrameworkMod"
  }
}

Adding the attachment to your mail

Now, you can add the attachment in the mail. This how it should look like.

[
    {
        "Id": "MyMail",
        "GroupId": null,
        "Text": "Hi @, this is a letter!^^-Lewis",
        "Date": "1 spring Y1",
        "Attachments": [
            {
				"Type": "DGA",
				"Name": "YourDGAmodID/ItemID",
            }]
        "FriendshipConditions": [
            {
                "NpcName": "Lewis",
                "FriendshipLevel": 2
            }]
    }]

Now, as you can see, there are two mandatory fields here.

The first one is type. It should always be DGA (even if in your DGA Content Pack your items are categorized as crops, furniture, etc.).

The name should be the full ID of your DGA item. The full ID of your item is: the unique ID of your DGA pack and the item's ID.

For example:

spacechase0.DynamicGameAssets.Example/My Custom Item

You also use "Stack" in your mail, but note that it only applies to items categorized in DGA as Objects & Big Craftables. This would look like this:

[
    {
        "Id": "MyMail",
        "GroupId": null,
        "Text": "Hi @, this is a letter!^^-Lewis",
        "Date": "1 spring Y1",
        "Attachments": [
            {
				"Type": "DGA",
				"Name": "YourDGAmodID/ItemID",
                "Stack" : 10
            }]
        "FriendshipConditions": [
            {
                "NpcName": "Lewis",
                "FriendshipLevel": 2
            }]
    }]

In this example, the player will receive a stack of 10 items.

Attaching a DGA recipe to your mail

The process is a little different for recipes. You don't need to add the unique ID of your DGA pack, just the recipe ID (its name).

Here's an example:

[
    {
        "Id": "MyMail",
        "GroupId": null,
        "Text": "Hi @, this is a letter!^^-Lewis",
        "Date": "1 spring Y1",
		"Recipe": "Recipe Name",
        "FriendshipConditions": [
            {
                "NpcName": "Lewis",
                "FriendshipLevel": 2
            }]
    }]

Keep in mind that It will only work if you have no other attachments to the mail.

And that's it! Now go, and create DGA Items to send via mail!