-
Notifications
You must be signed in to change notification settings - Fork 508
Quickstart guide for rule elements
A short guide to using rule elements:
Note:- This document refers to items, items are feats/ class features, spell effects, weapons basically anything that can be added to a character Note:- This interface is currently being developed and subject to change Note:- Take care when adding rule elements, make sure to do any troubleshooting/experimenting on a spare/blank token/actor Note:- People love to talk rule elements on the discord! Ask for help or questions Note:- This is document is not exhaustive
What are they?
A series of instructions applied to an item that modifies the character sheet in some way. It another way to create change without coding!
When would I use them?
For setting up modifiers, conditions that apply to a character for example a barbarians Rage, bless/ inspire courage, etc.
How do they work
- Enable the rules elements in-game settings -> configure settings -> system settings -> Advanced Rule Element using
- Check that they have been activated: a. Open any item and check that the "rules" tab is revealed
- Try some out, head to the compendia, and find spell effects, pick one and drag it to your character. a. inspire courage is a good place to start.
- Open up the spell effect you chose and look at Rules Tab notice text in the boxes, that is a rule element
A correctly created rule element will do the work of several lines of macro. Once you get the hang of them it allows for easy automation.
Let's look at an example, inspire courage:
{"key":"PF2E.RuleElement.FlatModifier","label":"Inspire Courage","selector":"attack","type":"status","value":1}
{"key":"PF2E.RuleElement.FlatModifier","label":"Inspire Courage","selector":"damage","type":"status","value":1}
{"key":"PF2E.RuleElement.FlatModifier","label":"Inspire Courage (vs fear)","predicate":{"all":["fear"]},"selector":"will","type":"status","value":1}
They might be tricky to get the hang of. These once set up, will save you lines and lines of code.
Let's break these down:
- Key: This is the name given to the rule element within the code.
- If this is not correct your rule with do nothing!
- Label: Name your rule. For flat modifiers text will show up when you look at the modifiers of a given roll
- To see this in action apply the rule effect then look at the ac modifiers, you should see "Inspire courage"
- Predicate: If you want your bonus to only apply at certain times, only vs. fear, you use a predicate, which comes in three modes:
- ALL : if everything in the list is present for a roll the modifier is applied
- ANY : if at least one in the list is present the modifier is applied
- NOT : if at least one item in the list is present the modifier is not applied
- an incorrect predicate will make your rule act unexpectedly, these are case sensitive.
- Selector: Specifies, or selects, what to apply your modifier to.
- There will be a list at the bottom of the document.
- An incorrect selector will make your rule do nothing
- Add the _id/ of an item to the selector to target a specific item or item type
- Type: This is the modifier type,
- With this set appropriately the modifier will be taken into account for bonus stacking rules
- Value: the value can be minus if you are applying a penalty
Flat modifiers are just the tip of the iceberg. Here some more examples of slightly more complicated rules:
{
"key": "PF2E.RuleElement.FlatModifier",
"selector": "damage",
"label": "Rage",
"predicate": {
"not": ["agile", "rage"]
},
"value": {
"brackets": [
{ "end": 6, "value": 2 },
{ "start": 7, "end": 14, "value": 6 },
{ "start": 15, "value": 12 }
]
}
}
It's possible to add level-scaling with the value of a modifier!
There are several more rule types with examples littered throughout the compendium, without being exhaustive:
PF2E.RuleElement.DexterityModifierCap
example rule:
{
"key": "PF2E.RuleElement.DexterityModifierCap",
"value": 5
}
example use: bracers of armor
PF2E.RuleElement.TempHP
example rule:
{
"key": "PF2E.RuleElement.TempHP",
"value": 15
}
example use: "Aeon Stone (Pink Rhomboid)"
PF2E.RuleElement.DamageDice
Example rule:
{
"key": "PF2E.RuleElement.DamageDice",
"predicate": {
"all": [
"melee",
"power-attack"
]
},
"selector": "damage",
"value": {
"brackets": [
{
"end": 9,
"value": {
"diceNumber": 1
}
},
{
"end": 17,
"start": 10,
"value": {
"diceNumber": 2
}
},
{
"start": 18,
"value": {
"diceNumber": 3
}
}
]
}
}
example use: Feat power attack
Example Rule: Fire Poi added damage
{
"key": "PF2E.RuleElement.DamageDice",
"selector": "{item|_id}-damage",
"diceNumber": 1,
"dieSize": "d4",
"damageType": "fire",
"predicate": {
"all": [
"on-fire"
]
},
"label": "Ignited"
}
in this second example: Notice how the selector references the Items damage. The Rule Element only works on the Fire Poi itself this way
PF2E.RuleElement.ToggleProperty
example rule:
{
"key": "PF2E.RuleElement.ToggleProperty",
"property": "flags.pf2e.rollOptions.damage-roll.power-attack"
}
example use: Power attack feat
PF2E.RuleElement.BaseSpeed
example rule:
{
"key": "PF2E.RuleElement.BaseSpeed",
"selector": "fly",
"value": 30
}
example use: Effect: Barding of the Zephyr
PF2E.RuleElement.Sense
example rule:
{
"key": "PF2E.RuleElement.Sense",
"label": "PF2E.SensesDarkvision",
"selector": "darkvision"
}
example use: spell effect bloodhound mask
PF2E.RuleElement.TokenEffectIcon
This will apply an effects icon to the token it is applied to
{"key":"PF2E.RuleElement.TokenEffectIcon"}
PF2E.RuleElement.TokenImage
{
"key":"PF2E.RuleElement.TokenImage",
"value":"systems/pf2e/icons/bestiary-1/boar.webp"
}
This rule element will change the token of an actor to the boar token that is included in the system. It is useful for Wild Shape or can be customized to set expressions on PCs per effect item.
PF2E.RuleElement.TokenSize
{
"key":"PF2E.RuleElement.TokenSize",
"value":2
}
This rule element can be used on a 2nd level enlarge spell effect to resize the token. Deleting the latest TokenSize effect from the token will reset the size to the original token size again.
PF2E.RuleElement.FixedProficiency
{
"key":"PF2E.RuleElement.FixedProficiency",
"selector":"athletics",
"value":9
}
This rule element can be used well for Animal Form, as the name suggests it sets the proficiency to the given value. It appears in the game as a modifier to the skill that makes up for the difference.
PF2E.RuleElement.SetProperty
{
"key": "PF2E.RuleElement.SetProperty",
"property": "flags.pf2e.rollOptions.all.rage",
"on": {
"added": true,
"removed": false
},
"retain": true
}
This works as a toggle property or with a toggle property to toggle it off/on.
Rage has a lot of different mechanics depending on the instinct and some feats, some of these need to be on an effect item, like the temp HP and token size or even image changes. to avoid clutter it's easier to use predicated rules on feats and features and set them active with a rage effect using the setProperty rule element. Some breakdown:
- property: this works the same way as in the toggleProperty "flags.pf2e.rollOptions..name"
- on -> added: technically optional but mostly useless without it
- on -> removed: optional, will disable the "retain" field if present
- retain: optional, will restore the old value when an item with this rule elements is deleted from the character.
PF2E.RuleElement.Strike
{
"key": "PF2E.RuleElement.Strike",
"category": "unarmed",
"damage": {
"base": {
"damageType": "slashing",
"dice": 1,
"die": "d8"
}
},
"group": "brawling",
"label": "Tiger Claw",
"range": "melee",
"traits": [
"agile",
"finesse",
"unarmed",
"nonlethal"
]
}
This rule element is a bit trickier in that there are a lot of necessary fields. The easiest way to create your own custom strike would be to start from a finished strike like the monks Tiger Claw strike here.
If necessary an "ability": "int" could be used for a strike that scales its to-hit with intelligence, also works with other 3 character ability shorthand. (like the "Spiritual Weapon" Spell of a witch could)
List of valid selectors
all
str-based
dex-based
con-based
int-based
wis-based
cha-based
attack
attack-roll
str-attack
dex-attack
con-attack
int-attack
wis-attack
cha-attack
damage
saving-throw
fortitude
reflex
will
initiative
perception
class (still subject to change)
ac
hp
hp-per-level
speed
land-speed
burrow-speed
climb-speed
fly-speed
swim-speed
skill-check
acrobatics
arcana
athletics
crafting
deception
diplomacy
intimidation
medicine
nature
occultism
performance
religion
society
stealth
survival
thievery