Stardew Valley

Content packs consist of a manifest.json file and a content.json file. If you allow your users to configure any variables, a config.json file will also be created on load.


JSON Format

The manifest.json file should follow the SMAPI content pack manifest format. Just use the example content pack as a template.

The content.json file contains a single weapons JSON array, with a list of JSON objects that have the following keys:


Weapon Keys

"id": either the melee weapon id or the weapon name (for JSON Assets weapons); this is ignored if using type
"type": setting this to 1 (dagger), 2 (club), or 3 (sword) will make this skill apply to all weapons of that type.
"enchantments": a JSON array of objects associated with either vanilla or custom enchantments (see below).
"skillLevel": the minimum combat skill level required to use this attack. Skills requiring higher levels supersede those requiring lower levels.
"cooldown": how long it takes for the attack to recharge.
"frames": a JSON array constituting a sequence of events, or frames.
"config": a list of keys that are meant to be user-configurable (see Config Variables below)


Enchantments

Each object in this array has the following keys:

"name": must be unique to this enchantment - suggest including the weapon or mod name, so it can be recognized when triggering.

"type": the type of enchantment. Vanilla enchantments include the following (read about these enchantments here):

  • "vampiric": VampiricEnchantment
  • "jade": JadeEnchantment
  • "aquamarine": AquamarineEnchantment
  • "topaz": TopazEnchantment
  • "amethyst": AmethystEnchantment
  • "ruby": RubyEnchantment
  • "emerald": EmeraldEnchantment
  • "haymaker": HaymakerEnchantment
  • "bugkiller": BugKillerEnchantment
  • "crusader": CrusaderEnchantment
  • "magic": MagicEnchantment

Custom enchantment types currently include:
  • "heal": heal the user based on the parameters below
  • "hurt": hurt the user based on the parameters below
  • "loot": drop extra loot or specific items on slaying a monster based on the parameters below
  • "coins": give coins on damaging or slaying a monster based on the parameters below

"parameters": a JSON array of strings, based on enchantment type (only affects custom enchantments):
  • "trigger" - what will trigger this, one of "damage", "crit", "slay", "equip" (equip not yet implemented)
  • "chance" - % chance to trigger
  • "amountMult" - used for heal, hurt, and coins - if trigger is slay then heals or drops based on monster max hp, otherwise based on damage dealt
  • "extraDropChecks" - used for loot, add this many loot checks to the monster on death (use this or the one below)
  • "extraDropItems" - used for loot, add specific items to the monster loot drop (use this or the one above). See below for syntax.
  • "sound" - name of the built-in sound to play on trigger

For extraDropItems, use a comma-separated list of one of the following:
  • simple object ids if they are single guaranteed drops, e.g.: "378,380,384"
  • object ids and drop percent chance separated by underscore, e.g.: "378_100,380_50,384_20"
  • object ids, min drop amount, max drop amount, and drop percent chance all separated by underscore, e.g.: "378_3_5_100,380_2_4_50,384_1_3_20"

"config"
: a list of keys that are meant to be user-configurable (see Config Variables below)

Frames

Frames are JSON objects that have the following keys:

"frameTicks": how many ticks to wait before starting the next frame (30 ticks per second I think)
"invincible": true or false, makes the player invincible for this frame (set to false when you want it turn off, or it will turn off after a couple of seconds)
"action": 0 = none, 1 = regular attack, 2 = type-based special attack (i.e. sword, hammer, or dagger special attack)
"special": a JSON object describing a special effect to trigger in this frame (see below).
"relativeFacingDirection": how may 90 degree clockwise turns to make from the original facing direction for this frame
"trajectoryX": set player trajectory relative to the player's facing direction, as if the player were facing down (so negative is to the player's right, etc.),
"trajectoryY": set player trajectory relative to the player's facing direction, as if the player were facing down (so negative is behind the player, etc.),
"sound": the name of the built in sound to play for this frame (attacks have their own sounds already)
"projectiles": a JSON array of projectile data to create vanilla projectiles (see below).
"config": a list of keys that are meant to be user-configurable (see Config Variables below)


Special Effects

The "special" object has the following keys:

"name": the name of the special effect to trigger. Currently includes:
  • "lightning": creates lightning based on the parameters
  • "explosion": creates an explosion based on the parameters (not tested yet)
"parameters": a JSON array of strings, based on special effect name:
  • "damageMult" - the amount of damage to inflict based on the weapon's min and max damage (omit if you want to set min and max manually)
  • "minDamage" - minimum amount of damage to inflict per monster hit
  • "maxDamage" - maximum amount of damage to inflict per monster hit
  • "radius" - how big the effect and damage area will be
  • "sound" - name of the built-in sound to play on trigger
