Add a D&D 5e feature
dnd5e-add-featureAdd D&D 5e features to a Foundry VTT NPC or character: passives, saves, attacks, auras, spells, or spellcasting. Each type reads only its own parameters and reports ignored ones.
Instructions
[D&D 5e only] Add one thing to an existing dnd5e NPC or character; featureType chooses what, and each kind reads only its own parameters (the answer names the ignored ones).
passive: a trait without a roll. Needs featureName.
save: a feature forcing a saving throw with fixed DC, damage, optional template. Needs featureName, saveAbility, saveDC, damageParts; areaSize with areaType.
attack: a weapon attack. Needs featureName, attackType, damageParts; rangeFt when ranged. The first damage part is the weapon damage.
attack-with-save: an attack whose hit also forces a save with its own damage. Needs in addition saveAbility, saveDC, saveDamageParts.
aura: area damage without attack or save; no lasting aura or effect is created. Needs featureName, damageParts, areaType, areaSize.
spellcasting: casting ability and caster level of an NPC without class items, per class, level and rules version (2024 paladins and rangers have slots at level 1). dnd5e derives the slots; actors with class items are refused. Needs spellcastingClass, spellcastingLevel.
spells: copy spells by English name from compendiums. Needs spellNames. An item name the actor already has (ignoring case) is refused. The actor is found by id, exact name or token id, never by part of a name. Everything written is read back. Run spellcasting before spells.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| saveDC | No | Fixed difficulty class of the save. Used by: save, attack-with-save. | |
| rangeFt | No | Normal range in feet, needed for a ranged attack. Used by: attack, attack-with-save. | |
| reachFt | No | Reach in feet. Used by: melee attack, attack-with-save. | |
| areaSize | No | Size of the template in areaUnits (length of a line, radius of a sphere). Used by: save with areaType, aura. | |
| areaType | No | Template shape. An emanation is stored as a radius; a line gets a width, a cylinder a height, a cube its side in every direction. Used by: save (optional), aura (required). | |
| equipped | No | Whether the weapon is equipped. Used by: attack, attack-with-save. | |
| areaUnits | No | Units of areaSize. Used by: save, aura. | ft |
| attackType | No | Melee uses reachFt, ranged needs rangeFt. Used by: attack, attack-with-save. | |
| halfOnSave | No | Half damage on a successful save; otherwise none. Used by: save. | |
| proficient | No | Whether the proficiency bonus is added to hit; false stores a non-proficient weapon. Used by: attack, attack-with-save. | |
| properties | No | dnd5e weapon property keys such as "fin", "lgt", "rch", "thr"; unknown keys are stored with a warning. Used by: attack, attack-with-save. | |
| saveOnSave | No | Damage of that save on a success. Used by: attack-with-save. | none |
| sourceBook | No | Source book, e.g. "MM". Used by: passive, save, attack, attack-with-save, aura. | |
| sourcePage | No | Page in the source book. Used by: passive, save, attack, attack-with-save, aura. | |
| spellNames | No | English spell names, matched whole and ignoring case. Used by: spells. | |
| affectsType | No | What the area affects. Used by: save, aura. | creature |
| attackBonus | No | Extra bonus to hit, not to damage. Used by: attack, attack-with-save. | |
| damageParts | No | Damage. For an attack the first part is the weapon damage and further parts add to it. Used by: save, attack, attack-with-save, aura. | |
| description | No | Description as HTML. Used by: passive, save, attack, attack-with-save, aura. | |
| featureName | No | Name of the new item; refused when the actor has an item of that name, ignoring case. Used by: passive, save, attack, attack-with-save, aura. | |
| featureType | Yes | What to add; each kind reads only its own parameters and names the ones it ignored | |
| longRangeFt | No | Long range in feet, greater than rangeFt. Used by: ranged attack, attack-with-save. | |
| saveAbility | No | Ability of the saving throw. Used by: save, attack-with-save. | |
| sourceRules | No | Rules version. Decides the slots of paladin and ranger at level 1 and is stored as the source of an item; the world setting of dnd5e when left out. Used by: passive, save, attack, attack-with-save, aura, spellcasting. | 2014 |
| weaponClass | No | Weapon category; "natural" for claws and bites. Used by: attack, attack-with-save. | natural |
| activationType | No | How it is used in the action economy. Used by: save, attack, attack-with-save, aura. | action |
| abilityModifier | No | Ability for attack and damage. Left out: the better of STR and DEX for a natural weapon or one with the property "fin", as dnd5e allows them, else STR in melee and DEX at range. Written into the attack under both rules versions. Used by: attack, attack-with-save. | |
| actorIdentifier | Yes | The actor: its id, its exact name (case does not matter) or the id of one of its tokens. Parts of a name are not matched. Needed by every kind | |
| compendiumPacks | No | Item compendiums to search, first match wins. Left out: the standard spell compendium of the world's rules version (dnd5e.spells for 2014, dnd5e.spells24 for 2024). Used by: spells. | |
| saveDamageParts | No | Damage of the separate save that follows a hit. Used by: attack-with-save. | |
| spellcastingClass | No | Class whose table gives the spell slots; warlock uses pact magic. Used by: spellcasting. | |
| spellcastingLevel | No | Class level from 1 to 20. Used by: spellcasting. | |
| spellcastingAbility | No | Casting ability; left out, INT for wizard and artificer, WIS for cleric, druid and ranger, CHA for bard, paladin, sorcerer and warlock. Used by: spellcasting. |