"config": a list of keys that are meant to be user-configurable (see Config Variables below)


Projectiles

Projectiles are JSON objects that have the following keys:

"damage": for specific weapons, how many points of damage to inflict on contact; for type-based, this is a multiplier of the weapon's damage instead
"parentSheetIndex": which graphic to use for the sprite (see TileSheets/projectiles.png),
"bouncesTillDestruct": makes projectiles ricochet,
"tailLength": makes projectiles long,
"rotationVelocity": makes projectiles sping,
"xVelocity": relative to the player's facing direction, as if the player were facing down (so negative is to the player's right, etc.),
"yVelocity": relative to the player's facing direction, as if the player were facing down (so negative is behind the player, etc.),
"startingPositionX": starting from the center of the player, relative to the player's facing direction, as if the player were facing down (so negative is to the player's right, etc.),
"startingPositionY": starting from the center of the player, relative to the player's facing direction, as if the player were facing down (so negative is behind the player, etc.),
"collisionSound": name of built in sound to play on contact,
"firingSound": name of built in sound to play on firing,
"explode": true or false,
"damagesMonsters": true or false,
"spriteFromObjectSheet": true or false, changes the tilesheet to Maps/springObjects.png, allowing you to fling things like pizzas, ofc.
"config": a list of keys that are meant to be user-configurable (see Config Variables below)


Config Variables

You can now optionally allow users to change any of the above variables you select by adding them to the appropriate config key and specifying a corresponding config variable name. For example, if you want to allow a user to modify a loot enchantment, you can set something like this:

            "enchantments": [
                {
                    "name": "Golden Goose Drops",
                    "type": "loot",
                    "parameters": {
                        "trigger":"slay",
                        "chance":"20",
                        "extraDropChecks":"1",
                        "sound": "give_gift"
                    },
                    "config":{
                        "chance": "goldenGooseExtraDropsChance",
                        "extraDropChecks": "goldenGooseExtraDropsMax",
                        "sound": "goldenGooseSound"
                    }
                },
                {
                    "name": "Golden Goose Ores",
                    "type": "loot",
                    "parameters": {
                        "trigger":"slay",
                        "chance":"30",
                        "extraDropItems":"378_3_5_100,380_2_4_50,384_1_3_20",
                    },
                    "config":{
                        "chance": "goldenGooseExtraItemsChance",
                        "extraDropItems": "goldenGooseExtraDropItems",
                    }
                },

this adds the following keys to a config.json file in the content pack:

"goldenGooseExtraDropsChance" : "20",
"goldenGooseExtraDropsMax": "1",
"goldenGooseExtraItemsChance" : "30",
"goldenGooseExtraDropItems": "378_3_5_100,380_2_4_50,384_1_3_20"
"goldenGooseSound" : "give_gift",

which a user can then edit without it being overwritten by your content pack's updates. Remember not to distribute a config.json file with your content pack, otherwise it will overwrite the user's settings!


Notes

A list of built-in sound effect names are here.

If you want to reload your content packs during the game, there is a hotkey to do that for you (NumPad 0 by default).

Article information

Added on

Edited on

Written by

aedenthorn

3 comments

  1. ALOPRINHA
    ALOPRINHA
    • member
    • 0 kudos
    Ójogo mobile, como faço para configurar o mod no meu game?
  2. Hamio
    Hamio
    • member
    • 18 kudos
    Hello, how are you? So, i have been doing tests and I found your mod incredible, i will say ideas for new custom enchantments.

    Well, I thought of the following:
    -Pile: Increases the chance of dropping items (just like the thief ring).
    -Enchanted: This is a generic name, where the function is to damage an enemy, you apply some negative status to it, like slimed.
    -Continuity: Each time you attack the same enemy, you will increase your damage against it, as long as you don't spend too much time without attacking and since you don't change enemies.
    -Imunity: Weapons can have defense, but not immunity, it would be nice to have items that provide immunity rather than defense or both.
    -Reflection: Instead of destroying an enemy's projectile, you could launch it back.
    -Anti-regenerative: Prevents mobs from healing, like Shamam.

    1. aedenthorn
      aedenthorn
      • premium
      • 1,245 kudos
      Pile and Enchanted would work, some of the others will not work - enchantment triggers are limited in the game to on damage, on kill, and on equip.  Glad you found it useful!

      Edit: actually, most of these are "possible", it would just take some code hacking.